You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encountered this case where the performance of multiplication seemed to have really poor scaling:
using FillArrays, SemiseparableMatrices, BandedMatrices, LazyArrays
functiongen_example(n)
A =BandedMatrix(0=> [1; 1:n-1], 1=>Fill(-1.0, n -1))
B =ApplyMatrix(*, ones(n), OneElement(1.0, (1, n), (1, n)))
AB =AlmostBandedMatrix(A, B)
U =UpperTriangular(AB)
L =LowerTriangular(brand(n, n, 2, 0))
stats =@timed U * L
return stats.time, stats.bytes
end
n =2.^ (0:11)
time_byts =gen_example.(n)
Actually, the LowerTriangular can be removed, i.e. use L = brand(n, n, 2, 0) instead, and the issue still shows. So I guess the issue is the UpperTriangular wrapper on an AlmostBandedMatrix.
I tried tracing the call enough to find the cause but I can't seem to identify it. Any ideas?
DanielVandH
changed the title
Poor scaling of matrix multiplication
Poor scaling of matrix multiplication for UpperTriangular(AlmostBandedMatrix)Aug 19, 2024
Encountered this case where the performance of multiplication seemed to have really poor scaling:
If I replace the
stats = ...
line with literallystats = @timed Matrix(U) * Matrix(L)
so that all the structure is lost,If I instead keep
stats = @timed U * L
but doAB = Matrix(A + B)
thenIf I do
AB = A + B
, the timing is instant since the multiplication is left lazy.The text was updated successfully, but these errors were encountered: