Skip to content

Commit 2a5ff9e

Browse files
committed
fixes for 0.7
1 parent 4b1afb6 commit 2a5ff9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+440
-736
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ os:
44
- linux
55
- osx
66
julia:
7-
- 0.6
7+
- 0.7
88
- nightly
99
notifications:
1010
email: false
1111
branches:
1212
only:
1313
- master
1414
- /^v[0-9]+\.[0-9]+\.[0-9]+$/ # version tags for Documenter.jl, see # 298
15-
matrix:
16-
allow_failures:
17-
- julia: nightly
15+
# matrix:
16+
# allow_failures:
17+
# - julia: nightly
1818
# - os: osx
1919
# uncomment the following lines to override the default test script
2020
#script:

REQUIRE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
julia 0.6.0
2-
Compat 0.66
1+
julia 0.7-alpha

appveyor.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
environment:
22
matrix:
3-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4-
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.7/julia-0.7-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7-latest-win64.exe"
55
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
66
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
77

8-
matrix:
9-
allow_failures:
10-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
11-
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
8+
# matrix:
9+
# allow_failures:
10+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
11+
# - JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
1212

1313
branches:
1414
only:

docs/src/pages/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ the dimensions of a static array. An array `sa::SA` of size `(dims...)` is
6363
associated with `Size{(dims...)}()`. The following are equivalent (`@pure`)
6464
constructors:
6565
```julia
66-
Size{(dims...)}()
66+
Size{(dims...,)}()
6767
Size(dims...)
6868
Size(sa::StaticArray)
6969
Size(SA) # SA <: StaticArray

perf/benchmark-qr.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using StaticArrays
2-
using BenchmarkTools, Compat
2+
using BenchmarkTools
33

44
a = m = 0
55
for K = 1:22

perf/benchmark_matrix_ops.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using StaticArrays, BenchmarkTools, DataFrames, DataStructures
22

33
Nmax = 20
4-
unary = (det, inv, expm)
4+
unary = (det, inv, exp)
55
binary = (\,)
66

77
data = OrderedDict{Symbol,Any}()

src/SDiagonal.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,14 @@ 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-
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))
88+
exp(D::SDiagonal) = SDiagonal(exp.(D.diag))
89+
log(D::SDiagonal) = SDiagonal(log.(D.diag))
90+
sqrt(D::SDiagonal) = SDiagonal(sqrt.(D.diag))
91+
function LinearAlgebra.cholesky(D::SDiagonal)
92+
any(x -> x < 0, D.diag) && throw(LinearAlgebra.PosDefException(1))
93+
C = sqrt.(D.diag)
94+
return Cholesky(SDiagonal(C), 'U', 0)
9695
end
97-
LinearAlgebra.chol(D::SDiagonal) = SDiagonal(chol.(D.diag))
98-
LinearAlgebra.chol(D::SDiagonal{N, T}) where {N, T <: Number} = SDiagonal(sqrt.(D.diag))
99-
LinearAlgebra._chol!(D::SDiagonal, ::Type{UpperTriangular}) = chol(D)
10096

10197
\(D::SDiagonal, B::StaticMatrix) = scalem(1 ./ D.diag, B)
10298
/(B::StaticMatrix, D::SDiagonal) = scalem(1 ./ D.diag, B)

src/StaticArrays.jl

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,17 @@ import Base: getindex, setindex!, size, similar, vec, show, length, convert, pro
1010
iszero, sum, prod, count, any, all, minimum, maximum, extrema, mean,
1111
copy, read, read!, write
1212

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 TransposeVector{T, V<:AbstractVector{T}} = RowVector{T, V}
27-
const AdjointVector{T, V<:AbstractVector{T}} = RowVector{T, ConjVector{T, V}}
28-
29-
const adjoint = ctranspose
30-
const tr = trace
31-
else
32-
using Compat
33-
34-
using Random
35-
import Random: rand, randn, randexp, rand!, randn!, randexp!
36-
using Core.Compiler: return_type
37-
38-
import Base: sqrt, exp, log
39-
40-
using LinearAlgebra
41-
import LinearAlgebra: transpose, adjoint, eye, vecdot, eig, eigvals, eigfact, lyap, tr,
42-
kron, diag, vecnorm, norm, dot, diagm, lu, svd, svdvals, svdfact,
43-
factorize, ishermitian, issymmetric, isposdef, normalize,
44-
normalize!, Eigen, det, logdet, cross, diff, qr
45-
46-
const TransposeVector{T, V<:AbstractVector{T}} = Transpose{T, V}
47-
const AdjointVector{T, V<:AbstractVector{T}} = Adjoint{T, V}
48-
end
13+
using Random
14+
import Random: rand, randn, randexp, rand!, randn!, randexp!
15+
using Core.Compiler: return_type
16+
import Base: sqrt, exp, log
17+
using LinearAlgebra
18+
import LinearAlgebra: transpose, adjoint, eye, vecdot, eigvals, eigen, lyap, tr,
19+
kron, diag, norm, dot, diagm, lu, svd, svdvals, svdfact,
20+
factorize, ishermitian, issymmetric, isposdef, normalize,
21+
normalize!, Eigen, det, logdet, cross, diff, qr
22+
const TransposeVector{T, V<:AbstractVector{T}} = Transpose{T, V}
23+
const AdjointVector{T, V<:AbstractVector{T}} = Adjoint{T, V}
4924

5025
export StaticScalar, StaticArray, StaticVector, StaticMatrix
5126
export Scalar, SArray, SVector, SMatrix
@@ -60,7 +35,7 @@ export @SVector, @SMatrix, @SArray
6035
export @MVector, @MMatrix, @MArray
6136

6237
export similar_type
63-
export push, pop, shift, unshift, insert, deleteat, setindex
38+
export push, pop, pushfirst, popfirst, insert, deleteat, setindex
6439

6540
const _module_arg = isdefined(Base, Symbol("@__MODULE__"))
6641

src/abstractarray.jl

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -125,42 +125,9 @@ reshape(a::Array, s::Size{S}) where {S} = s(a)
125125

126126
# TODO permutedims?
127127

128-
# TODO perhaps could move `Symmetric`, etc into seperate files.
129-
130-
# This is used in Base.LinAlg quite a lot, and it impacts type stability
131-
# since some functions like expm() branch on a check for Hermitian or Symmetric
132-
# TODO much more work on type stability. Base functions are using similar() with
133-
# size, which poses difficulties!!
134-
@inline Base.full(sym::Symmetric{T,SM}) where {T,SM <: StaticMatrix} = _full(Size(SM), sym)
135-
136-
@generated function _full(::Size{S}, sym::Symmetric{T,SM}) where {S, T, SM <: StaticMatrix}
137-
exprs_up = [i <= j ? :(m[$(LinearIndices(S)[i, j])]) : :(m[$(LinearIndices(S)[j, i])]) for i = 1:S[1], j=1:S[2]]
138-
exprs_lo = [i >= j ? :(m[$(LinearIndices(S)[i, j])]) : :(m[$(LinearIndices(S)[j, i])]) for i = 1:S[1], j=1:S[2]]
139-
140-
return quote
141-
@_inline_meta
142-
m = sym.data
143-
if sym.uplo == 'U'
144-
@inbounds return SM(tuple($(exprs_up...)))
145-
else
146-
@inbounds return SM(tuple($(exprs_lo...)))
147-
end
148-
end
149-
end
150-
151-
@inline Base.full(herm::Hermitian{T,SM}) where {T,SM <: StaticMatrix} = _full(Size(SM), herm)
152-
153-
@generated function _full(::Size{S}, herm::Hermitian{T,SM}) where {S, T, SM <: StaticMatrix}
154-
exprs_up = [i <= j ? :(m[$(LinearIndices(S)[i, j])]) : :(conj(m[$(LinearIndices(S)[j, i])])) for i = 1:S[1], j=1:S[2]]
155-
exprs_lo = [i >= j ? :(m[$(LinearIndices(S)[i, j])]) : :(conj(m[$(LinearIndices(S)[j, i])])) for i = 1:S[1], j=1:S[2]]
156-
157-
return quote
158-
@_inline_meta
159-
m = herm.data
160-
if herm.uplo == 'U'
161-
@inbounds return SM(tuple($(exprs_up...)))
162-
else
163-
@inbounds return SM(tuple($(exprs_lo...)))
164-
end
165-
end
128+
# full deprecated in Base
129+
if isdefined(Base, :full)
130+
import Base: full
131+
@deprecate full(sym::Symmetric{T,SM}) where {T,SM <: StaticMatrix} SMatrix(sym)
132+
@deprecate full(herm::Hermitian{T,SM}) where {T,SM <: StaticMatrix} SMatrix(sym)
166133
end

src/arraymath.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,9 @@ end
3838

3939
# Also consider randcycle, randperm? Also faster rand!(staticarray, collection)
4040

41-
@static if VERSION >= v"0.7.0-DEV.3406"
42-
using Random: SamplerType
43-
@inline rand(rng::AbstractRNG, ::Type{SA}, dims::Dims) where {SA <: StaticArray} = rand!(rng, Array{SA}(undef, dims), SA)
44-
@inline rand(rng::AbstractRNG, ::SamplerType{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
45-
else
46-
@inline rand(rng::AbstractRNG, ::Type{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
47-
end
41+
using Random: SamplerType
42+
@inline rand(rng::AbstractRNG, ::Type{SA}, dims::Dims) where {SA <: StaticArray} = rand!(rng, Array{SA}(undef, dims), SA)
43+
@inline rand(rng::AbstractRNG, ::SamplerType{SA}) where {SA <: StaticArray} = _rand(rng, Size(SA), SA)
4844

4945
@generated function _rand(rng::AbstractRNG, ::Size{s}, ::Type{SA}) where {s, SA <: StaticArray}
5046
T = eltype(SA)

0 commit comments

Comments
 (0)