diff --git a/base/exports.jl b/base/exports.jl index fddbf6dc52da95..80bd88cf6d90c4 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -664,7 +664,7 @@ export ishermitian, isposdef!, isposdef, - issym, + issymmetric, istril, istriu, kron, diff --git a/base/linalg.jl b/base/linalg.jl index d848f669053be1..0143b96b120cd1 100644 --- a/base/linalg.jl +++ b/base/linalg.jl @@ -82,7 +82,7 @@ export ishermitian, isposdef, isposdef!, - issym, + issymmetric, istril, istriu, kron, diff --git a/base/linalg/arnoldi.jl b/base/linalg/arnoldi.jl index 213128e35874c0..ca0fd1075cbf1b 100644 --- a/base/linalg/arnoldi.jl +++ b/base/linalg/arnoldi.jl @@ -154,7 +154,7 @@ function _eigs(A, B; T = eltype(A) iscmplx = T <: Complex isgeneral = B !== I - sym = issym(A) && !iscmplx + sym = issymmetric(A) && !iscmplx nevmax=sym ? n-1 : n-2 if nevmax <= 0 throw(ArgumentError("Input matrix A is too small. Use eigfact instead.")) @@ -297,7 +297,7 @@ end ## v = [ left_singular_vector; right_singular_vector ] *{T,S}(s::SVDOperator{T,S}, v::Vector{T}) = [s.X * v[s.m+1:end]; s.X' * v[1:s.m]] size(s::SVDOperator) = s.m + s.n, s.m + s.n -issym(s::SVDOperator) = true +issymmetric(s::SVDOperator) = true svds{T<:BlasFloat}(A::AbstractMatrix{T}; kwargs...) = _svds(A; kwargs...) svds(A::AbstractMatrix{BigFloat}; kwargs...) = throw(MethodError(svds, Any[A, kwargs...])) diff --git a/base/linalg/bitarray.jl b/base/linalg/bitarray.jl index eee50e259145b3..992f55f03231d9 100644 --- a/base/linalg/bitarray.jl +++ b/base/linalg/bitarray.jl @@ -134,8 +134,8 @@ end ## Structure query functions -issym(A::BitMatrix) = size(A, 1)==size(A, 2) && countnz(A - A.')==0 -ishermitian(A::BitMatrix) = issym(A) +issymmetric(A::BitMatrix) = size(A, 1)==size(A, 2) && countnz(A - A.')==0 +ishermitian(A::BitMatrix) = issymmetric(A) function nonzero_chunks(chunks::Vector{UInt64}, pos0::Int, pos1::Int) k0, l0 = Base.get_chunks_id(pos0) diff --git a/base/linalg/bunchkaufman.jl b/base/linalg/bunchkaufman.jl index cf5f76b0e18179..9f18af795604de 100644 --- a/base/linalg/bunchkaufman.jl +++ b/base/linalg/bunchkaufman.jl @@ -14,14 +14,14 @@ immutable BunchKaufman{T,S<:AbstractMatrix} <: Factorization{T} end BunchKaufman{T}(LD::AbstractMatrix{T}, ipiv::Vector{BlasInt}, uplo::Char, symmetric::Bool, rook::Bool) = BunchKaufman{T,typeof(LD)}(LD, ipiv, uplo, symmetric, rook) -function bkfact!{T<:BlasReal}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issym(A), rook::Bool=false) +function bkfact!{T<:BlasReal}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issymmetric(A), rook::Bool=false) if !symmetric throw(ArgumentError("Bunch-Kaufman decomposition is only valid for symmetric matrices")) end LD, ipiv = rook ? LAPACK.sytrf_rook!(char_uplo(uplo) , A) : LAPACK.sytrf!(char_uplo(uplo) , A) BunchKaufman(LD, ipiv, char_uplo(uplo), symmetric, rook) end -function bkfact!{T<:BlasComplex}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issym(A), rook::Bool=false) +function bkfact!{T<:BlasComplex}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issymmetric(A), rook::Bool=false) if rook LD, ipiv = (symmetric ? LAPACK.sytrf_rook! : LAPACK.hetrf_rook!)(char_uplo(uplo) , A) else @@ -29,15 +29,15 @@ function bkfact!{T<:BlasComplex}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric end BunchKaufman(LD, ipiv, char_uplo(uplo), symmetric, rook) end -bkfact{T<:BlasFloat}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issym(A), rook::Bool=false) = bkfact!(copy(A), uplo, symmetric, rook) -bkfact{T}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issym(A), rook::Bool=false) = bkfact!(convert(Matrix{promote_type(Float32,typeof(sqrt(one(T))))},A),uplo,symmetric,rook) +bkfact{T<:BlasFloat}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issymmetric(A), rook::Bool=false) = bkfact!(copy(A), uplo, symmetric, rook) +bkfact{T}(A::StridedMatrix{T}, uplo::Symbol=:U, symmetric::Bool=issymmetric(A), rook::Bool=false) = bkfact!(convert(Matrix{promote_type(Float32,typeof(sqrt(one(T))))},A),uplo,symmetric,rook) convert{T}(::Type{BunchKaufman{T}},B::BunchKaufman) = BunchKaufman(convert(Matrix{T},B.LD),B.ipiv,B.uplo,B.symmetric,B.rook) convert{T}(::Type{Factorization{T}}, B::BunchKaufman) = convert(BunchKaufman{T}, B) size(B::BunchKaufman) = size(B.LD) size(B::BunchKaufman,d::Integer) = size(B.LD,d) -issym(B::BunchKaufman) = B.symmetric +issymmetric(B::BunchKaufman) = B.symmetric ishermitian(B::BunchKaufman) = !B.symmetric function inv{T<:BlasReal}(B::BunchKaufman{T}) @@ -49,7 +49,7 @@ function inv{T<:BlasReal}(B::BunchKaufman{T}) end function inv{T<:BlasComplex}(B::BunchKaufman{T}) - if issym(B) + if issymmetric(B) if B.rook copytri!(LAPACK.sytri_rook!(B.uplo, copy(B.LD), B.ipiv), B.uplo) else @@ -73,9 +73,9 @@ function A_ldiv_B!{T<:BlasReal}(B::BunchKaufman{T}, R::StridedVecOrMat{T}) end function A_ldiv_B!{T<:BlasComplex}(B::BunchKaufman{T}, R::StridedVecOrMat{T}) if B.rook - (issym(B) ? LAPACK.sytrs_rook! : LAPACK.hetrs_rook!)(B.uplo, B.LD, B.ipiv, R) + (issymmetric(B) ? LAPACK.sytrs_rook! : LAPACK.hetrs_rook!)(B.uplo, B.LD, B.ipiv, R) else - (issym(B) ? LAPACK.sytrs! : LAPACK.hetrs!)(B.uplo, B.LD, B.ipiv, R) + (issymmetric(B) ? LAPACK.sytrs! : LAPACK.hetrs!)(B.uplo, B.LD, B.ipiv, R) end end @@ -94,9 +94,9 @@ function det(F::BunchKaufman) else # 2x2 pivot case. Make sure not to square before the subtraction by scaling with the off-diagonal element. This is safe because the off diagonal is always large for 2x2 pivots. if F.uplo == 'U' - d *= M[i, i + 1]*(M[i,i]/M[i, i + 1]*M[i + 1, i + 1] - (issym(F) ? M[i, i + 1] : conj(M[i, i + 1]))) + d *= M[i, i + 1]*(M[i,i]/M[i, i + 1]*M[i + 1, i + 1] - (issymmetric(F) ? M[i, i + 1] : conj(M[i, i + 1]))) else - d *= M[i + 1,i]*(M[i, i]/M[i + 1, i]*M[i + 1, i + 1] - (issym(F) ? M[i + 1, i] : conj(M[i + 1, i]))) + d *= M[i + 1,i]*(M[i, i]/M[i + 1, i]*M[i + 1, i + 1] - (issymmetric(F) ? M[i + 1, i] : conj(M[i + 1, i]))) end i += 2 end diff --git a/base/linalg/diagonal.jl b/base/linalg/diagonal.jl index d743fafcf426a4..d9d062adb4613a 100644 --- a/base/linalg/diagonal.jl +++ b/base/linalg/diagonal.jl @@ -68,7 +68,7 @@ parent(D::Diagonal) = D.diag ishermitian{T<:Real}(D::Diagonal{T}) = true ishermitian(D::Diagonal) = all(D.diag .== real(D.diag)) -issym(D::Diagonal) = true +issymmetric(D::Diagonal) = true isposdef(D::Diagonal) = all(D.diag .> 0) factorize(D::Diagonal) = D diff --git a/base/linalg/eigen.jl b/base/linalg/eigen.jl index b4d205260dab3a..1c16526567ed1b 100644 --- a/base/linalg/eigen.jl +++ b/base/linalg/eigen.jl @@ -28,7 +28,7 @@ isposdef(A::Union{Eigen,GeneralizedEigen}) = isreal(A.values) && all(A.values .> function eigfact!{T<:BlasReal}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true) n = size(A, 2) n==0 && return Eigen(zeros(T, 0), zeros(T, 0, 0)) - issym(A) && return eigfact!(Symmetric(A)) + issymmetric(A) && return eigfact!(Symmetric(A)) A, WR, WI, VL, VR, _ = LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'V', 'N', A) all(WI .== 0.) && return Eigen(WR, VR) evec = zeros(Complex{T}, n, n) @@ -81,7 +81,7 @@ eigvals{T,V,S,U}(F::Union{Eigen{T,V,S,U}, GeneralizedEigen{T,V,S,U}}) = F[:value Same as `eigvals`, but saves space by overwriting the input `A` (and `B`), instead of creating a copy. """ function eigvals!{T<:BlasReal}(A::StridedMatrix{T}; permute::Bool=true, scale::Bool=true) - issym(A) && return eigvals!(Symmetric(A)) + issymmetric(A) && return eigvals!(Symmetric(A)) _, valsre, valsim, _ = LAPACK.geevx!(permute ? (scale ? 'B' : 'P') : (scale ? 'S' : 'N'), 'N', 'N', 'N', A) return all(valsim .== 0) ? valsre : complex(valsre, valsim) end @@ -120,7 +120,7 @@ det(A::Eigen) = prod(A.values) # Generalized eigenproblem function eigfact!{T<:BlasReal}(A::StridedMatrix{T}, B::StridedMatrix{T}) - issym(A) && isposdef(B) && return eigfact!(Symmetric(A), Symmetric(B)) + issymmetric(A) && isposdef(B) && return eigfact!(Symmetric(A), Symmetric(B)) n = size(A, 1) alphar, alphai, beta, _, vr = LAPACK.ggev!('N', 'V', A, B) all(alphai .== 0) && return GeneralizedEigen(alphar ./ beta, vr) @@ -160,7 +160,7 @@ function eig(A::Number, B::Number) end function eigvals!{T<:BlasReal}(A::StridedMatrix{T}, B::StridedMatrix{T}) - issym(A) && isposdef(B) && return eigvals!(Symmetric(A), Symmetric(B)) + issymmetric(A) && isposdef(B) && return eigvals!(Symmetric(A), Symmetric(B)) alphar, alphai, beta, vl, vr = LAPACK.ggev!('N', 'N', A, B) return (all(alphai .== 0) ? alphar : complex(alphar, alphai))./beta end diff --git a/base/linalg/generic.jl b/base/linalg/generic.jl index 6b1f68d730e17d..ae0d89e3ac61f0 100644 --- a/base/linalg/generic.jl +++ b/base/linalg/generic.jl @@ -382,7 +382,7 @@ condskeel{T<:Integer}(A::AbstractMatrix{T}, p::Real=Inf) = norm(abs(inv(float(A) condskeel(A::AbstractMatrix, x::AbstractVector, p::Real=Inf) = norm(abs(inv(A))*abs(A)*abs(x), p) condskeel{T<:Integer}(A::AbstractMatrix{T}, x::AbstractVector, p::Real=Inf) = norm(abs(inv(float(A)))*abs(A)*abs(x), p) -function issym(A::AbstractMatrix) +function issymmetric(A::AbstractMatrix) m, n = size(A) if m != n return false @@ -395,7 +395,7 @@ function issym(A::AbstractMatrix) return true end -issym(x::Number) = true +issymmetric(x::Number) = true function ishermitian(A::AbstractMatrix) m, n = size(A) diff --git a/base/linalg/symmetric.jl b/base/linalg/symmetric.jl index 7b865215d5a618..7a91fbda729936 100644 --- a/base/linalg/symmetric.jl +++ b/base/linalg/symmetric.jl @@ -47,9 +47,9 @@ copy{T,S}(A::Hermitian{T,S}) = Hermitian{T,S}(copy(A.data),A.uplo) ishermitian(A::Hermitian) = true ishermitian{T<:Real,S}(A::Symmetric{T,S}) = true ishermitian{T<:Complex,S}(A::Symmetric{T,S}) = all(imag(A.data) .== 0) -issym{T<:Real,S}(A::Hermitian{T,S}) = true -issym{T<:Complex,S}(A::Hermitian{T,S}) = all(imag(A.data) .== 0) -issym(A::Symmetric) = true +issymmetric{T<:Real,S}(A::Hermitian{T,S}) = true +issymmetric{T<:Complex,S}(A::Hermitian{T,S}) = all(imag(A.data) .== 0) +issymmetric(A::Symmetric) = true transpose(A::Symmetric) = A ctranspose{T<:Real}(A::Symmetric{T}) = A function ctranspose(A::Symmetric) @@ -126,7 +126,7 @@ A_mul_B!{T<:BlasComplex,S<:StridedMatrix}(C::StridedMatrix{T}, A::StridedMatrix{ *(A::HermOrSym, B::HermOrSym) = full(A)*full(B) *(A::StridedMatrix, B::HermOrSym) = A*full(B) -bkfact(A::HermOrSym) = bkfact(A.data, symbol(A.uplo), issym(A)) +bkfact(A::HermOrSym) = bkfact(A.data, symbol(A.uplo), issymmetric(A)) factorize(A::HermOrSym) = bkfact(A) # Is just RealHermSymComplexHerm, but type alias seems to be broken @@ -134,7 +134,7 @@ det{T<:Real,S}(A::Union{Hermitian{T,S}, Symmetric{T,S}, Hermitian{Complex{T},S}} det{T<:Real}(A::Symmetric{T}) = det(bkfact(A)) det(A::Symmetric) = det(bkfact(A)) -\{T,S<:StridedMatrix}(A::HermOrSym{T,S}, B::StridedVecOrMat) = \(bkfact(A.data, symbol(A.uplo), issym(A)), B) +\{T,S<:StridedMatrix}(A::HermOrSym{T,S}, B::StridedVecOrMat) = \(bkfact(A.data, symbol(A.uplo), issymmetric(A)), B) inv{T<:BlasFloat,S<:StridedMatrix}(A::Hermitian{T,S}) = Hermitian{T,S}(inv(bkfact(A.data, symbol(A.uplo))), A.uplo) inv{T<:BlasFloat,S<:StridedMatrix}(A::Symmetric{T,S}) = Symmetric{T,S}(inv(bkfact(A.data, symbol(A.uplo), true)), A.uplo) diff --git a/base/sparse.jl b/base/sparse.jl index d45eb0004a3e7a..5fe8b94c7c2109 100644 --- a/base/sparse.jl +++ b/base/sparse.jl @@ -13,10 +13,10 @@ import Base.LinAlg: At_ldiv_B!, Ac_ldiv_B! import Base: @get!, acos, acosd, acot, acotd, acsch, asech, asin, asind, asinh, atan, atand, atanh, broadcast!, chol, conj!, cos, cosc, cosd, cosh, cospi, cot, cotd, coth, countnz, csc, cscd, csch, ctranspose!, diag, diff, done, dot, eig, - exp10, exp2, eye, findn, floor, hash, indmin, inv, issym, istril, istriu, log10, - log2, lu, maxabs, minabs, next, sec, secd, sech, show, showarray, sin, sinc, - sind, sinh, sinpi, squeeze, start, sum, sumabs, sumabs2, summary, tan, tand, - tanh, trace, transpose!, tril!, triu!, trunc, vecnorm, writemime, abs, abs2, + exp10, exp2, eye, findn, floor, hash, indmin, inv, issymmetric, istril, istriu, + log10, log2, lu, maxabs, minabs, next, sec, secd, sech, show, showarray, sin, + sinc, sind, sinh, sinpi, squeeze, start, sum, sumabs, sumabs2, summary, tan, + tand, tanh, trace, transpose!, tril!, triu!, trunc, vecnorm, writemime, abs, abs2, broadcast, ceil, complex, cond, conj, convert, copy, copy!, ctranspose, diagm, exp, expm1, factorize, find, findmax, findmin, findnz, float, full, getindex, hcat, hvcat, imag, indmax, ishermitian, kron, length, log, log1p, max, min, diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index ee49a388fbbbc6..8388c351d866c8 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -7,7 +7,7 @@ import Base: (*), convert, copy, eltype, get, getindex, show, showarray, size, import Base.LinAlg: (\), A_mul_Bc, A_mul_Bt, Ac_ldiv_B, Ac_mul_B, At_ldiv_B, At_mul_B, cholfact, cholfact!, det, diag, ishermitian, isposdef, - issym, ldltfact, ldltfact!, logdet + issymmetric, ldltfact, ldltfact!, logdet importall ..SparseArrays @@ -986,7 +986,7 @@ function convert{Tv}(::Type{SparseMatrixCSC{Tv,SuiteSparse_long}}, A::Sparse{Tv} end function convert(::Type{Symmetric{Float64,SparseMatrixCSC{Float64,SuiteSparse_long}}}, A::Sparse{Float64}) s = unsafe_load(A.p) - if !issym(A) + if !issymmetric(A) throw(ArgumentError("matrix is not symmetric")) end return Symmetric(SparseMatrixCSC(s.nrow, s.ncol, increment(pointer_to_array(s.p, (s.ncol + 1,), false)), increment(pointer_to_array(s.i, (s.nzmax,), false)), copy(pointer_to_array(s.x, (s.nzmax,), false))), s.stype > 0 ? :U : :L) @@ -1536,7 +1536,7 @@ function isposdef{Tv<:VTypes}(A::SparseMatrixCSC{Tv,SuiteSparse_long}) true end -function issym(A::Sparse) +function issymmetric(A::Sparse) s = unsafe_load(A.p) if s.stype != 0 return isreal(A) diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 21fab807e582d0..83294c7a0b503c 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -2608,7 +2608,7 @@ end squeeze(S::SparseMatrixCSC, dims::Dims) = throw(ArgumentError("squeeze is not available for sparse matrices")) ## Structure query functions -issym(A::SparseMatrixCSC) = is_hermsym(A, IdFun()) +issymmetric(A::SparseMatrixCSC) = is_hermsym(A, IdFun()) ishermitian(A::SparseMatrixCSC) = is_hermsym(A, ConjFun()) diff --git a/test/arrayops.jl b/test/arrayops.jl index 47593953bf6942..edff1668b653de 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -964,7 +964,7 @@ end # Handle block matrices A = [randn(2,2) for i = 1:2, j = 1:2] -@test issym(A.'A) +@test issymmetric(A.'A) A = [complex(randn(2,2), randn(2,2)) for i = 1:2, j = 1:2] @test ishermitian(A'A) diff --git a/test/bitarray.jl b/test/bitarray.jl index de2f715db8f729..d57ec2b7fc2216 100644 --- a/test/bitarray.jl +++ b/test/bitarray.jl @@ -1201,7 +1201,7 @@ b1 = triu(bitrand(n2, n1)) b1 = bitrand(n1,n1) b1 |= b1.' -@check_bit_operation issym(b1) Bool +@check_bit_operation issymmetric(b1) Bool @check_bit_operation ishermitian(b1) Bool b1 = bitrand(n1) diff --git a/test/blas.jl b/test/blas.jl index 2bf10b1b3d8749..8b7d0d1680c3ed 100644 --- a/test/blas.jl +++ b/test/blas.jl @@ -132,7 +132,7 @@ for elty in [Float32, Float64, Complex64, Complex128] A = rand(elty,n,n) A = A + A.' - @test issym(A) + @test issymmetric(A) @test_approx_eq triu(BLAS.syr!('U',α,x,copy(A))) triu(A + α*x*x.') @test_throws DimensionMismatch BLAS.syr!('U',α,ones(elty,n+1),copy(A)) diff --git a/test/linalg/arnoldi.jl b/test/linalg/arnoldi.jl index 89382dbb52e4c3..4ce632206cc479 100644 --- a/test/linalg/arnoldi.jl +++ b/test/linalg/arnoldi.jl @@ -102,13 +102,13 @@ let A6965 = [ end # Example from Quantum Information Theory -import Base: size, issym, ishermitian +import Base: size, issymmetric, ishermitian type CPM{T<:Base.LinAlg.BlasFloat}<:AbstractMatrix{T} # completely positive map kraus::Array{T,3} # kraus operator representation end size(Phi::CPM)=(size(Phi.kraus,1)^2,size(Phi.kraus,3)^2) -issym(Phi::CPM)=false +issymmetric(Phi::CPM)=false ishermitian(Phi::CPM)=false import Base: * function *{T<:Base.LinAlg.BlasFloat}(Phi::CPM{T},rho::Vector{T}) diff --git a/test/linalg/bunchkaufman.jl b/test/linalg/bunchkaufman.jl index 2f94166ca10684..715b280e9d73c4 100644 --- a/test/linalg/bunchkaufman.jl +++ b/test/linalg/bunchkaufman.jl @@ -49,10 +49,10 @@ debug && println("(Automatic) Bunch-Kaufman factor of indefinite matrix") end debug && println("Bunch-Kaufman factors of a pos-def matrix") for rook in (false, true) - bc2 = bkfact(apd, :U, issym(apd), rook) + bc2 = bkfact(apd, :U, issymmetric(apd), rook) @test_approx_eq inv(bc2) * apd eye(n) @test_approx_eq_eps apd * (bc2\b) b 150000ε - @test ishermitian(bc2) == !issym(bc2) + @test ishermitian(bc2) == !issymmetric(bc2) end end diff --git a/test/linalg/diagonal.jl b/test/linalg/diagonal.jl index dff1123b1b7146..ca50a82db2d386 100644 --- a/test/linalg/diagonal.jl +++ b/test/linalg/diagonal.jl @@ -162,12 +162,12 @@ for relty in (Float32, Float64, BigFloat), elty in (relty, Complex{relty}) @test length(diag(similar(D, eltype(D), (n,n)))) == n #10036 - @test issym(D2) + @test issymmetric(D2) @test ishermitian(D2) if elty <: Complex dc = d + im*convert(Vector{elty}, ones(n)) D3 = Diagonal(dc) - @test issym(D3) + @test issymmetric(D3) @test !ishermitian(D3) end diff --git a/test/linalg/generic.jl b/test/linalg/generic.jl index 5f4bcb3d84c298..3b33f222d77250 100644 --- a/test/linalg/generic.jl +++ b/test/linalg/generic.jl @@ -89,7 +89,7 @@ y = ['a','b','c','d','e'] @test_throws DimensionMismatch Base.LinAlg.axpy!(α,x,collect(1:2),['a','b'],collect(1:2)) @test_throws ArgumentError diag(rand(10)) -@test !issym(ones(5,3)) +@test !issymmetric(ones(5,3)) @test !ishermitian(ones(5,3)) @test cross(ones(3),ones(3)) == zeros(3) @@ -193,7 +193,7 @@ for elty in [Float32,Float64,Complex64,Complex128] @test !isfinite(cond(zero(elty))) @test cond(a) == one(elty) @test cond(a,1) == one(elty) - @test issym(a) + @test issymmetric(a) @test ishermitian(one(elty)) @test det(a) == a end diff --git a/test/linalg/symmetric.jl b/test/linalg/symmetric.jl index e47e2fd9ca535f..749d774c986733 100644 --- a/test/linalg/symmetric.jl +++ b/test/linalg/symmetric.jl @@ -52,9 +52,9 @@ let n=10 #trace @test trace(asym) == trace(Hermitian(asym)) - # issym, ishermitian + # issymmetric, ishermitian if eltya <: Real - @test issym(Symmetric(asym)) + @test issymmetric(Symmetric(asym)) @test ishermitian(Symmetric(asym)) end if eltya <: Complex diff --git a/test/sparsedir/cholmod.jl b/test/sparsedir/cholmod.jl index 494bfe0d81d229..bc21d912b75914 100644 --- a/test/sparsedir/cholmod.jl +++ b/test/sparsedir/cholmod.jl @@ -182,10 +182,10 @@ end @test eltype(A) == Float64 @test eltype(chma) == Float64 -# test Sparse constructor Symmetric and Hermitian input (and issym and ishermitian) +# test Sparse constructor Symmetric and Hermitian input (and issymmetric and ishermitian) ACSC = sprandn(10, 10, 0.3) + I -@test issym(Sparse(Symmetric(ACSC, :L))) -@test issym(Sparse(Symmetric(ACSC, :U))) +@test issymmetric(Sparse(Symmetric(ACSC, :L))) +@test issymmetric(Sparse(Symmetric(ACSC, :U))) @test ishermitian(Sparse(Hermitian(complex(ACSC), :L))) @test ishermitian(Sparse(Hermitian(complex(ACSC), :U))) @@ -387,7 +387,7 @@ for elty in (Float64, Complex{Float64}) @test !isposdef(A1 + A1' |> t -> t - 2eigmax(full(t))*I) if elty <: Real - @test CHOLMOD.issym(Sparse(A1pd, 0)) + @test CHOLMOD.issymmetric(Sparse(A1pd, 0)) @test CHOLMOD.Sparse(cholfact(Symmetric(A1pd, :L))) == CHOLMOD.Sparse(cholfact(A1pd)) F1 = CHOLMOD.Sparse(cholfact(Symmetric(A1pd, :L), shift=2)) F2 = CHOLMOD.Sparse(cholfact(A1pd, shift=2)) @@ -397,7 +397,7 @@ for elty in (Float64, Complex{Float64}) F2 = CHOLMOD.Sparse(ldltfact(A1pd, shift=2)) @test F1 == F2 else - @test !CHOLMOD.issym(Sparse(A1pd, 0)) + @test !CHOLMOD.issymmetric(Sparse(A1pd, 0)) @test CHOLMOD.ishermitian(Sparse(A1pd, 0)) @test CHOLMOD.Sparse(cholfact(Hermitian(A1pd, :L))) == CHOLMOD.Sparse(cholfact(A1pd)) F1 = CHOLMOD.Sparse(cholfact(Hermitian(A1pd, :L), shift=2)) diff --git a/test/sparsedir/sparse.jl b/test/sparsedir/sparse.jl index acf1df68adbfb9..e3cca85c692d55 100644 --- a/test/sparsedir/sparse.jl +++ b/test/sparsedir/sparse.jl @@ -1010,43 +1010,43 @@ A = sparse([1.0]) @test_throws ArgumentError norm(sprand(5,5,0.2),3) @test_throws ArgumentError norm(sprand(5,5,0.2),2) -# test ishermitian and issym real matrices +# test ishermitian and issymmetric real matrices A = speye(5,5) @test ishermitian(A) == true -@test issym(A) == true +@test issymmetric(A) == true A[1,3] = 1.0 @test ishermitian(A) == false -@test issym(A) == false +@test issymmetric(A) == false A[3,1] = 1.0 @test ishermitian(A) == true -@test issym(A) == true +@test issymmetric(A) == true -# test ishermitian and issym complex matrices +# test ishermitian and issymmetric complex matrices A = speye(5,5) + im*speye(5,5) @test ishermitian(A) == false -@test issym(A) == true +@test issymmetric(A) == true A[1,4] = 1.0 + im @test ishermitian(A) == false -@test issym(A) == false +@test issymmetric(A) == false A = speye(Complex128, 5,5) A[3,2] = 1.0 + im @test ishermitian(A) == false -@test issym(A) == false +@test issymmetric(A) == false A[2,3] = 1.0 - im @test ishermitian(A) == true -@test issym(A) == false +@test issymmetric(A) == false A = sparse(zeros(5,5)) @test ishermitian(A) == true -@test issym(A) == true +@test issymmetric(A) == true # Test with explicit zeros A = speye(Complex128, 5,5) A[3,1] = 2 A.nzval[2] = 0.0 @test ishermitian(A) == true -@test issym(A) == true +@test issymmetric(A) == true # equality == A1 = speye(10)