diff --git a/NEWS.md b/NEWS.md index 56ab9c8aaf929..3d8d2927676a4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -318,6 +318,9 @@ Deprecated or removed * `Base.cpad` has been removed; use an appropriate combination of `rpad` and `lpad` instead ([#23187]). + * `ctranspose` and `ctranspose!` have been deprecated in favor of `adjoint` and `adjoint!`, + respectively ([#23235]). + * `filter` and `filter!` on dictionaries now pass a single `key=>value` pair to the argument function, instead of two arguments ([#17886]). diff --git a/base/deprecated.jl b/base/deprecated.jl index 926ce2f4b3b79..ce59333032c4c 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1421,7 +1421,7 @@ end module Operators for op in [:!, :(!=), :(!==), :%, :&, :*, :+, :-, :/, ://, :<, :<:, :<<, :(<=), :<|, :(==), :(===), :>, :>:, :(>=), :>>, :>>>, :\, :^, :colon, - :ctranspose, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat, + :adjoint, :getindex, :hcat, :hvcat, :setindex!, :transpose, :vcat, :xor, :|, :|>, :~, :×, :÷, :∈, :∉, :∋, :∌, :∘, :√, :∛, :∩, :∪, :≠, :≤, :≥, :⊆, :⊈, :⊊, :⊻, :⋅] if isdefined(Base, op) @@ -1692,6 +1692,10 @@ export hex2num # PR #22742: change in isapprox semantics @deprecate rtoldefault(x,y) rtoldefault(x,y,0) false +# PR #23235 +@deprecate ctranspose adjoint +@deprecate ctranspose! adjoint! + # issue #5148, PR #23259 # warning for `const` on locals should be changed to an error in julia-syntax.scm diff --git a/base/exports.jl b/base/exports.jl index 8a086f914ca3a..49d3ceb5d3568 100644 --- a/base/exports.jl +++ b/base/exports.jl @@ -555,8 +555,8 @@ export cond, condskeel, cross, - ctranspose!, - ctranspose, + adjoint!, + adjoint, det, diag, diagind, diff --git a/base/linalg/bidiag.jl b/base/linalg/bidiag.jl index cce36f22dbb76..9e3d08ceef2ad 100644 --- a/base/linalg/bidiag.jl +++ b/base/linalg/bidiag.jl @@ -223,7 +223,7 @@ broadcast(::typeof(floor), ::Type{T}, M::Bidiagonal) where {T<:Integer} = Bidiag broadcast(::typeof(ceil), ::Type{T}, M::Bidiagonal) where {T<:Integer} = Bidiagonal(ceil.(T, M.dv), ceil.(T, M.ev), M.uplo) transpose(M::Bidiagonal) = Bidiagonal(M.dv, M.ev, M.uplo == 'U' ? :L : :U) -ctranspose(M::Bidiagonal) = Bidiagonal(conj(M.dv), conj(M.ev), M.uplo == 'U' ? :L : :U) +adjoint(M::Bidiagonal) = Bidiagonal(conj(M.dv), conj(M.ev), M.uplo == 'U' ? :L : :U) istriu(M::Bidiagonal) = M.uplo == 'U' || iszero(M.ev) istril(M::Bidiagonal) = M.uplo == 'L' || iszero(M.ev) @@ -458,7 +458,7 @@ end #Linear solvers A_ldiv_B!(A::Union{Bidiagonal, AbstractTriangular}, b::AbstractVector) = naivesub!(A, b) At_ldiv_B!(A::Bidiagonal, b::AbstractVector) = A_ldiv_B!(transpose(A), b) -Ac_ldiv_B!(A::Bidiagonal, b::AbstractVector) = A_ldiv_B!(ctranspose(A), b) +Ac_ldiv_B!(A::Bidiagonal, b::AbstractVector) = A_ldiv_B!(adjoint(A), b) function A_ldiv_B!(A::Union{Bidiagonal,AbstractTriangular}, B::AbstractMatrix) nA,mA = size(A) tmp = similar(B,size(B,1)) diff --git a/base/linalg/bitarray.jl b/base/linalg/bitarray.jl index b591b94d0e358..4df257bfa75a6 100644 --- a/base/linalg/bitarray.jl +++ b/base/linalg/bitarray.jl @@ -295,4 +295,4 @@ function transpose(B::BitMatrix) return Bt end -ctranspose(B::Union{BitMatrix,BitVector}) = transpose(B) +adjoint(B::Union{BitMatrix,BitVector}) = transpose(B) diff --git a/base/linalg/cholesky.jl b/base/linalg/cholesky.jl index fe3bb861f5a58..8ada08741687d 100644 --- a/base/linalg/cholesky.jl +++ b/base/linalg/cholesky.jl @@ -150,7 +150,7 @@ function chol(A::RealHermSymComplexHerm) if A.uplo == 'U' copy!(AA, A.data) else - Base.ctranspose!(AA, A.data) + Base.adjoint!(AA, A.data) end chol!(Hermitian(AA, :U)) end diff --git a/base/linalg/conjarray.jl b/base/linalg/conjarray.jl index 0cd982761157b..c43bc0436b0b1 100644 --- a/base/linalg/conjarray.jl +++ b/base/linalg/conjarray.jl @@ -5,7 +5,7 @@ A lazy-view wrapper of an `AbstractArray`, taking the elementwise complex conjugate. This type is usually constructed (and unwrapped) via the [`conj`](@ref) function (or related -[`ctranspose`](@ref)), but currently this is the default behavior for `RowVector` only. For +[`adjoint`](@ref)), but currently this is the default behavior for `RowVector` only. For other arrays, the `ConjArray` constructor can be used directly. # Examples diff --git a/base/linalg/diagonal.jl b/base/linalg/diagonal.jl index 439e409958c52..3b0cd7d58a2f1 100644 --- a/base/linalg/diagonal.jl +++ b/base/linalg/diagonal.jl @@ -186,11 +186,11 @@ function A_mul_B!(D::Diagonal, B::UnitUpperTriangular) UpperTriangular(B.data) end -Ac_mul_B(D::Diagonal, B::Diagonal) = Diagonal(ctranspose.(D.diag) .* B.diag) -Ac_mul_B(A::AbstractTriangular, D::Diagonal) = A_mul_B!(ctranspose(A), D) +Ac_mul_B(D::Diagonal, B::Diagonal) = Diagonal(adjoint.(D.diag) .* B.diag) +Ac_mul_B(A::AbstractTriangular, D::Diagonal) = A_mul_B!(adjoint(A), D) function Ac_mul_B(A::AbstractMatrix, D::Diagonal) Ac = similar(A, promote_op(*, eltype(A), eltype(D.diag)), (size(A, 2), size(A, 1))) - ctranspose!(Ac, A) + adjoint!(Ac, A) A_mul_B!(Ac, D) end @@ -202,12 +202,12 @@ function At_mul_B(A::AbstractMatrix, D::Diagonal) A_mul_B!(At, D) end -A_mul_Bc(D::Diagonal, B::Diagonal) = Diagonal(D.diag .* ctranspose.(B.diag)) -A_mul_Bc(D::Diagonal, B::AbstractTriangular) = A_mul_B!(D, ctranspose(B)) +A_mul_Bc(D::Diagonal, B::Diagonal) = Diagonal(D.diag .* adjoint.(B.diag)) +A_mul_Bc(D::Diagonal, B::AbstractTriangular) = A_mul_B!(D, adjoint(B)) A_mul_Bc(D::Diagonal, Q::Union{Base.LinAlg.QRCompactWYQ,Base.LinAlg.QRPackedQ}) = A_mul_Bc!(Array(D), Q) function A_mul_Bc(D::Diagonal, A::AbstractMatrix) Ac = similar(A, promote_op(*, eltype(A), eltype(D.diag)), (size(A, 2), size(A, 1))) - ctranspose!(Ac, A) + adjoint!(Ac, A) A_mul_B!(D, Ac) end @@ -219,7 +219,7 @@ function A_mul_Bt(D::Diagonal, A::AbstractMatrix) A_mul_B!(D, At) end -Ac_mul_Bc(D::Diagonal, B::Diagonal) = Diagonal(ctranspose.(D.diag) .* ctranspose.(B.diag)) +Ac_mul_Bc(D::Diagonal, B::Diagonal) = Diagonal(adjoint.(D.diag) .* adjoint.(B.diag)) At_mul_Bt(D::Diagonal, B::Diagonal) = Diagonal(transpose.(D.diag) .* transpose.(B.diag)) A_mul_B!(A::Diagonal,B::Diagonal) = throw(MethodError(A_mul_B!, Tuple{Diagonal,Diagonal})) @@ -235,11 +235,11 @@ A_mul_Bc!(A::AbstractMatrix,B::Diagonal) = scale!(A,conj(B.diag)) # Get ambiguous method if try to unify AbstractVector/AbstractMatrix here using AbstractVecOrMat A_mul_B!(out::AbstractVector, A::Diagonal, in::AbstractVector) = out .= A.diag .* in -Ac_mul_B!(out::AbstractVector, A::Diagonal, in::AbstractVector) = out .= ctranspose.(A.diag) .* in +Ac_mul_B!(out::AbstractVector, A::Diagonal, in::AbstractVector) = out .= adjoint.(A.diag) .* in At_mul_B!(out::AbstractVector, A::Diagonal, in::AbstractVector) = out .= transpose.(A.diag) .* in A_mul_B!(out::AbstractMatrix, A::Diagonal, in::AbstractMatrix) = out .= A.diag .* in -Ac_mul_B!(out::AbstractMatrix, A::Diagonal, in::AbstractMatrix) = out .= ctranspose.(A.diag) .* in +Ac_mul_B!(out::AbstractMatrix, A::Diagonal, in::AbstractMatrix) = out .= adjoint.(A.diag) .* in At_mul_B!(out::AbstractMatrix, A::Diagonal, in::AbstractMatrix) = out .= transpose.(A.diag) .* in # ambiguities with Symmetric/Hermitian @@ -306,13 +306,13 @@ A_rdiv_Bt!(A::AbstractMatrix{T}, D::Diagonal{T}) where {T} = A_rdiv_B!(A, D) # Methods to resolve ambiguities with `Diagonal` @inline *(rowvec::RowVector, D::Diagonal) = transpose(D * transpose(rowvec)) @inline A_mul_Bt(D::Diagonal, rowvec::RowVector) = D*transpose(rowvec) -@inline A_mul_Bc(D::Diagonal, rowvec::RowVector) = D*ctranspose(rowvec) +@inline A_mul_Bc(D::Diagonal, rowvec::RowVector) = D*adjoint(rowvec) conj(D::Diagonal) = Diagonal(conj(D.diag)) transpose(D::Diagonal{<:Number}) = D transpose(D::Diagonal) = Diagonal(transpose.(D.diag)) -ctranspose(D::Diagonal{<:Number}) = conj(D) -ctranspose(D::Diagonal) = Diagonal(ctranspose.(D.diag)) +adjoint(D::Diagonal{<:Number}) = conj(D) +adjoint(D::Diagonal) = Diagonal(adjoint.(D.diag)) diag(D::Diagonal) = D.diag trace(D::Diagonal) = sum(D.diag) diff --git a/base/linalg/factorization.jl b/base/linalg/factorization.jl index e3b10d258857c..581f711657398 100644 --- a/base/linalg/factorization.jl +++ b/base/linalg/factorization.jl @@ -6,7 +6,7 @@ abstract type Factorization{T} end eltype(::Type{Factorization{T}}) where {T} = T transpose(F::Factorization) = error("transpose not implemented for $(typeof(F))") -ctranspose(F::Factorization) = error("ctranspose not implemented for $(typeof(F))") +adjoint(F::Factorization) = error("adjoint not implemented for $(typeof(F))") macro assertposdef(A, info) :($(esc(info)) == 0 ? $(esc(A)) : throw(PosDefException($(esc(info))))) diff --git a/base/linalg/generic.jl b/base/linalg/generic.jl index 8c69ebe1548b6..b08354ca30ecd 100644 --- a/base/linalg/generic.jl +++ b/base/linalg/generic.jl @@ -942,7 +942,7 @@ function ishermitian(A::AbstractMatrix) return false end for i = indsn, j = i:last(indsn) - if A[i,j] != ctranspose(A[j,i]) + if A[i,j] != adjoint(A[j,i]) return false end end diff --git a/base/linalg/givens.jl b/base/linalg/givens.jl index d822499d94c43..de621983494d4 100644 --- a/base/linalg/givens.jl +++ b/base/linalg/givens.jl @@ -41,8 +41,8 @@ convert(::Type{Rotation{T}}, R::Rotation) where {T} = Rotation{T}([convert(Given convert(::Type{AbstractRotation{T}}, G::Givens) where {T} = convert(Givens{T}, G) convert(::Type{AbstractRotation{T}}, R::Rotation) where {T} = convert(Rotation{T}, R) -ctranspose(G::Givens) = Givens(G.i1, G.i2, conj(G.c), -G.s) -ctranspose(R::Rotation{T}) where {T} = Rotation{T}(reverse!([ctranspose(r) for r in R.rotations])) +adjoint(G::Givens) = Givens(G.i1, G.i2, conj(G.c), -G.s) +adjoint(R::Rotation{T}) where {T} = Rotation{T}(reverse!([adjoint(r) for r in R.rotations])) realmin2(::Type{Float32}) = reinterpret(Float32, 0x26000000) realmin2(::Type{Float64}) = reinterpret(Float64, 0x21a0000000000000) diff --git a/base/linalg/linalg.jl b/base/linalg/linalg.jl index a510f0efc8b51..52228e1910d60 100644 --- a/base/linalg/linalg.jl +++ b/base/linalg/linalg.jl @@ -6,7 +6,7 @@ import Base: \, /, *, ^, +, -, == import Base: A_mul_Bt, At_ldiv_Bt, A_rdiv_Bc, At_ldiv_B, Ac_mul_Bc, A_mul_Bc, Ac_mul_B, Ac_ldiv_B, Ac_ldiv_Bc, At_mul_Bt, A_rdiv_Bt, At_mul_B import Base: USE_BLAS64, abs, big, broadcast, ceil, conj, convert, copy, copy!, - ctranspose, eltype, eye, findmax, findmin, fill!, floor, full, getindex, + adjoint, eltype, eye, findmax, findmin, fill!, floor, full, getindex, hcat, imag, indices, inv, isapprox, isone, IndexStyle, kron, length, map, ndims, oneunit, parent, power_by_squaring, print_matrix, promote_rule, real, round, setindex!, show, similar, size, transpose, trunc, typed_hcat @@ -63,8 +63,8 @@ export copy!, copy_transpose!, cross, - ctranspose, - ctranspose!, + adjoint, + adjoint!, det, diag, diagind, diff --git a/base/linalg/lq.jl b/base/linalg/lq.jl index b6b43289385fb..3c535433e6cf5 100644 --- a/base/linalg/lq.jl +++ b/base/linalg/lq.jl @@ -56,7 +56,7 @@ convert(::Type{Matrix}, A::LQ) = convert(Array, convert(AbstractArray, A)) convert(::Type{Array}, A::LQ) = convert(Matrix, A) full(A::LQ) = convert(AbstractArray, A) -ctranspose(A::LQ{T}) where {T} = QR{T,typeof(A.factors)}(A.factors', A.τ) +adjoint(A::LQ{T}) where {T} = QR{T,typeof(A.factors)}(A.factors', A.τ) function getindex(A::LQ, d::Symbol) m, n = size(A) @@ -164,7 +164,7 @@ for (f1, f2) in ((:A_mul_Bc, :A_mul_B!), function ($f1)(A::LQPackedQ, B::StridedVecOrMat) TAB = promote_type(eltype(A), eltype(B)) BB = similar(B, TAB, (size(B, 2), size(B, 1))) - ctranspose!(BB, B) + adjoint!(BB, B) return ($f2)(A, BB) end end @@ -198,7 +198,7 @@ for (f1, f2) in ((:Ac_mul_B, :A_mul_B!), function ($f1)(A::StridedMatrix, B::LQPackedQ) TAB = promote_type(eltype(A), eltype(B)) AA = similar(A, TAB, (size(A, 2), size(A, 1))) - ctranspose!(AA, A) + adjoint!(AA, A) return ($f2)(AA, B) end end diff --git a/base/linalg/lu.jl b/base/linalg/lu.jl index fcab79e899e68..8e6630a00bd41 100644 --- a/base/linalg/lu.jl +++ b/base/linalg/lu.jl @@ -275,8 +275,8 @@ At_ldiv_Bt(A::LU{T,<:StridedMatrix}, B::StridedVecOrMat{T}) where {T<:BlasFloat} At_ldiv_Bt(A::LU, B::StridedVecOrMat) = At_ldiv_B(A, transpose(B)) Ac_ldiv_Bc(A::LU{T,<:StridedMatrix}, B::StridedVecOrMat{T}) where {T<:BlasComplex} = - @assertnonsingular LAPACK.getrs!('C', A.factors, A.ipiv, ctranspose(B)) A.info -Ac_ldiv_Bc(A::LU, B::StridedVecOrMat) = Ac_ldiv_B(A, ctranspose(B)) + @assertnonsingular LAPACK.getrs!('C', A.factors, A.ipiv, adjoint(B)) A.info +Ac_ldiv_Bc(A::LU, B::StridedVecOrMat) = Ac_ldiv_B(A, adjoint(B)) function det(F::LU{T}) where T n = checksquare(F) diff --git a/base/linalg/matmul.jl b/base/linalg/matmul.jl index 6112d29be3b54..7badc4be6176b 100644 --- a/base/linalg/matmul.jl +++ b/base/linalg/matmul.jl @@ -663,14 +663,14 @@ function matmul2x2!(C::AbstractMatrix, tA, tB, A::AbstractMatrix, B::AbstractMat if tA == 'T' A11 = transpose(A[1,1]); A12 = transpose(A[2,1]); A21 = transpose(A[1,2]); A22 = transpose(A[2,2]) elseif tA == 'C' - A11 = ctranspose(A[1,1]); A12 = ctranspose(A[2,1]); A21 = ctranspose(A[1,2]); A22 = ctranspose(A[2,2]) + A11 = adjoint(A[1,1]); A12 = adjoint(A[2,1]); A21 = adjoint(A[1,2]); A22 = adjoint(A[2,2]) else A11 = A[1,1]; A12 = A[1,2]; A21 = A[2,1]; A22 = A[2,2] end if tB == 'T' B11 = transpose(B[1,1]); B12 = transpose(B[2,1]); B21 = transpose(B[1,2]); B22 = transpose(B[2,2]) elseif tB == 'C' - B11 = ctranspose(B[1,1]); B12 = ctranspose(B[2,1]); B21 = ctranspose(B[1,2]); B22 = ctranspose(B[2,2]) + B11 = adjoint(B[1,1]); B12 = adjoint(B[2,1]); B21 = adjoint(B[1,2]); B22 = adjoint(B[2,2]) else B11 = B[1,1]; B12 = B[1,2]; B21 = B[2,1]; B22 = B[2,2] end @@ -697,9 +697,9 @@ function matmul3x3!(C::AbstractMatrix, tA, tB, A::AbstractMatrix, B::AbstractMat A21 = transpose(A[1,2]); A22 = transpose(A[2,2]); A23 = transpose(A[3,2]) A31 = transpose(A[1,3]); A32 = transpose(A[2,3]); A33 = transpose(A[3,3]) elseif tA == 'C' - A11 = ctranspose(A[1,1]); A12 = ctranspose(A[2,1]); A13 = ctranspose(A[3,1]) - A21 = ctranspose(A[1,2]); A22 = ctranspose(A[2,2]); A23 = ctranspose(A[3,2]) - A31 = ctranspose(A[1,3]); A32 = ctranspose(A[2,3]); A33 = ctranspose(A[3,3]) + A11 = adjoint(A[1,1]); A12 = adjoint(A[2,1]); A13 = adjoint(A[3,1]) + A21 = adjoint(A[1,2]); A22 = adjoint(A[2,2]); A23 = adjoint(A[3,2]) + A31 = adjoint(A[1,3]); A32 = adjoint(A[2,3]); A33 = adjoint(A[3,3]) else A11 = A[1,1]; A12 = A[1,2]; A13 = A[1,3] A21 = A[2,1]; A22 = A[2,2]; A23 = A[2,3] @@ -711,9 +711,9 @@ function matmul3x3!(C::AbstractMatrix, tA, tB, A::AbstractMatrix, B::AbstractMat B21 = transpose(B[1,2]); B22 = transpose(B[2,2]); B23 = transpose(B[3,2]) B31 = transpose(B[1,3]); B32 = transpose(B[2,3]); B33 = transpose(B[3,3]) elseif tB == 'C' - B11 = ctranspose(B[1,1]); B12 = ctranspose(B[2,1]); B13 = ctranspose(B[3,1]) - B21 = ctranspose(B[1,2]); B22 = ctranspose(B[2,2]); B23 = ctranspose(B[3,2]) - B31 = ctranspose(B[1,3]); B32 = ctranspose(B[2,3]); B33 = ctranspose(B[3,3]) + B11 = adjoint(B[1,1]); B12 = adjoint(B[2,1]); B13 = adjoint(B[3,1]) + B21 = adjoint(B[1,2]); B22 = adjoint(B[2,2]); B23 = adjoint(B[3,2]) + B31 = adjoint(B[1,3]); B32 = adjoint(B[2,3]); B33 = adjoint(B[3,3]) else B11 = B[1,1]; B12 = B[1,2]; B13 = B[1,3] B21 = B[2,1]; B22 = B[2,2]; B23 = B[2,3] diff --git a/base/linalg/qr.jl b/base/linalg/qr.jl index a6e1e7522c429..46b46d3cb3cf3 100644 --- a/base/linalg/qr.jl +++ b/base/linalg/qr.jl @@ -595,7 +595,7 @@ for (f1, f2) in ((:A_mul_Bc, :A_mul_B!), function ($f1)(Q::AbstractQ, B::StridedVecOrMat) TQB = promote_type(eltype(Q), eltype(B)) Bc = similar(B, TQB, (size(B, 2), size(B, 1))) - ctranspose!(Bc, B) + adjoint!(Bc, B) return ($f2)(convert(AbstractMatrix{TQB}, Q), Bc) end end @@ -678,7 +678,7 @@ function A_mul_Bc(A::StridedMatrix, B::AbstractQ) throw(DimensionMismatch("matrix A has dimensions $(size(A)) but matrix B has dimensions $(size(B))")) end end -@inline A_mul_Bc(rowvec::RowVector, B::AbstractQ) = ctranspose(B*ctranspose(rowvec)) +@inline A_mul_Bc(rowvec::RowVector, B::AbstractQ) = adjoint(B*adjoint(rowvec)) ### AcQ/AcQc @@ -688,7 +688,7 @@ for (f1, f2) in ((:Ac_mul_B, :A_mul_B!), function ($f1)(A::StridedVecOrMat, Q::AbstractQ) TAQ = promote_type(eltype(A), eltype(Q)) Ac = similar(A, TAQ, (size(A, 2), size(A, 1))) - ctranspose!(Ac, A) + adjoint!(Ac, A) return ($f2)(Ac, convert(AbstractMatrix{TAQ}, Q)) end end diff --git a/base/linalg/rowvector.jl b/base/linalg/rowvector.jl index eb24fa5792517..b7b3270a507ef 100644 --- a/base/linalg/rowvector.jl +++ b/base/linalg/rowvector.jl @@ -6,7 +6,7 @@ A lazy-view wrapper of an [`AbstractVector`](@ref), which turns a length-`n` vector into a `1×n` shaped row vector and represents the transpose of a vector (the elements are also transposed recursively). This type is usually constructed (and unwrapped) via the [`transpose`](@ref) -function or `.'` operator (or related [`ctranspose`](@ref) or `'` operator). +function or `.'` operator (or related [`adjoint`](@ref) or `'` operator). By convention, a vector can be multiplied by a matrix on its left (`A * v`) whereas a row vector can be multiplied by a matrix on its right (such that `v.' * A = (A.' * v).'`). It @@ -75,12 +75,12 @@ julia> transpose(v) ``` """ @inline transpose(vec::AbstractVector) = RowVector(vec) -@inline ctranspose(vec::AbstractVector) = RowVector(_conj(vec)) +@inline adjoint(vec::AbstractVector) = RowVector(_conj(vec)) @inline transpose(rowvec::RowVector) = rowvec.vec @inline transpose(rowvec::ConjRowVector) = copy(rowvec.vec) # remove the ConjArray wrapper from any raw vector -@inline ctranspose(rowvec::RowVector) = conj(rowvec.vec) -@inline ctranspose(rowvec::RowVector{<:Real}) = rowvec.vec +@inline adjoint(rowvec::RowVector) = conj(rowvec.vec) +@inline adjoint(rowvec::RowVector{<:Real}) = rowvec.vec parent(rowvec::RowVector) = rowvec.vec @@ -208,24 +208,24 @@ At_mul_B(vec::AbstractVector, rowvec::RowVector) = throw(DimensionMismatch( # Conjugated forms A_mul_Bc(::RowVector, ::AbstractVector) = throw(DimensionMismatch("Cannot multiply two transposed vectors")) -@inline A_mul_Bc(rowvec::RowVector, mat::AbstractMatrix) = ctranspose(mat * ctranspose(rowvec)) -@inline A_mul_Bc(rowvec1::RowVector, rowvec2::RowVector) = rowvec1 * ctranspose(rowvec2) +@inline A_mul_Bc(rowvec::RowVector, mat::AbstractMatrix) = adjoint(mat * adjoint(rowvec)) +@inline A_mul_Bc(rowvec1::RowVector, rowvec2::RowVector) = rowvec1 * adjoint(rowvec2) A_mul_Bc(vec::AbstractVector, rowvec::RowVector) = throw(DimensionMismatch("Cannot multiply two vectors")) -@inline A_mul_Bc(vec1::AbstractVector, vec2::AbstractVector) = vec1 * ctranspose(vec2) -@inline A_mul_Bc(mat::AbstractMatrix, rowvec::RowVector) = mat * ctranspose(rowvec) +@inline A_mul_Bc(vec1::AbstractVector, vec2::AbstractVector) = vec1 * adjoint(vec2) +@inline A_mul_Bc(mat::AbstractMatrix, rowvec::RowVector) = mat * adjoint(rowvec) -@inline Ac_mul_Bc(rowvec::RowVector, vec::AbstractVector) = ctranspose(rowvec) * ctranspose(vec) -@inline Ac_mul_Bc(vec::AbstractVector, mat::AbstractMatrix) = ctranspose(mat * vec) +@inline Ac_mul_Bc(rowvec::RowVector, vec::AbstractVector) = adjoint(rowvec) * adjoint(vec) +@inline Ac_mul_Bc(vec::AbstractVector, mat::AbstractMatrix) = adjoint(mat * vec) Ac_mul_Bc(rowvec1::RowVector, rowvec2::RowVector) = throw(DimensionMismatch("Cannot multiply two vectors")) -@inline Ac_mul_Bc(vec::AbstractVector, rowvec::RowVector) = ctranspose(vec)*ctranspose(rowvec) +@inline Ac_mul_Bc(vec::AbstractVector, rowvec::RowVector) = adjoint(vec)*adjoint(rowvec) Ac_mul_Bc(vec::AbstractVector, rowvec::AbstractVector) = throw(DimensionMismatch("Cannot multiply two transposed vectors")) -@inline Ac_mul_Bc(mat::AbstractMatrix, rowvec::RowVector) = mat' * ctranspose(rowvec) +@inline Ac_mul_Bc(mat::AbstractMatrix, rowvec::RowVector) = mat' * adjoint(rowvec) Ac_mul_B(::RowVector, ::AbstractVector) = throw(DimensionMismatch("Cannot multiply two vectors")) -@inline Ac_mul_B(vec::AbstractVector, mat::AbstractMatrix) = ctranspose(Ac_mul_B(mat,vec)) -@inline Ac_mul_B(rowvec1::RowVector, rowvec2::RowVector) = ctranspose(rowvec1) * rowvec2 +@inline Ac_mul_B(vec::AbstractVector, mat::AbstractMatrix) = adjoint(Ac_mul_B(mat,vec)) +@inline Ac_mul_B(rowvec1::RowVector, rowvec2::RowVector) = adjoint(rowvec1) * rowvec2 Ac_mul_B(vec::AbstractVector, rowvec::RowVector) = throw(DimensionMismatch("Cannot multiply two transposed vectors")) -@inline Ac_mul_B(vec1::AbstractVector, vec2::AbstractVector) = ctranspose(vec1)*vec2 +@inline Ac_mul_B(vec1::AbstractVector, vec2::AbstractVector) = adjoint(vec1)*vec2 # Left Division # @@ -237,4 +237,4 @@ Ac_ldiv_B(mat::AbstractMatrix, rowvec::RowVector) = throw(DimensionMismatch("Can @inline /(rowvec::RowVector, mat::AbstractMatrix) = transpose(transpose(mat) \ transpose(rowvec)) @inline A_rdiv_Bt(rowvec::RowVector, mat::AbstractMatrix) = transpose(mat \ transpose(rowvec)) -@inline A_rdiv_Bc(rowvec::RowVector, mat::AbstractMatrix) = ctranspose(mat \ ctranspose(rowvec)) +@inline A_rdiv_Bc(rowvec::RowVector, mat::AbstractMatrix) = adjoint(mat \ adjoint(rowvec)) diff --git a/base/linalg/symmetric.jl b/base/linalg/symmetric.jl index 8d98709daaf7f..1a890da1a5007 100644 --- a/base/linalg/symmetric.jl +++ b/base/linalg/symmetric.jl @@ -177,7 +177,7 @@ function copy!(dest::Hermitian, src::Hermitian) if src.uplo == dest.uplo copy!(dest.data, src.data) else - ctranspose!(dest.data, src.data) + adjoint!(dest.data, src.data) end return dest end @@ -212,16 +212,16 @@ issymmetric(A::Hermitian{<:Complex}) = isreal(A) issymmetric(A::Symmetric) = true transpose(A::Symmetric) = A transpose(A::Hermitian{<:Real}) = A -ctranspose(A::Symmetric{<:Real}) = A -function ctranspose(A::Symmetric) - AC = ctranspose(A.data) +adjoint(A::Symmetric{<:Real}) = A +function adjoint(A::Symmetric) + AC = adjoint(A.data) return Symmetric(AC, ifelse(A.uplo == 'U', :L, :U)) end function transpose(A::Hermitian) AT = transpose(A.data) return Hermitian(AT, ifelse(A.uplo == 'U', :L, :U)) end -ctranspose(A::Hermitian) = A +adjoint(A::Hermitian) = A trace(A::Hermitian) = real(trace(A.data)) Base.conj(A::HermOrSym) = typeof(A)(conj(A.data), A.uplo) @@ -307,7 +307,7 @@ A_mul_B!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatri At_mul_B(A::RealHermSymComplexSym, B::AbstractVector) = A*B At_mul_B(A::RealHermSymComplexSym, B::AbstractMatrix) = A*B A_mul_Bt(A::AbstractMatrix, B::RealHermSymComplexSym) = A*B -## Hermitian{<:Number} and Symmetric{<:Real} are invariant to ctranspose; peel off the c +## Hermitian{<:Number} and Symmetric{<:Real} are invariant to adjoint; peel off the c Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractVector) = A*B Ac_mul_B(A::RealHermSymComplexHerm, B::AbstractMatrix) = A*B A_mul_Bc(A::AbstractMatrix, B::RealHermSymComplexHerm) = A*B diff --git a/base/linalg/transpose.jl b/base/linalg/transpose.jl index c19730f9f58fc..0baf0f9393f6e 100644 --- a/base/linalg/transpose.jl +++ b/base/linalg/transpose.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -ctranspose(a::AbstractArray) = error("ctranspose not defined for $(typeof(a)). Consider using `permutedims` for higher-dimensional arrays.") +adjoint(a::AbstractArray) = error("adjoint not defined for $(typeof(a)). Consider using `permutedims` for higher-dimensional arrays.") transpose(a::AbstractArray) = error("transpose not defined for $(typeof(a)). Consider using `permutedims` for higher-dimensional arrays.") ## Matrix transposition ## @@ -16,14 +16,14 @@ regions. transpose!(B::AbstractMatrix, A::AbstractMatrix) = transpose_f!(transpose, B, A) """ - ctranspose!(dest,src) + adjoint!(dest,src) Conjugate transpose array `src` and store the result in the preallocated array `dest`, which should have a size corresponding to `(size(src,2),size(src,1))`. No in-place transposition is supported and unexpected results will happen if `src` and `dest` have overlapping memory regions. """ -ctranspose!(B::AbstractMatrix, A::AbstractMatrix) = transpose_f!(ctranspose, B, A) +adjoint!(B::AbstractMatrix, A::AbstractMatrix) = transpose_f!(adjoint, B, A) function transpose!(B::AbstractVector, A::AbstractMatrix) indices(B,1) == indices(A,2) && indices(A,1) == 1:1 || throw(DimensionMismatch("transpose")) copy!(B, A) @@ -32,11 +32,11 @@ function transpose!(B::AbstractMatrix, A::AbstractVector) indices(B,2) == indices(A,1) && indices(B,1) == 1:1 || throw(DimensionMismatch("transpose")) copy!(B, A) end -function ctranspose!(B::AbstractVector, A::AbstractMatrix) +function adjoint!(B::AbstractVector, A::AbstractMatrix) indices(B,1) == indices(A,2) && indices(A,1) == 1:1 || throw(DimensionMismatch("transpose")) ccopy!(B, A) end -function ctranspose!(B::AbstractMatrix, A::AbstractVector) +function adjoint!(B::AbstractMatrix, A::AbstractVector) indices(B,2) == indices(A,1) && indices(B,1) == 1:1 || throw(DimensionMismatch("transpose")) ccopy!(B, A) end @@ -85,11 +85,11 @@ function ccopy!(B, A) RB, RA = eachindex(B), eachindex(A) if RB == RA for i = RB - B[i] = ctranspose(A[i]) + B[i] = adjoint(A[i]) end else for (i,j) = zip(RB, RA) - B[i] = ctranspose(A[j]) + B[i] = adjoint(A[j]) end end end @@ -119,14 +119,14 @@ function transpose(A::AbstractMatrix) B = similar(A, (ind2, ind1)) transpose!(B, A) end -function ctranspose(A::AbstractMatrix) +function adjoint(A::AbstractMatrix) ind1, ind2 = indices(A) B = similar(A, (ind2, ind1)) - ctranspose!(B, A) + adjoint!(B, A) end -@inline ctranspose(A::AbstractVector{<:Real}) = transpose(A) -@inline ctranspose(A::AbstractMatrix{<:Real}) = transpose(A) +@inline adjoint(A::AbstractVector{<:Real}) = transpose(A) +@inline adjoint(A::AbstractMatrix{<:Real}) = transpose(A) function copy_transpose!(B::AbstractVecOrMat, ir_dest::Range{Int}, jr_dest::Range{Int}, A::AbstractVecOrMat, ir_src::Range{Int}, jr_src::Range{Int}) diff --git a/base/linalg/triangular.jl b/base/linalg/triangular.jl index 79ba4820a7fb1..12aaa748770f2 100644 --- a/base/linalg/triangular.jl +++ b/base/linalg/triangular.jl @@ -329,19 +329,19 @@ transpose(A::LowerTriangular) = UpperTriangular(transpose(A.data)) transpose(A::UnitLowerTriangular) = UnitUpperTriangular(transpose(A.data)) transpose(A::UpperTriangular) = LowerTriangular(transpose(A.data)) transpose(A::UnitUpperTriangular) = UnitLowerTriangular(transpose(A.data)) -ctranspose(A::LowerTriangular) = UpperTriangular(ctranspose(A.data)) -ctranspose(A::UnitLowerTriangular) = UnitUpperTriangular(ctranspose(A.data)) -ctranspose(A::UpperTriangular) = LowerTriangular(ctranspose(A.data)) -ctranspose(A::UnitUpperTriangular) = UnitLowerTriangular(ctranspose(A.data)) +adjoint(A::LowerTriangular) = UpperTriangular(adjoint(A.data)) +adjoint(A::UnitLowerTriangular) = UnitUpperTriangular(adjoint(A.data)) +adjoint(A::UpperTriangular) = LowerTriangular(adjoint(A.data)) +adjoint(A::UnitUpperTriangular) = UnitLowerTriangular(adjoint(A.data)) transpose!(A::LowerTriangular) = UpperTriangular(copytri!(A.data, 'L')) transpose!(A::UnitLowerTriangular) = UnitUpperTriangular(copytri!(A.data, 'L')) transpose!(A::UpperTriangular) = LowerTriangular(copytri!(A.data, 'U')) transpose!(A::UnitUpperTriangular) = UnitLowerTriangular(copytri!(A.data, 'U')) -ctranspose!(A::LowerTriangular) = UpperTriangular(copytri!(A.data, 'L' , true)) -ctranspose!(A::UnitLowerTriangular) = UnitUpperTriangular(copytri!(A.data, 'L' , true)) -ctranspose!(A::UpperTriangular) = LowerTriangular(copytri!(A.data, 'U' , true)) -ctranspose!(A::UnitUpperTriangular) = UnitLowerTriangular(copytri!(A.data, 'U' , true)) +adjoint!(A::LowerTriangular) = UpperTriangular(copytri!(A.data, 'L' , true)) +adjoint!(A::UnitLowerTriangular) = UnitUpperTriangular(copytri!(A.data, 'L' , true)) +adjoint!(A::UpperTriangular) = LowerTriangular(copytri!(A.data, 'U' , true)) +adjoint!(A::UnitUpperTriangular) = UnitLowerTriangular(copytri!(A.data, 'U' , true)) diag(A::LowerTriangular) = diag(A.data) diag(A::UnitLowerTriangular) = ones(eltype(A), size(A,1)) @@ -445,8 +445,8 @@ A_mul_B!(C::AbstractVector, A::AbstractTriangular, B::AbstractVector) = A_mul_B! A_mul_B!(C::AbstractMatrix, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, copy!(C, B)) A_mul_B!(C::AbstractVecOrMat, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, copy!(C, B)) A_mul_Bt!(C::AbstractVecOrMat, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, transpose!(C, B)) -A_mul_Bc!(C::AbstractMatrix, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, ctranspose!(C, B)) -A_mul_Bc!(C::AbstractVecOrMat, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, ctranspose!(C, B)) +A_mul_Bc!(C::AbstractMatrix, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, adjoint!(C, B)) +A_mul_Bc!(C::AbstractVecOrMat, A::AbstractTriangular, B::AbstractVecOrMat) = A_mul_B!(A, adjoint!(C, B)) for (t, uploc, isunitc) in ((:LowerTriangular, 'L', 'N'), (:UnitLowerTriangular, 'L', 'U'), @@ -1667,9 +1667,9 @@ end # below might compute an unnecessary copy. Eliminating the copy requires adding # all the promotion logic here once again. Since these methods are probably relatively # rare, we chose not to bother for now. -Ac_mul_B(A::AbstractMatrix, B::AbstractTriangular) = (*)(ctranspose(A), B) +Ac_mul_B(A::AbstractMatrix, B::AbstractTriangular) = (*)(adjoint(A), B) At_mul_B(A::AbstractMatrix, B::AbstractTriangular) = (*)(transpose(A), B) -A_mul_Bc(A::AbstractTriangular, B::AbstractMatrix) = (*)(A, ctranspose(B)) +A_mul_Bc(A::AbstractTriangular, B::AbstractMatrix) = (*)(A, adjoint(B)) A_mul_Bt(A::AbstractTriangular, B::AbstractMatrix) = (*)(A, transpose(B)) Ac_mul_Bc(A::AbstractTriangular, B::AbstractTriangular) = Ac_mul_B(A, B') Ac_mul_Bc(A::AbstractTriangular, B::AbstractMatrix) = Ac_mul_B(A, B') @@ -1683,9 +1683,9 @@ At_mul_Bt(A::AbstractMatrix, B::AbstractTriangular) = A_mul_Bt(A.', B) @inline A_mul_Bt(rowvec::RowVector, A::AbstractTriangular) = transpose(A * transpose(rowvec)) @inline A_mul_Bt(A::AbstractTriangular, rowvec::RowVector) = A * transpose(rowvec) @inline At_mul_Bt(A::AbstractTriangular, rowvec::RowVector) = A.' * transpose(rowvec) -@inline A_mul_Bc(rowvec::RowVector, A::AbstractTriangular) = ctranspose(A * ctranspose(rowvec)) -@inline A_mul_Bc(A::AbstractTriangular, rowvec::RowVector) = A * ctranspose(rowvec) -@inline Ac_mul_Bc(A::AbstractTriangular, rowvec::RowVector) = A' * ctranspose(rowvec) +@inline A_mul_Bc(rowvec::RowVector, A::AbstractTriangular) = adjoint(A * adjoint(rowvec)) +@inline A_mul_Bc(A::AbstractTriangular, rowvec::RowVector) = A * adjoint(rowvec) +@inline Ac_mul_Bc(A::AbstractTriangular, rowvec::RowVector) = A' * adjoint(rowvec) @inline /(rowvec::RowVector, A::Union{UpperTriangular,LowerTriangular}) = transpose(transpose(A) \ transpose(rowvec)) @inline /(rowvec::RowVector, A::Union{UnitUpperTriangular,UnitLowerTriangular}) = transpose(transpose(A) \ transpose(rowvec)) @@ -1693,8 +1693,8 @@ At_mul_Bt(A::AbstractMatrix, B::AbstractTriangular) = A_mul_Bt(A.', B) @inline A_rdiv_Bt(rowvec::RowVector, A::Union{UpperTriangular,LowerTriangular}) = transpose(A \ transpose(rowvec)) @inline A_rdiv_Bt(rowvec::RowVector, A::Union{UnitUpperTriangular,UnitLowerTriangular}) = transpose(A \ transpose(rowvec)) -@inline A_rdiv_Bc(rowvec::RowVector, A::Union{UpperTriangular,LowerTriangular}) = ctranspose(A \ ctranspose(rowvec)) -@inline A_rdiv_Bc(rowvec::RowVector, A::Union{UnitUpperTriangular,UnitLowerTriangular}) = ctranspose(A \ ctranspose(rowvec)) +@inline A_rdiv_Bc(rowvec::RowVector, A::Union{UpperTriangular,LowerTriangular}) = adjoint(A \ adjoint(rowvec)) +@inline A_rdiv_Bc(rowvec::RowVector, A::Union{UnitUpperTriangular,UnitLowerTriangular}) = adjoint(A \ adjoint(rowvec)) \(::Union{UpperTriangular,LowerTriangular}, ::RowVector) = throw(DimensionMismatch("Cannot left-divide matrix by transposed vector")) \(::Union{UnitUpperTriangular,UnitLowerTriangular}, ::RowVector) = throw(DimensionMismatch("Cannot left-divide matrix by transposed vector")) diff --git a/base/linalg/tridiag.jl b/base/linalg/tridiag.jl index d3ae5e1eb9bcf..299bd571b6dd7 100644 --- a/base/linalg/tridiag.jl +++ b/base/linalg/tridiag.jl @@ -125,7 +125,7 @@ broadcast(::typeof(floor), ::Type{T}, M::SymTridiagonal) where {T<:Integer} = Sy broadcast(::typeof(ceil), ::Type{T}, M::SymTridiagonal) where {T<:Integer} = SymTridiagonal(ceil.(T, M.dv), ceil.(T, M.ev)) transpose(M::SymTridiagonal) = M #Identity operation -ctranspose(M::SymTridiagonal) = conj(M) +adjoint(M::SymTridiagonal) = conj(M) function diag(M::SymTridiagonal{T}, n::Integer=0) where T absn = abs(n) @@ -524,7 +524,7 @@ broadcast(::typeof(ceil), ::Type{T}, M::Tridiagonal) where {T<:Integer} = Tridiagonal(ceil.(T, M.dl), ceil.(T, M.d), ceil.(T, M.du)) transpose(M::Tridiagonal) = Tridiagonal(M.du, M.d, M.dl) -ctranspose(M::Tridiagonal) = conj(transpose(M)) +adjoint(M::Tridiagonal) = conj(transpose(M)) function diag(M::Tridiagonal{T}, n::Integer=0) where T if n == 0 diff --git a/base/linalg/uniformscaling.jl b/base/linalg/uniformscaling.jl index b0feaac7d74f0..c1e2b86da06de 100644 --- a/base/linalg/uniformscaling.jl +++ b/base/linalg/uniformscaling.jl @@ -1,6 +1,6 @@ # This file is a part of Julia. License is MIT: https://julialang.org/license -import Base: copy, ctranspose, getindex, show, transpose, one, zero, inv, +import Base: copy, adjoint, getindex, show, transpose, one, zero, inv, hcat, vcat, hvcat import Base.LinAlg: SingularException @@ -63,7 +63,7 @@ end copy(J::UniformScaling) = UniformScaling(J.λ) transpose(J::UniformScaling) = J -ctranspose(J::UniformScaling) = UniformScaling(conj(J.λ)) +adjoint(J::UniformScaling) = UniformScaling(conj(J.λ)) one(::Type{UniformScaling{T}}) where {T} = UniformScaling(one(T)) one(J::UniformScaling{T}) where {T} = one(UniformScaling{T}) diff --git a/base/number.jl b/base/number.jl index 1a95f2dee6a77..2732e98b825ba 100644 --- a/base/number.jl +++ b/base/number.jl @@ -165,7 +165,7 @@ copysign(x::Real, y::Real) = ifelse(signbit(x)!=signbit(y), -x, +x) conj(x::Real) = x transpose(x::Number) = x -ctranspose(x::Number) = conj(x) +adjoint(x::Number) = conj(x) angle(z::Real) = atan2(zero(z), z) """ diff --git a/base/operators.jl b/base/operators.jl index 08fa05c50705c..138e6b7c2dcf1 100644 --- a/base/operators.jl +++ b/base/operators.jl @@ -740,7 +740,7 @@ fldmod1(x::T, y::T) where {T<:Integer} = (fld1(x,y), mod1(x,y)) # transpose """ - ctranspose(A) + adjoint(A) The conjugate transposition operator (`'`). @@ -751,13 +751,13 @@ julia> A = [3+2im 9+2im; 8+7im 4+6im] 3+2im 9+2im 8+7im 4+6im -julia> ctranspose(A) +julia> adjoint(A) 2×2 Array{Complex{Int64},2}: 3-2im 8-7im 9-2im 4-6im ``` """ -ctranspose(x) = conj(transpose(x)) +adjoint(x) = conj(transpose(x)) conj(x) = x # transposed multiply @@ -767,21 +767,21 @@ conj(x) = x For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ⋅B``. """ -Ac_mul_B(a,b) = ctranspose(a)*b +Ac_mul_B(a,b) = adjoint(a)*b """ A_mul_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``A⋅Bᴴ``. """ -A_mul_Bc(a,b) = a*ctranspose(b) +A_mul_Bc(a,b) = a*adjoint(b) """ Ac_mul_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ Bᴴ``. """ -Ac_mul_Bc(a,b) = ctranspose(a)*ctranspose(b) +Ac_mul_Bc(a,b) = adjoint(a)*adjoint(b) """ At_mul_B(A, B) @@ -811,21 +811,21 @@ At_mul_Bt(a,b) = transpose(a)*transpose(b) For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ / B``. """ -Ac_rdiv_B(a,b) = ctranspose(a)/b +Ac_rdiv_B(a,b) = adjoint(a)/b """ A_rdiv_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``A / Bᴴ``. """ -A_rdiv_Bc(a,b) = a/ctranspose(b) +A_rdiv_Bc(a,b) = a/adjoint(b) """ Ac_rdiv_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ / Bᴴ``. """ -Ac_rdiv_Bc(a,b) = ctranspose(a)/ctranspose(b) +Ac_rdiv_Bc(a,b) = adjoint(a)/adjoint(b) """ At_rdiv_B(A, B) @@ -853,21 +853,21 @@ At_rdiv_Bt(a,b) = transpose(a)/transpose(b) For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ`` \\ ``B``. """ -Ac_ldiv_B(a,b) = ctranspose(a)\b +Ac_ldiv_B(a,b) = adjoint(a)\b """ A_ldiv_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``A`` \\ ``Bᴴ``. """ -A_ldiv_Bc(a,b) = a\ctranspose(b) +A_ldiv_Bc(a,b) = a\adjoint(b) """ Ac_ldiv_Bc(A, B) For matrices or vectors ``A`` and ``B``, calculates ``Aᴴ`` \\ ``Bᴴ``. """ -Ac_ldiv_Bc(a,b) = ctranspose(a)\ctranspose(b) +Ac_ldiv_Bc(a,b) = adjoint(a)\adjoint(b) """ At_ldiv_B(A, B) diff --git a/base/sparse/cholmod.jl b/base/sparse/cholmod.jl index 5351a0717c041..2644bd7b5cd41 100644 --- a/base/sparse/cholmod.jl +++ b/base/sparse/cholmod.jl @@ -3,7 +3,7 @@ module CHOLMOD import Base: (*), convert, copy, eltype, getindex, show, size, - IndexStyle, IndexLinear, IndexCartesian, ctranspose + IndexStyle, IndexLinear, IndexCartesian, adjoint 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, @@ -1209,15 +1209,15 @@ IndexStyle(::Dense) = IndexLinear() size(FC::FactorComponent, i::Integer) = size(FC.F, i) size(FC::FactorComponent) = size(FC.F) -ctranspose(FC::FactorComponent{Tv,:L}) where {Tv} = FactorComponent{Tv,:U}(FC.F) -ctranspose(FC::FactorComponent{Tv,:U}) where {Tv} = FactorComponent{Tv,:L}(FC.F) -ctranspose(FC::FactorComponent{Tv,:PtL}) where {Tv} = FactorComponent{Tv,:UP}(FC.F) -ctranspose(FC::FactorComponent{Tv,:UP}) where {Tv} = FactorComponent{Tv,:PtL}(FC.F) -ctranspose(FC::FactorComponent{Tv,:D}) where {Tv} = FC -ctranspose(FC::FactorComponent{Tv,:LD}) where {Tv} = FactorComponent{Tv,:DU}(FC.F) -ctranspose(FC::FactorComponent{Tv,:DU}) where {Tv} = FactorComponent{Tv,:LD}(FC.F) -ctranspose(FC::FactorComponent{Tv,:PtLD}) where {Tv} = FactorComponent{Tv,:DUP}(FC.F) -ctranspose(FC::FactorComponent{Tv,:DUP}) where {Tv} = FactorComponent{Tv,:PtLD}(FC.F) +adjoint(FC::FactorComponent{Tv,:L}) where {Tv} = FactorComponent{Tv,:U}(FC.F) +adjoint(FC::FactorComponent{Tv,:U}) where {Tv} = FactorComponent{Tv,:L}(FC.F) +adjoint(FC::FactorComponent{Tv,:PtL}) where {Tv} = FactorComponent{Tv,:UP}(FC.F) +adjoint(FC::FactorComponent{Tv,:UP}) where {Tv} = FactorComponent{Tv,:PtL}(FC.F) +adjoint(FC::FactorComponent{Tv,:D}) where {Tv} = FC +adjoint(FC::FactorComponent{Tv,:LD}) where {Tv} = FactorComponent{Tv,:DU}(FC.F) +adjoint(FC::FactorComponent{Tv,:DU}) where {Tv} = FactorComponent{Tv,:LD}(FC.F) +adjoint(FC::FactorComponent{Tv,:PtLD}) where {Tv} = FactorComponent{Tv,:DUP}(FC.F) +adjoint(FC::FactorComponent{Tv,:DUP}) where {Tv} = FactorComponent{Tv,:PtLD}(FC.F) function getindex(A::Dense, i::Integer) s = unsafe_load(pointer(A)) @@ -1651,8 +1651,8 @@ function (\)(L::FactorComponent, B::SparseVecOrMat) sparse(L\Sparse(B,0)) end -Ac_ldiv_B(L::FactorComponent, B) = ctranspose(L)\B -Ac_ldiv_B(L::FactorComponent, B::RowVector) = ctranspose(L)\B # ambiguity +Ac_ldiv_B(L::FactorComponent, B) = adjoint(L)\B +Ac_ldiv_B(L::FactorComponent, B::RowVector) = adjoint(L)\B # ambiguity (\)(L::Factor{T}, B::Dense{T}) where {T<:VTypes} = solve(CHOLMOD_A, L, B) # Explicit typevars are necessary to avoid ambiguities with defs in linalg/factorizations.jl diff --git a/base/sparse/linalg.jl b/base/sparse/linalg.jl index ad56b6ed057cc..5ae8cdda4129c 100644 --- a/base/sparse/linalg.jl +++ b/base/sparse/linalg.jl @@ -44,7 +44,7 @@ end # In matrix-vector multiplication, the correct orientation of the vector is assumed. for (f, op, transp) in ((:A_mul_B, :identity, false), - (:Ac_mul_B, :ctranspose, true), + (:Ac_mul_B, :adjoint, true), (:At_mul_B, :transpose, true)) @eval begin function $(Symbol(f,:!))(α::Number, A::SparseMatrixCSC, B::StridedVecOrMat, β::Number, C::StridedVecOrMat) @@ -124,11 +124,11 @@ end (*)(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti} = spmatmul(A,B) for (f, opA, opB) in ((:A_mul_Bt, :identity, :transpose), - (:A_mul_Bc, :identity, :ctranspose), + (:A_mul_Bc, :identity, :adjoint), (:At_mul_B, :transpose, :identity), - (:Ac_mul_B, :ctranspose, :identity), + (:Ac_mul_B, :adjoint, :identity), (:At_mul_Bt, :transpose, :transpose), - (:Ac_mul_Bc, :ctranspose, :ctranspose)) + (:Ac_mul_Bc, :adjoint, :adjoint)) @eval begin function ($f)(A::SparseMatrixCSC{Tv,Ti}, B::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti} spmatmul(($opA)(A), ($opB)(B)) diff --git a/base/sparse/sparse.jl b/base/sparse/sparse.jl index 28126d551c10b..81cb3f3a95a1a 100644 --- a/base/sparse/sparse.jl +++ b/base/sparse/sparse.jl @@ -14,12 +14,12 @@ import Base.LinAlg: At_ldiv_B!, Ac_ldiv_B!, A_rdiv_B!, A_rdiv_Bc! 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, + cotd, coth, countnz, csc, cscd, csch, adjoint!, diag, diff, done, dot, eig, exp10, exp2, eye, findn, floor, hash, indmin, inv, issymmetric, istril, istriu, log10, log2, lu, next, sec, secd, sech, show, sin, sinc, sind, sinh, sinpi, squeeze, start, sum, summary, tan, tand, tanh, trace, transpose!, tril!, triu!, trunc, vecnorm, abs, abs2, - broadcast, ceil, complex, cond, conj, convert, copy, copy!, ctranspose, diagm, + broadcast, ceil, complex, cond, conj, convert, copy, copy!, adjoint, diagm, exp, expm1, factorize, find, findmax, findmin, findnz, float, full, getindex, vcat, hcat, hvcat, cat, imag, indmax, ishermitian, kron, length, log, log1p, max, min, maximum, minimum, norm, one, promote_eltype, real, reinterpret, reshape, rot180, diff --git a/base/sparse/sparsematrix.jl b/base/sparse/sparsematrix.jl index 0c501c8c72bfa..4bd62a54a25b8 100644 --- a/base/sparse/sparsematrix.jl +++ b/base/sparse/sparsematrix.jl @@ -853,14 +853,14 @@ function ftranspose!(X::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}, f::Fu halfperm!(X, A, 1:A.n, f) end transpose!(X::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti} = ftranspose!(X, A, identity) -ctranspose!(X::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti} = ftranspose!(X, A, conj) +adjoint!(X::SparseMatrixCSC{Tv,Ti}, A::SparseMatrixCSC{Tv,Ti}) where {Tv,Ti} = ftranspose!(X, A, conj) function ftranspose(A::SparseMatrixCSC{Tv,Ti}, f::Function) where {Tv,Ti} X = SparseMatrixCSC(A.n, A.m, Vector{Ti}(A.m+1), Vector{Ti}(nnz(A)), Vector{Tv}(nnz(A))) halfperm!(X, A, 1:A.n, f) end transpose(A::SparseMatrixCSC) = ftranspose(A, identity) -ctranspose(A::SparseMatrixCSC) = ftranspose(A, conj) +adjoint(A::SparseMatrixCSC) = ftranspose(A, conj) """ unchecked_noalias_permute!(X::SparseMatrixCSC{Tv,Ti}, diff --git a/base/sparse/sparsevector.jl b/base/sparse/sparsevector.jl index 80225e4d328c8..09bb230524f9d 100644 --- a/base/sparse/sparsevector.jl +++ b/base/sparse/sparsevector.jl @@ -1401,7 +1401,7 @@ vecnorm(x::SparseVectorUnion, p::Real=2) = vecnorm(nonzeros(x), p) # Transpose # (The only sparse matrix structure in base is CSC, so a one-row sparse matrix is worse than dense) @inline transpose(sv::SparseVector) = RowVector(sv) -@inline ctranspose(sv::SparseVector) = RowVector(conj(sv)) +@inline adjoint(sv::SparseVector) = RowVector(conj(sv)) ### BLAS Level-1 diff --git a/doc/src/manual/functions.md b/doc/src/manual/functions.md index 2f417d9466596..a5d28296daed5 100644 --- a/doc/src/manual/functions.md +++ b/doc/src/manual/functions.md @@ -163,7 +163,7 @@ A few special expressions correspond to calls to functions with non-obvious name | `[A B C ...]` | [`hcat()`](@ref) | | `[A; B; C; ...]` | [`vcat()`](@ref) | | `[A B; C D; ...]` | [`hvcat()`](@ref) | -| `A'` | [`ctranspose()`](@ref) | +| `A'` | [`adjoint()`](@ref) | | `A.'` | [`transpose()`](@ref) | | `1:n` | [`colon()`](@ref) | | `A[i]` | [`getindex()`](@ref) | diff --git a/doc/src/stdlib/linalg.md b/doc/src/stdlib/linalg.md index e9421cb216857..935ea52e50a04 100644 --- a/doc/src/stdlib/linalg.md +++ b/doc/src/stdlib/linalg.md @@ -109,8 +109,8 @@ Base.LinAlg.RowVector Base.LinAlg.ConjArray Base.transpose Base.transpose! -Base.ctranspose -Base.ctranspose! +Base.adjoint +Base.adjoint! Base.LinAlg.eigs(::Any) Base.LinAlg.eigs(::Any, ::Any) Base.LinAlg.svds diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 42cbb9fecf7d7..386c423d3bf65 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -2369,7 +2369,7 @@ ,.(apply append rows))) `(call (top typed_vcat) ,t ,@a))))) - '|'| (lambda (e) `(call ctranspose ,(expand-forms (cadr e)))) + '|'| (lambda (e) `(call adjoint ,(expand-forms (cadr e)))) '|.'| (lambda (e) `(call transpose ,(expand-forms (cadr e)))) 'generator diff --git a/test/arrayops.jl b/test/arrayops.jl index 9055e55ba49df..776e73fab5e9b 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -1685,12 +1685,12 @@ end d = ones(Complex,6) @test_throws DimensionMismatch transpose!(a,d) @test_throws DimensionMismatch transpose!(d,a) - @test_throws DimensionMismatch ctranspose!(a,d) - @test_throws DimensionMismatch ctranspose!(d,a) + @test_throws DimensionMismatch adjoint!(a,d) + @test_throws DimensionMismatch adjoint!(d,a) @test_throws DimensionMismatch transpose!(b,c) - @test_throws DimensionMismatch ctranspose!(b,c) + @test_throws DimensionMismatch adjoint!(b,c) @test_throws DimensionMismatch transpose!(c,b) - @test_throws DimensionMismatch ctranspose!(c,b) + @test_throws DimensionMismatch adjoint!(c,b) transpose!(b,a) @test b == ones(Complex,5) b = ones(Complex,5) @@ -1698,10 +1698,10 @@ end transpose!(a,b) @test a == ones(Complex,1,5) b = zeros(Complex,5) - ctranspose!(b,a) + adjoint!(b,a) @test b == ones(Complex,5) a = zeros(Complex,1,5) - ctranspose!(a,b) + adjoint!(a,b) @test a == ones(Complex,1,5) end diff --git a/test/distributed_exec.jl b/test/distributed_exec.jl index 0b0893d76005f..65de2c21a4a9d 100644 --- a/test/distributed_exec.jl +++ b/test/distributed_exec.jl @@ -469,7 +469,7 @@ d[5,1:2:4,8] = 19 AA = rand(4,2) A = @inferred(convert(SharedArray, AA)) B = @inferred(convert(SharedArray, AA')) -@test B*A == ctranspose(AA)*AA +@test B*A == adjoint(AA)*AA d=SharedArray{Int64,2}((10,10); init = D->fill!(D.loc_subarr_1d, myid()), pids=[id_me, id_other]) d2 = map(x->1, d) diff --git a/test/linalg/bidiag.jl b/test/linalg/bidiag.jl index 7c9d85b43e5cc..2ecd02da6b572 100644 --- a/test/linalg/bidiag.jl +++ b/test/linalg/bidiag.jl @@ -105,7 +105,7 @@ srand(1) @test Array(imag(T)) == imag(diagm(dv)) + imag(diagm(ev, uplo == :U ? 1 : -1)) end - @testset for func in (conj, transpose, ctranspose) + @testset for func in (conj, transpose, adjoint) @test func(func(T)) == T end diff --git a/test/linalg/diagonal.jl b/test/linalg/diagonal.jl index b1e8df0bd3ffb..d9d5805b8915c 100644 --- a/test/linalg/diagonal.jl +++ b/test/linalg/diagonal.jl @@ -100,7 +100,7 @@ srand(1) @test A_ldiv_B!(D, copy(U)) ≈ DM\U atol=atol_three @test At_ldiv_B!(D, copy(U)) ≈ DM\U atol=atol_three @test Ac_ldiv_B!(conj(D), copy(U)) ≈ DM\U atol=atol_three - Uc = ctranspose(U) + Uc = adjoint(U) target = scale!(Uc, inv.(D.diag)) @test A_rdiv_B!(Uc, D) ≈ target atol=atol_three @test_throws DimensionMismatch A_rdiv_B!(eye(elty, n-1), D) @@ -222,7 +222,7 @@ srand(1) @test transpose(D) == D if elty <: BlasComplex @test Array(conj(D)) ≈ conj(DM) - @test ctranspose(D) == conj(D) + @test adjoint(D) == conj(D) end # Translates to Ac/t_mul_B, which is specialized after issue 21286 @test(D' * v == conj(D) * v) diff --git a/test/linalg/generic.jl b/test/linalg/generic.jl index 4b92bf758c6fe..c6a0115b65697 100644 --- a/test/linalg/generic.jl +++ b/test/linalg/generic.jl @@ -371,6 +371,6 @@ Base.transpose(a::ModInt{n}) where {n} = a # see Issue 20978 end @testset "fallback throws properly for AbstractArrays with dimension > 2" begin - @test_throws ErrorException ctranspose(rand(2,2,2,2)) + @test_throws ErrorException adjoint(rand(2,2,2,2)) @test_throws ErrorException transpose(rand(2,2,2,2)) end diff --git a/test/linalg/givens.jl b/test/linalg/givens.jl index 49e0158491a1d..c13ddd2fcbb3b 100644 --- a/test/linalg/givens.jl +++ b/test/linalg/givens.jl @@ -22,8 +22,8 @@ using Base.Test @test A_mul_B!(G,eye(elty,10,10)) == [G[i,j] for i=1:10,j=1:10] @testset "transposes" begin - @test ctranspose(G)*G*eye(10) ≈ eye(elty, 10) - @test ctranspose(R)*(R*eye(10)) ≈ eye(elty, 10) + @test adjoint(G)*G*eye(10) ≈ eye(elty, 10) + @test adjoint(R)*(R*eye(10)) ≈ eye(elty, 10) @test_throws ErrorException transpose(G) @test_throws ErrorException transpose(R) end @@ -38,9 +38,9 @@ using Base.Test @test norm(R*eye(elty, 10)) ≈ one(elty) G, _ = givens(one(elty),zero(elty),9,10) - @test ctranspose(G*eye(elty,10))*(G*eye(elty,10)) ≈ eye(elty, 10) + @test adjoint(G*eye(elty,10))*(G*eye(elty,10)) ≈ eye(elty, 10) K, _ = givens(zero(elty),one(elty),9,10) - @test ctranspose(K*eye(elty,10))*(K*eye(elty,10)) ≈ eye(elty, 10) + @test adjoint(K*eye(elty,10))*(K*eye(elty,10)) ≈ eye(elty, 10) @testset "Givens * vectors" begin if isa(A, Array) diff --git a/test/linalg/qr.jl b/test/linalg/qr.jl index 282321086fd1a..25728ee0c8572 100644 --- a/test/linalg/qr.jl +++ b/test/linalg/qr.jl @@ -150,11 +150,11 @@ end @testset "transpose errors" begin @test_throws ErrorException transpose(qrfact(randn(3,3))) - @test_throws ErrorException ctranspose(qrfact(randn(3,3))) + @test_throws ErrorException adjoint(qrfact(randn(3,3))) @test_throws ErrorException transpose(qrfact(randn(3,3), Val(false))) - @test_throws ErrorException ctranspose(qrfact(randn(3,3), Val(false))) + @test_throws ErrorException adjoint(qrfact(randn(3,3), Val(false))) @test_throws ErrorException transpose(qrfact(big.(randn(3,3)))) - @test_throws ErrorException ctranspose(qrfact(big.(randn(3,3)))) + @test_throws ErrorException adjoint(qrfact(big.(randn(3,3)))) end @testset "Issue 7304" begin diff --git a/test/linalg/symmetric.jl b/test/linalg/symmetric.jl index 54cfb2753af27..296d599390d89 100644 --- a/test/linalg/symmetric.jl +++ b/test/linalg/symmetric.jl @@ -131,16 +131,16 @@ end end end - @testset "transpose, ctranspose" begin + @testset "transpose, adjoint" begin S = Symmetric(asym) H = Hermitian(aherm) @test transpose(S) === S == asym - @test ctranspose(H) === H == aherm + @test adjoint(H) === H == aherm if eltya <: Real - @test ctranspose(S) === S == asym + @test adjoint(S) === S == asym @test transpose(H) === H == aherm else - @test ctranspose(S) == Symmetric(conj(asym)) + @test adjoint(S) == Symmetric(conj(asym)) @test transpose(H) == Hermitian(transpose(aherm)) end end diff --git a/test/linalg/triangular.jl b/test/linalg/triangular.jl index f6dbe41552cc0..203d0640ca1a2 100644 --- a/test/linalg/triangular.jl +++ b/test/linalg/triangular.jl @@ -22,7 +22,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa (UnitLowerTriangular, :L)) # Construct test matrix - A1 = t1(elty1 == Int ? rand(1:7, n, n) : convert(Matrix{elty1}, (elty1 <: Complex ? complex.(randn(n, n), randn(n, n)) : randn(n, n)) |> t -> chol(t't) |> t -> uplo1 == :U ? t : ctranspose(t))) + A1 = t1(elty1 == Int ? rand(1:7, n, n) : convert(Matrix{elty1}, (elty1 <: Complex ? complex.(randn(n, n), randn(n, n)) : randn(n, n)) |> t -> chol(t't) |> t -> uplo1 == :U ? t : adjoint(t))) debug && println("elty1: $elty1, A1: $t1") @@ -132,15 +132,15 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa # transpose @test full(A1.') == full(A1).' @test full(viewA1.') == full(viewA1).' - # ctranspose + # adjoint @test full(A1') == full(A1)' @test full(viewA1') == full(viewA1)' # transpose! @test transpose!(copy(A1)) == A1.' @test transpose!(t1(view(copy(A1).data, vrange, vrange))) == viewA1.' - # ctranspose! - @test ctranspose!(copy(A1)) == A1' - @test ctranspose!(t1(view(copy(A1).data, vrange, vrange))) == viewA1' + # adjoint! + @test adjoint!(copy(A1)) == A1' + @test adjoint!(t1(view(copy(A1).data, vrange, vrange))) == viewA1' end # diag @@ -274,7 +274,7 @@ for elty1 in (Float32, Float64, BigFloat, Complex64, Complex128, Complex{BigFloa debug && println("elty1: $elty1, A1: $t1, elty2: $elty2") - A2 = t2(elty2 == Int ? rand(1:7, n, n) : convert(Matrix{elty2}, (elty2 <: Complex ? complex.(randn(n, n), randn(n, n)) : randn(n, n)) |> t -> chol(t't) |> t -> uplo2 == :U ? t : ctranspose(t))) + A2 = t2(elty2 == Int ? rand(1:7, n, n) : convert(Matrix{elty2}, (elty2 <: Complex ? complex.(randn(n, n), randn(n, n)) : randn(n, n)) |> t -> chol(t't) |> t -> uplo2 == :U ? t : adjoint(t))) # Convert if elty1 <: Real && !(elty2 <: Integer) diff --git a/test/linalg/tridiag.jl b/test/linalg/tridiag.jl index 2e231a7ec337a..ba52628695c50 100644 --- a/test/linalg/tridiag.jl +++ b/test/linalg/tridiag.jl @@ -65,7 +65,7 @@ B = randn(n,2) @testset "elementary operations" begin @test conj(T) == Tridiagonal(conj(dl), conj(d), conj(du)) @test transpose(T) == Tridiagonal(du, d, dl) - @test ctranspose(T) == Tridiagonal(conj(du), conj(d), conj(dl)) + @test adjoint(T) == Tridiagonal(conj(du), conj(d), conj(dl)) @test abs.(T) == Tridiagonal(abs.(dl),abs.(d),abs.(du)) if elty <: Real @@ -265,7 +265,7 @@ let n = 12 #Size of matrix problem to test @test_throws ArgumentError diag(A,n+1) end @testset "Idempotent tests" begin - for func in (conj, transpose, ctranspose) + for func in (conj, transpose, adjoint) @test func(func(A)) == A end end diff --git a/test/operators.jl b/test/operators.jl index 72effdbf33f51..e661968bf8e43 100644 --- a/test/operators.jl +++ b/test/operators.jl @@ -49,8 +49,6 @@ p = 1=>:foo @test xor(2) == 2 @test (⊻)(2) == 2 -# @test ctranspose('a') == 'a' # (c)transpose of Chars no longer supported - @test_throws ArgumentError Base.scalarmin(['a','b'],['c','d']) @test_throws ArgumentError Base.scalarmin('a',['c','d']) @test_throws ArgumentError Base.scalarmin(['a','b'],'c') diff --git a/test/sparse/sparse.jl b/test/sparse/sparse.jl index 38e25d0a3a5a8..8e43393ad1e61 100644 --- a/test/sparse/sparse.jl +++ b/test/sparse/sparse.jl @@ -401,11 +401,11 @@ end fullAt = transpose(Array(A)) @test transpose(A) == fullAt @test transpose!(similar(At), A) == fullAt - # ctranspose[!] + # adjoint[!] C = A + im*A/2 - fullCh = ctranspose(Array(C)) - @test ctranspose(C) == fullCh - @test ctranspose!(similar(sparse(fullCh)), C) == fullCh + fullCh = adjoint(Array(C)) + @test adjoint(C) == fullCh + @test adjoint!(similar(sparse(fullCh)), C) == fullCh # permute[!] p = randperm(m) q = randperm(n) @@ -423,7 +423,7 @@ end @testset "transpose of SubArrays" begin A = view(sprandn(10, 10, 0.3), 1:4, 1:4) @test transpose(Array(A)) == Array(transpose(A)) - @test ctranspose(Array(A)) == Array(ctranspose(A)) + @test adjoint(Array(A)) == Array(adjoint(A)) end @testset "exp" begin diff --git a/test/sparse/sparsevector.jl b/test/sparse/sparsevector.jl index 4a61940f53677..4d849f2080b9c 100644 --- a/test/sparse/sparsevector.jl +++ b/test/sparse/sparsevector.jl @@ -296,7 +296,7 @@ let a = SparseVector(8, [2, 5, 6], Int32[12, 35, 72]) @test complex(acp) == acp @test isa(acp, SparseVector{Complex128,Int}) @test exact_equal(acp, SparseVector(8, [2, 5, 6], complex([12., 35., 72.]))) - @test sparsevec(ctranspose(ctranspose(acp))) == acp + @test sparsevec(adjoint(adjoint(acp))) == acp end let x1 = SparseVector(8, [2, 5, 6], [12.2, 1.4, 5.0])