Skip to content

Commit

Permalink
Merge pull request JuliaLang#19 from JuliaLang/master
Browse files Browse the repository at this point in the history
merge 4f3017e from upstream
  • Loading branch information
tkelman committed Mar 24, 2014
2 parents 76aabf0 + 4f3017e commit a0609ce
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 7 deletions.
6 changes: 3 additions & 3 deletions base/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ for (f,T) in ((:float16, Float16),
(:float64, Float64),
(:complex64, Complex64),
(:complex128, Complex128))
@eval ($f)(x::AbstractArray) = convert(AbstractArray{$T}, x)
@eval ($f){S,N}(x::AbstractArray{S,N}) = convert(AbstractArray{$T,N}, x)
end

float{T<:FloatingPoint}(x::AbstractArray{T}) = x
complex{T<:Complex}(x::AbstractArray{T}) = x

float (x::AbstractArray) = copy!(similar(x,typeof(float(one(eltype(x))))), x)
complex (x::AbstractArray) = copy!(similar(x,typeof(complex(one(eltype(x))))), x)
float{T,N}(x::AbstractArray{T,N}) = convert(AbstractArray{typeof(float(one(T))),N},x)
complex{T,N}(x::AbstractArray{T,N}) = convert(AbstractArray{typeof(complex(one(T))),N}, x)

full(x::AbstractArray) = x

Expand Down
14 changes: 12 additions & 2 deletions base/linalg/givens.jl
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,18 @@ function givensAlgorithm{T<:FloatingPoint}(f::Complex{T}, g::Complex{T})
return cs, sn, r
end

givens{T}(f::T, g::T, i1::Integer, i2::Integer, size::Integer) = i2 <= size ? (i1 < i2 ? Givens(size, i1, i2, convert((T,T,T), givensAlgorithm(f, g))...) : error("second index must be larger than the first")) : error("indices cannot be larger than size Givens rotation matrix")
givens{T}(A::AbstractMatrix{T}, i1::Integer, i2::Integer, col::Integer) = i1 < i2 ? Givens(size(A, 1), i1, i2, convert((T,T,T), givensAlgorithm(A[i1,col], A[i2,col]))...) : error("second row index must be larger than the first")
function givens{T}(f::T, g::T, i1::Integer, i2::Integer, size::Integer)
i2 <= size || error("indices cannot be larger than size Givens rotation matrix")
i1 < i2 || error("second index must be larger than the first")
h = givensAlgorithm(f, g)
Givens(size, i1, i2, convert(T, h[1]), convert(T, h[2]), convert(T, h[3]))
end

function givens{T}(A::AbstractMatrix{T}, i1::Integer, i2::Integer, col::Integer)
i1 < i2 || error("second index must be larger than the first")
h = givensAlgorithm(A[i1,col], A[i2,col])
Givens(size(A, 1), i1, i2, convert(T, h[1]), convert(T, h[2]), convert(T, h[3]))
end

*{T}(G1::Givens{T}, G2::Givens{T}) = Rotation(push!(push!(Givens{T}[], G2), G1))
*(G::Givens, B::BitArray{2}) = error("method not defined")
Expand Down
1 change: 1 addition & 0 deletions base/linalg/tridiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ convert(::Type{Tridiagonal}, A::SymTridiagonal) = Tridiagonal(A.ev, A.dv, A.ev)
-(A::SymTridiagonal, B::Tridiagonal) = Tridiagonal(A.ev-B.dl, A.dv-B.d, A.ev-B.du)

convert{T}(::Type{Tridiagonal{T}},M::Tridiagonal) = Tridiagonal(convert(Vector{T}, M.dl), convert(Vector{T}, M.d), convert(Vector{T}, M.du))
convert{T}(::Type{AbstractMatrix{T}},M::Tridiagonal) = Tridiagonal(convert(Vector{T}, M.dl), convert(Vector{T}, M.d), convert(Vector{T}, M.du))
convert{T}(::Type{Tridiagonal{T}}, M::SymTridiagonal{T}) = Tridiagonal(M)
convert{T}(::Type{SymTridiagonal{T}}, M::Tridiagonal) = M.dl==M.du ? (SymTridiagonal(M.dl, M.d)) :
error("Tridiagonal is not symmetric, cannot convert to SymTridiagonal")
Expand Down
3 changes: 1 addition & 2 deletions base/pkg/entry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,7 @@ function updatehook(pkgs::Vector)
""")
end

@windows_only const JULIA = joinpath(JULIA_HOME, ENV["JULIA_EXE"])
@unix_only const JULIA = joinpath(JULIA_HOME, "julia-readline")
const JULIA = joinpath(JULIA_HOME, "julia-basic")

function test!(pkg::String, errs::Vector{String}, notests::Vector{String})
const reqs_path = abspath(pkg,"test","REQUIRE")
Expand Down
14 changes: 14 additions & 0 deletions doc/manual/packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -517,3 +517,17 @@ Examples::
@unix @!osx

The first condition applies to any system but Windows and the second condition applies to any UNIX system besides OS X.

Runtime checks for the current version of Julia can be made using the built-in
``VERSION`` variable, which is of type ``VersionNumber``. Such code is
occasionally necessary to keep track of new or deprecated functionality between
various releases of Julia. Examples of runtime checks::

VERSION < v"0.3-" #exclude all pre-release versions of 0.3

v"0.2-" <= VERSION < v"0.3-" #get all 0.2 versions, including pre-releases, up to the above

v"0.2" <= VERSION < v"0.3-" #To get only stable 0.2 versions (Note v"0.2" == v"0.2.0")

VERSION >= v"0.2.1" #get at least version 0.2.1

0 comments on commit a0609ce

Please sign in to comment.