Skip to content

Commit 09f7213

Browse files
authored
Merge pull request #25364 from Sacha0/lowercase
adjoint/transpose transcend material concerns
2 parents 310667b + ac18317 commit 09f7213

Some content is hidden

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

80 files changed

+1359
-1313
lines changed

base/boot.jl

-2
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ macro _noinline_meta()
212212
Expr(:meta, :noinline)
213213
end
214214

215-
function postfixapostrophize end
216-
217215
struct BoundsError <: Exception
218216
a::Any
219217
i::Any

base/deprecated.jl

+368-368
Large diffs are not rendered by default.

base/linalg/adjtrans.jl

+39-20
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,40 @@ Transpose(x::Number) = transpose(x)
5151
# unwrapping constructors
5252
Adjoint(A::Adjoint) = A.parent
5353
Transpose(A::Transpose) = A.parent
54-
# normalizing unwrapping constructors
55-
# technically suspect, but at least fine for now
56-
Adjoint(A::Transpose) = conj(A.parent)
57-
Transpose(A::Adjoint) = conj(A.parent)
5854

59-
# eager lowercase quasi-constructors, unwrapping
60-
adjoint(A::Adjoint) = copy(A.parent)
61-
transpose(A::Transpose) = copy(A.parent)
62-
# eager lowercase quasi-constructors, normalizing
63-
# technically suspect, but at least fine for now
64-
adjoint(A::Transpose) = conj!(copy(A.parent))
65-
transpose(A::Adjoint) = conj!(copy(A.parent))
66-
67-
# lowercase quasi-constructors for vectors, TODO: deprecate
68-
adjoint(sv::AbstractVector) = Adjoint(sv)
69-
transpose(sv::AbstractVector) = Transpose(sv)
55+
# wrapping lowercase quasi-constructors
56+
adjoint(A::AbstractVecOrMat) = Adjoint(A)
57+
"""
58+
transpose(A::AbstractMatrix)
59+
60+
Lazy matrix transpose. Mutating the returned object should appropriately mutate `A`. Often,
61+
but not always, yields `Transpose(A)`, where `Transpose` is a lazy transpose wrapper. Note
62+
that this operation is recursive.
63+
64+
This operation is intended for linear algebra usage - for general data manipulation see
65+
[`permutedims`](@ref), which is non-recursive.
66+
67+
# Examples
68+
```jldoctest
69+
julia> A = [1 2 3; 4 5 6; 7 8 9]
70+
3×3 Array{Int64,2}:
71+
1 2 3
72+
4 5 6
73+
7 8 9
74+
75+
julia> transpose(A)
76+
3×3 Transpose{Int64,Array{Int64,2}}:
77+
1 4 7
78+
2 5 8
79+
3 6 9
80+
```
81+
"""
82+
transpose(A::AbstractVecOrMat) = Transpose(A)
83+
# unwrapping lowercase quasi-constructors
84+
adjoint(A::Adjoint) = A.parent
85+
transpose(A::Transpose) = A.parent
86+
adjoint(A::Transpose{<:Real}) = A.parent
87+
transpose(A::Adjoint{<:Real}) = A.parent
7088

7189

7290
# some aliases for internal convenience use
@@ -187,13 +205,14 @@ pinv(v::TransposeAbsVec, tol::Real = 0) = pinv(conj(v.parent)).parent
187205
## right-division \
188206
/(u::AdjointAbsVec, A::AbstractMatrix) = Adjoint(Adjoint(A) \ u.parent)
189207
/(u::TransposeAbsVec, A::AbstractMatrix) = Transpose(Transpose(A) \ u.parent)
190-
208+
/(u::AdjointAbsVec, A::Transpose{<:Any,<:AbstractMatrix}) = Adjoint(conj(A.parent) \ u.parent) # technically should be Adjoint(copy(Adjoint(copy(A))) \ u.parent)
209+
/(u::TransposeAbsVec, A::Adjoint{<:Any,<:AbstractMatrix}) = Transpose(conj(A.parent) \ u.parent) # technically should be Transpose(copy(Transpose(copy(A))) \ u.parent)
191210

192211
# dismabiguation methods
193-
*(A::AdjointAbsVec, B::Transpose{<:Any,<:AbstractMatrix}) = A * transpose(B.parent)
194-
*(A::TransposeAbsVec, B::Adjoint{<:Any,<:AbstractMatrix}) = A * adjoint(B.parent)
195-
*(A::Transpose{<:Any,<:AbstractMatrix}, B::Adjoint{<:Any,<:AbstractMatrix}) = transpose(A.parent) * B
196-
*(A::Adjoint{<:Any,<:AbstractMatrix}, B::Transpose{<:Any,<:AbstractMatrix}) = A * transpose(B.parent)
212+
*(A::AdjointAbsVec, B::Transpose{<:Any,<:AbstractMatrix}) = A * copy(B)
213+
*(A::TransposeAbsVec, B::Adjoint{<:Any,<:AbstractMatrix}) = A * copy(B)
214+
*(A::Transpose{<:Any,<:AbstractMatrix}, B::Adjoint{<:Any,<:AbstractMatrix}) = copy(A) * B
215+
*(A::Adjoint{<:Any,<:AbstractMatrix}, B::Transpose{<:Any,<:AbstractMatrix}) = A * copy(B)
197216
# Adj/Trans-vector * Trans/Adj-vector, shouldn't exist, here for ambiguity resolution? TODO: test removal
198217
*(A::Adjoint{<:Any,<:AbstractVector}, B::Transpose{<:Any,<:AbstractVector}) = throw(MethodError(*, (A, B)))
199218
*(A::Transpose{<:Any,<:AbstractVector}, B::Adjoint{<:Any,<:AbstractVector}) = throw(MethodError(*, (A, B)))

base/linalg/bidiag.jl

+19-13
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,14 @@ broadcast(::typeof(trunc), ::Type{T}, M::Bidiagonal) where {T<:Integer} = Bidiag
247247
broadcast(::typeof(floor), ::Type{T}, M::Bidiagonal) where {T<:Integer} = Bidiagonal(floor.(T, M.dv), floor.(T, M.ev), M.uplo)
248248
broadcast(::typeof(ceil), ::Type{T}, M::Bidiagonal) where {T<:Integer} = Bidiagonal(ceil.(T, M.dv), ceil.(T, M.ev), M.uplo)
249249

250-
transpose(M::Bidiagonal) = Bidiagonal(M.dv, M.ev, M.uplo == 'U' ? :L : :U)
251-
adjoint(M::Bidiagonal) = Bidiagonal(conj(M.dv), conj(M.ev), M.uplo == 'U' ? :L : :U)
250+
adjoint(B::Bidiagonal) = Adjoint(B)
251+
transpose(B::Bidiagonal) = Transpose(B)
252+
adjoint(B::Bidiagonal{<:Real}) = Bidiagonal(B.dv, B.ev, B.uplo == 'U' ? :L : :U)
253+
transpose(B::Bidiagonal{<:Number}) = Bidiagonal(B.dv, B.ev, B.uplo == 'U' ? :L : :U)
254+
Base.copy(aB::Adjoint{<:Any,<:Bidiagonal}) =
255+
(B = aB.parent; Bidiagonal(map(x -> copy.(Adjoint.(x)), (B.dv, B.ev))..., B.uplo == 'U' ? :L : :U))
256+
Base.copy(tB::Transpose{<:Any,<:Bidiagonal}) =
257+
(B = tB.parent; Bidiagonal(map(x -> copy.(Transpose.(x)), (B.dv, B.ev))..., B.uplo == 'U' ? :L : :U))
252258

253259
istriu(M::Bidiagonal) = M.uplo == 'U' || iszero(M.ev)
254260
istril(M::Bidiagonal) = M.uplo == 'L' || iszero(M.ev)
@@ -494,15 +500,15 @@ const SpecialMatrix = Union{Bidiagonal,SymTridiagonal,Tridiagonal}
494500

495501
#Generic multiplication
496502
*(A::Bidiagonal{T}, B::AbstractVector{T}) where {T} = *(Array(A), B)
497-
*(adjA::Adjoint{<:Any,<:Bidiagonal{T}}, B::AbstractVector{T}) where {T} = *(Adjoint(Array(adjA.parent)), B)
498-
*(A::Bidiagonal{T}, adjB::Adjoint{<:Any,<:AbstractVector{T}}) where {T} = *(Array(A), Adjoint(adjB.parent))
503+
*(adjA::Adjoint{<:Any,<:Bidiagonal{T}}, B::AbstractVector{T}) where {T} = *(adjoint(Array(adjA.parent)), B)
504+
*(A::Bidiagonal{T}, adjB::Adjoint{<:Any,<:AbstractVector{T}}) where {T} = *(Array(A), adjoint(adjB.parent))
499505
/(A::Bidiagonal{T}, B::AbstractVector{T}) where {T} = /(Array(A), B)
500-
/(A::Bidiagonal{T}, adjB::Adjoint{<:Any,<:AbstractVector{T}}) where {T} = /(Array(A), Adjoint(adjB.parent))
506+
/(A::Bidiagonal{T}, adjB::Adjoint{<:Any,<:AbstractVector{T}}) where {T} = /(Array(A), adjoint(adjB.parent))
501507

502508
#Linear solvers
503509
ldiv!(A::Union{Bidiagonal, AbstractTriangular}, b::AbstractVector) = naivesub!(A, b)
504-
ldiv!(transA::Transpose{<:Any,<:Bidiagonal}, b::AbstractVector) = ldiv!(transpose(transA.parent), b)
505-
ldiv!(adjA::Adjoint{<:Any,<:Bidiagonal}, b::AbstractVector) = ldiv!(adjoint(adjA.parent), b)
510+
ldiv!(A::Transpose{<:Any,<:Bidiagonal}, b::AbstractVector) = ldiv!(copy(A), b)
511+
ldiv!(A::Adjoint{<:Any,<:Bidiagonal}, b::AbstractVector) = ldiv!(copy(A), b)
506512
function ldiv!(A::Union{Bidiagonal,AbstractTriangular}, B::AbstractMatrix)
507513
nA,mA = size(A)
508514
tmp = similar(B,size(B,1))
@@ -527,7 +533,7 @@ function ldiv!(adjA::Adjoint{<:Any,<:Union{Bidiagonal,AbstractTriangular}}, B::A
527533
end
528534
for i = 1:size(B,2)
529535
copyto!(tmp, 1, B, (i - 1)*n + 1, n)
530-
ldiv!(Adjoint(A), tmp)
536+
ldiv!(adjoint(A), tmp)
531537
copyto!(B, (i - 1)*n + 1, tmp, 1, n) # Modify this when array view are implemented.
532538
end
533539
B
@@ -542,7 +548,7 @@ function ldiv!(transA::Transpose{<:Any,<:Union{Bidiagonal,AbstractTriangular}},
542548
end
543549
for i = 1:size(B,2)
544550
copyto!(tmp, 1, B, (i - 1)*n + 1, n)
545-
ldiv!(Transpose(A), tmp)
551+
ldiv!(transpose(A), tmp)
546552
copyto!(B, (i - 1)*n + 1, tmp, 1, n) # Modify this when array view are implemented.
547553
end
548554
B
@@ -580,16 +586,16 @@ function \(transA::Transpose{<:Number,<:Bidiagonal{<:Number}}, B::AbstractVecOrM
580586
A = transA.parent
581587
TA, TB = eltype(A), eltype(B)
582588
TAB = typeof((zero(TA)*zero(TB) + zero(TA)*zero(TB))/one(TA))
583-
ldiv!(Transpose(convert(AbstractArray{TAB}, A)), copy_oftype(B, TAB))
589+
ldiv!(transpose(convert(AbstractArray{TAB}, A)), copy_oftype(B, TAB))
584590
end
585-
\(transA::Transpose{<:Any,<:Bidiagonal}, B::AbstractVecOrMat) = ldiv!(Transpose(transA.parent), copy(B))
591+
\(transA::Transpose{<:Any,<:Bidiagonal}, B::AbstractVecOrMat) = ldiv!(transpose(transA.parent), copy(B))
586592
function \(adjA::Adjoint{<:Number,<:Bidiagonal{<:Number}}, B::AbstractVecOrMat{<:Number})
587593
A = adjA.parent
588594
TA, TB = eltype(A), eltype(B)
589595
TAB = typeof((zero(TA)*zero(TB) + zero(TA)*zero(TB))/one(TA))
590-
ldiv!(Adjoint(convert(AbstractArray{TAB}, A)), copy_oftype(B, TAB))
596+
ldiv!(adjoint(convert(AbstractArray{TAB}, A)), copy_oftype(B, TAB))
591597
end
592-
\(adjA::Adjoint{<:Any,<:Bidiagonal}, B::AbstractVecOrMat) = ldiv!(Adjoint(adjA.parent), copy(B))
598+
\(adjA::Adjoint{<:Any,<:Bidiagonal}, B::AbstractVecOrMat) = ldiv!(adjoint(adjA.parent), copy(B))
593599

594600
factorize(A::Bidiagonal) = A
595601

base/linalg/bitarray.jl

+11-10
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ end
123123

124124
## Structure query functions
125125

126-
issymmetric(A::BitMatrix) = size(A, 1)==size(A, 2) && count(!iszero, A - transpose(A))==0
126+
issymmetric(A::BitMatrix) = size(A, 1)==size(A, 2) && count(!iszero, A - copy(A'))==0
127127
ishermitian(A::BitMatrix) = issymmetric(A)
128128

129129
function nonzero_chunks(chunks::Vector{UInt64}, pos0::Int, pos1::Int)
@@ -250,16 +250,19 @@ function put_8x8_chunk(Bc::Vector{UInt64}, i1::Int, i2::Int, x::UInt64, m::Int,
250250
return
251251
end
252252

253-
function transpose(B::BitMatrix)
254-
l1 = size(B, 1)
255-
l2 = size(B, 2)
256-
Bt = falses(l2, l1)
253+
adjoint(B::Union{BitVector,BitMatrix}) = Adjoint(B)
254+
transpose(B::Union{BitVector,BitMatrix}) = Transpose(B)
255+
Base.copy(B::Adjoint{Bool,BitMatrix}) = transpose!(falses(size(B)), B.parent)
256+
Base.copy(B::Transpose{Bool,BitMatrix}) = transpose!(falses(size(B)), B.parent)
257+
function transpose!(C::BitMatrix, B::BitMatrix)
258+
@boundscheck size(C) == reverse(size(B)) || throw(DimensionMismatch())
259+
l1, l2 = size(B)
257260

258261
cgap1, cinc1 = Base._div64(l1), Base._mod64(l1)
259262
cgap2, cinc2 = Base._div64(l2), Base._mod64(l2)
260263

261264
Bc = B.chunks
262-
Btc = Bt.chunks
265+
Cc = C.chunks
263266

264267
nc = length(Bc)
265268

@@ -278,10 +281,8 @@ function transpose(B::BitMatrix)
278281
msk8_2 >>>= j + 7 - l2
279282
end
280283

281-
put_8x8_chunk(Btc, j, i, x, l2, cgap2, cinc2, nc, msk8_2)
284+
put_8x8_chunk(Cc, j, i, x, l2, cgap2, cinc2, nc, msk8_2)
282285
end
283286
end
284-
return Bt
287+
return C
285288
end
286-
287-
adjoint(B::Union{BitMatrix,BitVector}) = transpose(B)

base/linalg/blas.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -1000,7 +1000,7 @@ end
10001000
"""
10011001
syr!(uplo, alpha, x, A)
10021002
1003-
Rank-1 update of the symmetric matrix `A` with vector `x` as `alpha*x*Transpose(x) + A`.
1003+
Rank-1 update of the symmetric matrix `A` with vector `x` as `alpha*x*transpose(x) + A`.
10041004
[`uplo`](@ref stdlib-blas-uplo) controls which triangle of `A` is updated. Returns `A`.
10051005
"""
10061006
function syr! end
@@ -1243,7 +1243,7 @@ end
12431243
"""
12441244
syrk!(uplo, trans, alpha, A, beta, C)
12451245
1246-
Rank-k update of the symmetric matrix `C` as `alpha*A*Transpose(A) + beta*C` or `alpha*Transpose(A)*A +
1246+
Rank-k update of the symmetric matrix `C` as `alpha*A*transpose(A) + beta*C` or `alpha*transpose(A)*A +
12471247
beta*C` according to [`trans`](@ref stdlib-blas-trans).
12481248
Only the [`uplo`](@ref stdlib-blas-uplo) triangle of `C` is used. Returns `C`.
12491249
"""
@@ -1254,7 +1254,7 @@ function syrk! end
12541254
12551255
Returns either the upper triangle or the lower triangle of `A`,
12561256
according to [`uplo`](@ref stdlib-blas-uplo),
1257-
of `alpha*A*Transpose(A)` or `alpha*Transpose(A)*A`,
1257+
of `alpha*A*transpose(A)` or `alpha*transpose(A)*A`,
12581258
according to [`trans`](@ref stdlib-blas-trans).
12591259
"""
12601260
function syrk end

base/linalg/bunchkaufman.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ end
4343
"""
4444
bkfact(A, rook::Bool=false) -> BunchKaufman
4545
46-
Compute the Bunch-Kaufman [^Bunch1977] factorization of a symmetric or Hermitian matrix `A` as ``P'*U*D*U'*P`` or ``P'*L*D*L'*P``, depending on which triangle is stored in `A`, and return a `BunchKaufman` object. Note that if `A` is complex symmetric then `U'` and `L'` denote the unconjugated transposes, i.e. `Transpose(U)` and `Transpose(L)`.
46+
Compute the Bunch-Kaufman [^Bunch1977] factorization of a symmetric or Hermitian matrix `A` as ``P'*U*D*U'*P`` or ``P'*L*D*L'*P``, depending on which triangle is stored in `A`, and return a `BunchKaufman` object. Note that if `A` is complex symmetric then `U'` and `L'` denote the unconjugated transposes, i.e. `transpose(U)` and `transpose(L)`.
4747
4848
If `rook` is `true`, rook pivoting is used. If `rook` is false, rook pivoting is not used.
4949
@@ -115,7 +115,7 @@ end
115115
getproperty(B::BunchKaufman, d::Symbol)
116116
117117
Extract the factors of the Bunch-Kaufman factorization `B`. The factorization can take the
118-
two forms `P'*L*D*L'*P` or `P'*U*D*U'*P` (or `L*D*Transpose(L)` in the complex symmetric case)
118+
two forms `P'*L*D*L'*P` or `P'*U*D*U'*P` (or `L*D*transpose(L)` in the complex symmetric case)
119119
where `P` is a (symmetric) permutation matrix, `L` is a `UnitLowerTriangular` matrix, `U` is a
120120
`UnitUpperTriangular`, and `D` is a block diagonal symmetric or Hermitian matrix with
121121
1x1 or 2x2 blocks. The argument `d` can be
@@ -191,13 +191,13 @@ function getproperty(B::BunchKaufman{T}, d::Symbol) where {T<:BlasFloat}
191191
if getfield(B, :uplo) == 'L'
192192
return UnitLowerTriangular(LUD)
193193
else
194-
throw(ArgumentError("factorization is U*D*Transpose(U) but you requested L"))
194+
throw(ArgumentError("factorization is U*D*transpose(U) but you requested L"))
195195
end
196196
else # :U
197197
if B.uplo == 'U'
198198
return UnitUpperTriangular(LUD)
199199
else
200-
throw(ArgumentError("factorization is L*D*Transpose(L) but you requested U"))
200+
throw(ArgumentError("factorization is L*D*transpose(L) but you requested U"))
201201
end
202202
end
203203
else

base/linalg/cholesky.jl

+11-11
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function _chol!(A::AbstractMatrix, ::Type{UpperTriangular})
8787
return UpperTriangular(A), info
8888
end
8989
A[k,k] = Akk
90-
AkkInv = inv(adjoint(Akk))
90+
AkkInv = inv(copy(Akk'))
9191
for j = k + 1:n
9292
for i = 1:k - 1
9393
A[k,j] -= A[i,k]'A[i,j]
@@ -384,9 +384,9 @@ function getproperty(C::Cholesky, d::Symbol)
384384
Cfactors = getfield(C, :factors)
385385
Cuplo = getfield(C, :uplo)
386386
if d == :U
387-
return UpperTriangular(Symbol(Cuplo) == d ? Cfactors : adjoint(Cfactors))
387+
return UpperTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
388388
elseif d == :L
389-
return LowerTriangular(Symbol(Cuplo) == d ? Cfactors : adjoint(Cfactors))
389+
return LowerTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
390390
elseif d == :UL
391391
return Symbol(Cuplo) == :U ? UpperTriangular(Cfactors) : LowerTriangular(Cfactors)
392392
else
@@ -397,9 +397,9 @@ function getproperty(C::CholeskyPivoted{T}, d::Symbol) where T<:BlasFloat
397397
Cfactors = getfield(C, :factors)
398398
Cuplo = getfield(C, :uplo)
399399
if d == :U
400-
return UpperTriangular(Symbol(Cuplo) == d ? Cfactors : adjoint(Cfactors))
400+
return UpperTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
401401
elseif d == :L
402-
return LowerTriangular(Symbol(Cuplo) == d ? Cfactors : adjoint(Cfactors))
402+
return LowerTriangular(Symbol(Cuplo) == d ? Cfactors : copy(Cfactors'))
403403
elseif d == :p
404404
return getfield(C, :piv)
405405
elseif d == :P
@@ -437,9 +437,9 @@ ldiv!(C::Cholesky{T,<:AbstractMatrix}, B::StridedVecOrMat{T}) where {T<:BlasFloa
437437

438438
function ldiv!(C::Cholesky{<:Any,<:AbstractMatrix}, B::StridedVecOrMat)
439439
if C.uplo == 'L'
440-
return ldiv!(Adjoint(LowerTriangular(C.factors)), ldiv!(LowerTriangular(C.factors), B))
440+
return ldiv!(adjoint(LowerTriangular(C.factors)), ldiv!(LowerTriangular(C.factors), B))
441441
else
442-
return ldiv!(UpperTriangular(C.factors), ldiv!(Adjoint(UpperTriangular(C.factors)), B))
442+
return ldiv!(UpperTriangular(C.factors), ldiv!(adjoint(UpperTriangular(C.factors)), B))
443443
end
444444
end
445445

@@ -462,21 +462,21 @@ end
462462

463463
function ldiv!(C::CholeskyPivoted, B::StridedVector)
464464
if C.uplo == 'L'
465-
ldiv!(Adjoint(LowerTriangular(C.factors)),
465+
ldiv!(adjoint(LowerTriangular(C.factors)),
466466
ldiv!(LowerTriangular(C.factors), B[C.piv]))[invperm(C.piv)]
467467
else
468468
ldiv!(UpperTriangular(C.factors),
469-
ldiv!(Adjoint(UpperTriangular(C.factors)), B[C.piv]))[invperm(C.piv)]
469+
ldiv!(adjoint(UpperTriangular(C.factors)), B[C.piv]))[invperm(C.piv)]
470470
end
471471
end
472472

473473
function ldiv!(C::CholeskyPivoted, B::StridedMatrix)
474474
if C.uplo == 'L'
475-
ldiv!(Adjoint(LowerTriangular(C.factors)),
475+
ldiv!(adjoint(LowerTriangular(C.factors)),
476476
ldiv!(LowerTriangular(C.factors), B[C.piv,:]))[invperm(C.piv),:]
477477
else
478478
ldiv!(UpperTriangular(C.factors),
479-
ldiv!(Adjoint(UpperTriangular(C.factors)), B[C.piv,:]))[invperm(C.piv),:]
479+
ldiv!(adjoint(UpperTriangular(C.factors)), B[C.piv,:]))[invperm(C.piv),:]
480480
end
481481
end
482482

base/linalg/dense.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ function nullspace(A::StridedMatrix{T}) where T
13361336
(m == 0 || n == 0) && return Matrix{T}(I, n, n)
13371337
SVD = svdfact(A, full = true)
13381338
indstart = sum(SVD.S .> max(m,n)*maximum(SVD.S)*eps(eltype(SVD.S))) + 1
1339-
return adjoint(SVD.Vt[indstart:end,:])
1339+
return copy(SVD.Vt[indstart:end,:]')
13401340
end
13411341
nullspace(a::StridedVector) = nullspace(reshape(a, length(a), 1))
13421342

@@ -1402,9 +1402,9 @@ function sylvester(A::StridedMatrix{T},B::StridedMatrix{T},C::StridedMatrix{T})
14021402
RA, QA = schur(A)
14031403
RB, QB = schur(B)
14041404

1405-
D = -(Adjoint(QA) * (C*QB))
1405+
D = -(adjoint(QA) * (C*QB))
14061406
Y, scale = LAPACK.trsyl!('N','N', RA, RB, D)
1407-
scale!(QA*(Y * Adjoint(QB)), inv(scale))
1407+
scale!(QA*(Y * adjoint(QB)), inv(scale))
14081408
end
14091409
sylvester(A::StridedMatrix{T}, B::StridedMatrix{T}, C::StridedMatrix{T}) where {T<:Integer} = sylvester(float(A), float(B), float(C))
14101410

@@ -1445,9 +1445,9 @@ julia> A*X + X*A' + B
14451445
function lyap(A::StridedMatrix{T}, C::StridedMatrix{T}) where {T<:BlasFloat}
14461446
R, Q = schur(A)
14471447

1448-
D = -(Adjoint(Q) * (C*Q))
1448+
D = -(adjoint(Q) * (C*Q))
14491449
Y, scale = LAPACK.trsyl!('N', T <: Complex ? 'C' : 'T', R, R, D)
1450-
scale!(Q*(Y * Adjoint(Q)), inv(scale))
1450+
scale!(Q*(Y * adjoint(Q)), inv(scale))
14511451
end
14521452
lyap(A::StridedMatrix{T}, C::StridedMatrix{T}) where {T<:Integer} = lyap(float(A), float(C))
14531453
lyap(a::T, c::T) where {T<:Number} = -c/(2a)

0 commit comments

Comments
 (0)