Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preventing matrix allocation during matrix multiplication in Julia

Tags:

julia

Is there a function in Julia's standard library that enables you to multiply two matrices and save the result into a third, pre-allocated matrix as opposed to allocating a new result matrix with each call?

like image 242
Ben Hamner Avatar asked Jan 12 '23 08:01

Ben Hamner


1 Answers

There are a lot of functions for doing this that are probably intentionally underdocumented since we'd like to replace them with better abstractions. But, for now, here's a sample:

julia> A_m
A_mul_B!   A_mul_B    A_mul_Bc   A_mul_Bt   A_mul_Bc!  A_mul_Bt!  
julia> A_mul_B

You can always try names(Base.LinAlg) for all of the linear algebra functions defined in Base, which is useful to get a sense of what might already exist even though it lacks documentation.

like image 71
John Myles White Avatar answered Jan 19 '23 00:01

John Myles White