Skip to content

Commit d3c5662

Browse files
authored
Merge pull request #362 from JuliaArrays/ajf/deps
Catch up on v0.7
2 parents 8c69b34 + d8ff05c commit d3c5662

40 files changed

+456
-343
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
julia 0.6.0
2-
Compat 0.39
2+
Compat 0.46

src/MArray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ end
7474
@inline MArray(a::StaticArray) = MArray{size_tuple(Size(a))}(Tuple(a))
7575

7676
# Simplified show for the type
77-
show(io::IO, ::Type{MArray{S, T, N}}) where {S, T, N} = print(io, "MArray{$S,$T,$N}")
77+
#show(io::IO, ::Type{MArray{S, T, N}}) where {S, T, N} = print(io, "MArray{$S,$T,$N}")
7878

7979
# Some more advanced constructor-like functions
8080
@inline one(::Type{MArray{S}}) where {S} = one(MArray{S,Float64,tuple_length(S)})
@@ -101,7 +101,7 @@ end
101101
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(v)), convert(T, val), i)
102102
else
103103
# This one is unsafe (#27)
104-
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
104+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Nothing}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
105105
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
106106
end
107107

src/MMatrix.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
@inline MMatrix(a::StaticMatrix) = MMatrix{size(typeof(a),1),size(typeof(a),2)}(Tuple(a))
5858

5959
# Simplified show for the type
60-
show(io::IO, ::Type{MMatrix{N, M, T}}) where {N, M, T} = print(io, "MMatrix{$N,$M,$T}")
60+
#show(io::IO, ::Type{MMatrix{N, M, T}}) where {N, M, T} = print(io, "MMatrix{$N,$M,$T}")
6161

6262
# Some more advanced constructor-like functions
6363
@inline one(::Type{MMatrix{N}}) where {N} = one(MMatrix{N,N})
@@ -78,7 +78,7 @@ show(io::IO, ::Type{MMatrix{N, M, T}}) where {N, M, T} = print(io, "MMatrix{$N,$
7878
else
7979
# Not sure about this... slow option for now...
8080
m.data[i]
81-
#unsafe_load(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(m.data)), i)
81+
#unsafe_load(Base.unsafe_convert(Ptr{Ptr{Nothing}}, pointer_from_objref(m.data)), i)
8282
end
8383
end
8484

@@ -92,7 +92,7 @@ end
9292
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(m)), val, i)
9393
else # TODO check that this isn't crazy. Also, check it doesn't cause problems with GC...
9494
# This one is unsafe (#27)
95-
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(m.data)), pointer_from_objref(val), i)
95+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Nothing}}, pointer_from_objref(m.data)), pointer_from_objref(val), i)
9696
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
9797
end
9898

src/MVector.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const MVector{S, T} = MArray{Tuple{S}, T, 1, S}
2121
@inline MVector{S}(x::NTuple{S,Any}) where {S} = MVector{S, promote_tuple_eltype(typeof(x))}(x)
2222

2323
# Simplified show for the type
24-
show(io::IO, ::Type{MVector{N, T}}) where {N, T} = print(io, "MVector{$N,$T}")
24+
#show(io::IO, ::Type{MVector{N, T}}) where {N, T} = print(io, "MVector{$N,$T}")
2525

2626
# Some more advanced constructor-like functions
2727
@inline zeros(::Type{MVector{N}}) where {N} = zeros(MVector{N,Float64})
@@ -46,7 +46,7 @@ end
4646
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(v)), val, i)
4747
else
4848
# This one is unsafe (#27)
49-
#unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
49+
#unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Nothing}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
5050
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
5151
end
5252

src/SArray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ end
5353
@inline SArray(a::StaticArray) = SArray{size_tuple(Size(a))}(Tuple(a))
5454

5555
# Simplified show for the type
56-
show(io::IO, ::Type{SArray{S, T, N}}) where {S, T, N} = print(io, "SArray{$S,$T,$N}")
56+
# show(io::IO, ::Type{SArray{S, T, N}}) where {S, T, N} = print(io, "SArray{$S,$T,$N}") # TODO reinstate
5757

5858
# Some more advanced constructor-like functions
5959
@inline one(::Type{SArray{S}}) where {S} = one(SArray{S, Float64, tuple_length(S)})

src/SDiagonal.jl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ end
4040

4141
# avoid linear indexing?
4242
@propagate_inbounds function getindex(D::SDiagonal{N,T}, k::Int) where {N,T}
43-
i, j = ind2sub(size(D), k)
43+
i, j = CartesianIndices(size(D))[k].I
4444
D[i,j]
4545
end
4646

@@ -85,23 +85,26 @@ eye(::Type{SDiagonal{N,T}}) where {N,T} = SDiagonal(ones(SVector{N,T}))
8585
one(::Type{SDiagonal{N,T}}) where {N,T} = SDiagonal(ones(SVector{N,T}))
8686
one(::SDiagonal{N,T}) where {N,T} = SDiagonal(ones(SVector{N,T}))
8787
Base.zero(::SDiagonal{N,T}) where {N,T} = SDiagonal(zeros(SVector{N,T}))
88-
89-
expm(D::SDiagonal) = SDiagonal(exp.(D.diag))
90-
logm(D::SDiagonal) = SDiagonal(log.(D.diag))
91-
sqrtm(D::SDiagonal) = SDiagonal(sqrt.(D.diag))
92-
Base.chol(D::SDiagonal) = SDiagonal(Base.chol.(D.diag))
93-
Base.LinAlg._chol!(D::SDiagonal, ::Type{UpperTriangular}) = chol(D)
94-
88+
if VERSION < v"0.7-"
89+
expm(D::SDiagonal) = SDiagonal(exp.(D.diag))
90+
logm(D::SDiagonal) = SDiagonal(log.(D.diag))
91+
sqrtm(D::SDiagonal) = SDiagonal(sqrt.(D.diag))
92+
else
93+
exp(D::SDiagonal) = SDiagonal(exp.(D.diag))
94+
log(D::SDiagonal) = SDiagonal(log.(D.diag))
95+
sqrt(D::SDiagonal) = SDiagonal(sqrt.(D.diag))
96+
end
97+
LinearAlgebra.chol(D::SDiagonal) = SDiagonal(Base.chol.(D.diag))
98+
LinearAlgebra._chol!(D::SDiagonal, ::Type{UpperTriangular}) = chol(D)
9599

96100
\(D::SDiagonal, B::StaticMatrix) = scalem(1 ./ D.diag, B)
97101
/(B::StaticMatrix, D::SDiagonal) = scalem(1 ./ D.diag, B)
98102
\(Da::SDiagonal, Db::SDiagonal) = SDiagonal(Db.diag ./ Da.diag)
99103
/(Da::SDiagonal, Db::SDiagonal) = SDiagonal(Da.diag ./ Db.diag )
100104

101-
102105
@generated function check_singular(D::SDiagonal{N}) where {N}
103106
quote
104-
Base.Cartesian.@nexprs $N i->(@inbounds iszero(D.diag[i]) && throw(Base.LinAlg.SingularException(i)))
107+
Base.Cartesian.@nexprs $N i->(@inbounds iszero(D.diag[i]) && throw(LinearAlgebra.SingularException(i)))
105108
end
106109
end
107110

src/SMatrix.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ end
5757
@inline SMatrix(a::StaticMatrix) = SMatrix{size(typeof(a),1),size(typeof(a),2)}(Tuple(a))
5858

5959
# Simplified show for the type
60-
show(io::IO, ::Type{SMatrix{N, M, T}}) where {N, M, T} = print(io, "SMatrix{$N,$M,$T}")
60+
# show(io::IO, ::Type{SMatrix{N, M, T}}) where {N, M, T} = print(io, "SMatrix{$N,$M,$T}") # TODO reinstate
6161

6262
# Some more advanced constructor-like functions
6363
@inline one(::Type{SMatrix{N}}) where {N} = one(SMatrix{N,N})

src/SVector.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const SVector{S, T} = SArray{Tuple{S}, T, 1, S}
2323
#@inline convert{S,T}(::Type{SVector{S}}, a::AbstractArray{T}) = SVector{S,T}((a...))
2424

2525
# Simplified show for the type
26-
show(io::IO, ::Type{SVector{N, T}}) where {N, T} = print(io, "SVector{$N,$T}")
26+
# show(io::IO, ::Type{SVector{N, T}}) where {N, T} = print(io, "SVector{$N,$T}") # TODO reinstate
2727

2828
# Some more advanced constructor-like functions
2929
@inline zeros(::Type{SVector{N}}) where {N} = zeros(SVector{N,Float64})

src/StaticArrays.jl

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,42 @@ module StaticArrays
44

55
import Base: @_inline_meta, @_propagate_inbounds_meta, @_pure_meta, @propagate_inbounds, @pure
66

7-
import Base: getindex, setindex!, size, similar, vec, show,
8-
length, convert, promote_op, promote_rule, map, map!, reduce, reducedim, mapreducedim,
9-
mapreduce, broadcast, broadcast!, conj, transpose,
10-
hcat, vcat, ones, zeros, eye, one, cross, vecdot, reshape, fill,
11-
fill!, det, logdet, inv, eig, eigvals, eigfact, expm, logm, sqrtm, lyap, trace, kron, diag, vecnorm, norm, dot, diagm, diag,
12-
lu, svd, svdvals, svdfact, factorize, ishermitian, issymmetric, isposdef,
13-
iszero, sum, diff, prod, count, any, all, minimum,
14-
maximum, extrema, mean, copy, rand, randn, randexp, rand!, randn!,
15-
randexp!, normalize, normalize!, read, read!, write, Eigen
16-
17-
import Compat.adjoint
18-
19-
using Compat
7+
import Base: getindex, setindex!, size, similar, vec, show, length, convert, promote_op,
8+
promote_rule, map, map!, reduce, reducedim, mapreducedim, mapreduce, broadcast,
9+
broadcast!, conj, hcat, vcat, ones, zeros, one, reshape, fill, fill!, inv,
10+
iszero, sum, prod, count, any, all, minimum, maximum, extrema, mean,
11+
copy, read, read!, write
12+
13+
if VERSION < v"0.7-"
14+
using Compat
15+
16+
using Base.Random
17+
import Base: rand, randn, randexp, rand!, randn!, randexp!
18+
using Core.Inference.return_type
19+
20+
import Base.LinAlg: transpose, ctranspose, eye, vecdot, eig, eigvals, eigfact, expm,
21+
logm, sqrtm, lyap, trace, kron, diag, vecnorm, norm, dot, diagm, lu,
22+
svd, svdvals, svdfact, factorize, ishermitian, issymmetric,
23+
isposdef, normalize, normalize!, Eigen, det, logdet, cross, diff, qr
24+
const LinearAlgebra = Base.LinAlg
25+
26+
const adjoint = ctranspose
27+
const Adjoint = RowVector
28+
else
29+
using Compat
30+
31+
using Random
32+
import Random: rand, randn, randexp, rand!, randn!, randexp!
33+
using Core.Compiler: return_type
34+
35+
import Base: sqrt, exp, log
36+
37+
using LinearAlgebra
38+
import LinearAlgebra: transpose, adjoint, vecdot, eig, eigvals, eigfact, lyap, trace,
39+
kron, diag, vecnorm, norm, dot, diagm, lu, svd, svdvals, svdfact,
40+
factorize, ishermitian, issymmetric, isposdef, normalize,
41+
normalize!, Eigen, det, logdet, cross, diff, qr
42+
end
2043

2144
export StaticScalar, StaticArray, StaticVector, StaticMatrix
2245
export Scalar, SArray, SVector, SMatrix

src/abstractarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ end
1111

1212
# This seems to confuse Julia a bit in certain circumstances (specifically for trailing 1's)
1313
@inline function Base.isassigned(a::StaticArray, i::Int...)
14-
ii = sub2ind(size(a), i...)
14+
ii = LinearIndices(size(a))[i...]
1515
1 <= ii <= length(a) ? true : false
1616
end
1717

0 commit comments

Comments
 (0)