Skip to content

Commit 1819443

Browse files
authored
add a performance warning about matmul
1 parent 29b3d3b commit 1819443

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ All of these are converted into array commands like `reshape` and `permutedims`
4343
and `eachslice`, plus a [broadcasting expression](https://julialang.org/blog/2017/01/moredots) if needed,
4444
and `sum` / `sum!`, or `*` / `mul!`. This package just provides a convenient notation.
4545

46+
> [!WARNING]
47+
> Writing `@reduce C[i,j] := sum(k) A[i,k] * B[k,j]` is terrible way to perform matrix multiplication.
48+
> This creates a huge array `A .* reshape(B, 1, size(B)...)` before summing, which is much slower than the built-in `A * B`.
49+
> [See below]([#Elsewhere](#elsewhere)) for other packages which aim to be good at such operations.
50+
4651
From version 0.4, it relies on [TransmuteDims.jl](https://github.com/mcabbott/TransmuteDims.jl)
4752
to handle re-ordering of dimensions, and [LazyStack.jl](https://github.com/mcabbott/LazyStack.jl)
4853
to handle slices. It should also now work with [OffsetArrays.jl](https://github.com/JuliaArrays/OffsetArrays.jl):

0 commit comments

Comments
 (0)