Skip to content

Commit a0609ce

Browse files
committed
Merge pull request JuliaLang#19 from JuliaLang/master
merge 4f3017e from upstream
2 parents 76aabf0 + 4f3017e commit a0609ce

File tree

5 files changed

+31
-7
lines changed

5 files changed

+31
-7
lines changed

base/abstractarray.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,14 @@ for (f,T) in ((:float16, Float16),
290290
(:float64, Float64),
291291
(:complex64, Complex64),
292292
(:complex128, Complex128))
293-
@eval ($f)(x::AbstractArray) = convert(AbstractArray{$T}, x)
293+
@eval ($f){S,N}(x::AbstractArray{S,N}) = convert(AbstractArray{$T,N}, x)
294294
end
295295

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

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

302302
full(x::AbstractArray) = x
303303

base/linalg/givens.jl

+12-2
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,18 @@ function givensAlgorithm{T<:FloatingPoint}(f::Complex{T}, g::Complex{T})
181181
return cs, sn, r
182182
end
183183

184-
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")
185-
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")
184+
function givens{T}(f::T, g::T, i1::Integer, i2::Integer, size::Integer)
185+
i2 <= size || error("indices cannot be larger than size Givens rotation matrix")
186+
i1 < i2 || error("second index must be larger than the first")
187+
h = givensAlgorithm(f, g)
188+
Givens(size, i1, i2, convert(T, h[1]), convert(T, h[2]), convert(T, h[3]))
189+
end
190+
191+
function givens{T}(A::AbstractMatrix{T}, i1::Integer, i2::Integer, col::Integer)
192+
i1 < i2 || error("second index must be larger than the first")
193+
h = givensAlgorithm(A[i1,col], A[i2,col])
194+
Givens(size(A, 1), i1, i2, convert(T, h[1]), convert(T, h[2]), convert(T, h[3]))
195+
end
186196

187197
*{T}(G1::Givens{T}, G2::Givens{T}) = Rotation(push!(push!(Givens{T}[], G2), G1))
188198
*(G::Givens, B::BitArray{2}) = error("method not defined")

base/linalg/tridiag.jl

+1
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ convert(::Type{Tridiagonal}, A::SymTridiagonal) = Tridiagonal(A.ev, A.dv, A.ev)
232232
-(A::SymTridiagonal, B::Tridiagonal) = Tridiagonal(A.ev-B.dl, A.dv-B.d, A.ev-B.du)
233233

234234
convert{T}(::Type{Tridiagonal{T}},M::Tridiagonal) = Tridiagonal(convert(Vector{T}, M.dl), convert(Vector{T}, M.d), convert(Vector{T}, M.du))
235+
convert{T}(::Type{AbstractMatrix{T}},M::Tridiagonal) = Tridiagonal(convert(Vector{T}, M.dl), convert(Vector{T}, M.d), convert(Vector{T}, M.du))
235236
convert{T}(::Type{Tridiagonal{T}}, M::SymTridiagonal{T}) = Tridiagonal(M)
236237
convert{T}(::Type{SymTridiagonal{T}}, M::Tridiagonal) = M.dl==M.du ? (SymTridiagonal(M.dl, M.d)) :
237238
error("Tridiagonal is not symmetric, cannot convert to SymTridiagonal")

base/pkg/entry.jl

+1-2
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,7 @@ function updatehook(pkgs::Vector)
663663
""")
664664
end
665665

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

669668
function test!(pkg::String, errs::Vector{String}, notests::Vector{String})
670669
const reqs_path = abspath(pkg,"test","REQUIRE")

doc/manual/packages.rst

+14
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,17 @@ Examples::
517517
@unix @!osx
518518

519519
The first condition applies to any system but Windows and the second condition applies to any UNIX system besides OS X.
520+
521+
Runtime checks for the current version of Julia can be made using the built-in
522+
``VERSION`` variable, which is of type ``VersionNumber``. Such code is
523+
occasionally necessary to keep track of new or deprecated functionality between
524+
various releases of Julia. Examples of runtime checks::
525+
526+
VERSION < v"0.3-" #exclude all pre-release versions of 0.3
527+
528+
v"0.2-" <= VERSION < v"0.3-" #get all 0.2 versions, including pre-releases, up to the above
529+
530+
v"0.2" <= VERSION < v"0.3-" #To get only stable 0.2 versions (Note v"0.2" == v"0.2.0")
531+
532+
VERSION >= v"0.2.1" #get at least version 0.2.1
533+

0 commit comments

Comments
 (0)