Skip to content

Commit ebcaba5

Browse files
authored
add mul! for AbstractTriangular (#153)
1 parent 22b5668 commit ebcaba5

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/Test/array.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,27 @@ function triangular_test(x)
590590
@test MA.iszero!!(z[i, j])
591591
end
592592
end
593+
v = deepcopy(x[:, 2])
594+
m = deepcopy(x)
595+
@test MA.isequal_canonical(
596+
mul!(deepcopy(v), ut, v),
597+
mul!(deepcopy(v), Matrix(ut), v),
598+
)
599+
@test MA.isequal_canonical(
600+
mul!(deepcopy(m), ut, m),
601+
mul!(deepcopy(m), Matrix(ut), m),
602+
)
603+
v = deepcopy(lt[:, 1])
604+
m = deepcopy(x)
605+
@test MA.isequal_canonical(
606+
mul!(deepcopy(v), lt, v),
607+
mul!(deepcopy(v), Matrix(lt), v),
608+
)
609+
@test MA.isequal_canonical(
610+
mul!(deepcopy(m), lt, m),
611+
mul!(deepcopy(m), Matrix(lt), m),
612+
)
613+
return
593614
end
594615

595616
function diagonal_test(x)

src/dispatch.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ function LinearAlgebra.mul!(
173173
return _mul!(ret, A, B)
174174
end
175175

176+
function LinearAlgebra.mul!(
177+
ret::AbstractVector{<:AbstractMutable},
178+
A::LinearAlgebra.AbstractTriangular,
179+
B::AbstractVector,
180+
)
181+
return _mul!(ret, A, B)
182+
end
183+
176184
function LinearAlgebra.mul!(
177185
ret::AbstractMatrix{<:AbstractMutable},
178186
A::LinearAlgebra.Transpose{<:Any,<:AbstractVecOrMat},
@@ -189,6 +197,14 @@ function LinearAlgebra.mul!(
189197
return _mul!(ret, A, B)
190198
end
191199

200+
function LinearAlgebra.mul!(
201+
ret::AbstractMatrix{<:AbstractMutable},
202+
A::LinearAlgebra.AbstractTriangular,
203+
B::AbstractMatrix,
204+
)
205+
return _mul!(ret, A, B)
206+
end
207+
192208
function LinearAlgebra.mul!(
193209
ret::AbstractMatrix{<:AbstractMutable},
194210
A::AbstractMatrix,

0 commit comments

Comments
 (0)