Skip to content

Commit 335a1ee

Browse files
authored
Forward _tri(l/r)div! to parent of triangular (#1348)
These loop over the stored triangular halves, so we may forward the operations to the parents. These are also internal methods that are not applied to unit triangular matrices, so we restrict these to `UpperTriangular` and `LowerTriangular` matrices in this PR. This makes it straightforward to forward the operations to the parent.
1 parent 44b6bc1 commit 335a1ee

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/triangular.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -802,38 +802,38 @@ function _triscale!(A::LowerOrUnitLowerTriangular, c::Number, B::UnitLowerTriang
802802
return A
803803
end
804804

805-
function _trirdiv!(A::UpperTriangular, B::UpperOrUnitUpperTriangular, c::Number)
805+
function _trirdiv!(A::UpperTriangular, B::UpperTriangular, c::Number)
806806
checksize1(A, B)
807807
for j in axes(B,2)
808808
for i in firstindex(B,1):j
809-
@inbounds A[i, j] = B[i, j] / c
809+
@inbounds A.data[i, j] = B.data[i, j] / c
810810
end
811811
end
812812
return A
813813
end
814-
function _trirdiv!(A::LowerTriangular, B::LowerOrUnitLowerTriangular, c::Number)
814+
function _trirdiv!(A::LowerTriangular, B::LowerTriangular, c::Number)
815815
checksize1(A, B)
816816
for j in axes(B,2)
817817
for i in j:lastindex(B,1)
818-
@inbounds A[i, j] = B[i, j] / c
818+
@inbounds A.data[i, j] = B.data[i, j] / c
819819
end
820820
end
821821
return A
822822
end
823-
function _trildiv!(A::UpperTriangular, c::Number, B::UpperOrUnitUpperTriangular)
823+
function _trildiv!(A::UpperTriangular, c::Number, B::UpperTriangular)
824824
checksize1(A, B)
825825
for j in axes(B,2)
826826
for i in firstindex(B,1):j
827-
@inbounds A[i, j] = c \ B[i, j]
827+
@inbounds A.data[i, j] = c \ B.data[i, j]
828828
end
829829
end
830830
return A
831831
end
832-
function _trildiv!(A::LowerTriangular, c::Number, B::LowerOrUnitLowerTriangular)
832+
function _trildiv!(A::LowerTriangular, c::Number, B::LowerTriangular)
833833
checksize1(A, B)
834834
for j in axes(B,2)
835835
for i in j:lastindex(B,1)
836-
@inbounds A[i, j] = c \ B[i, j]
836+
@inbounds A.data[i, j] = c \ B.data[i, j]
837837
end
838838
end
839839
return A

0 commit comments

Comments
 (0)