# A_mul_B!

A_mul_B!(Y, A, B) -> Y

Calculates the matrix-matrix or matrix-vector product \$Aâ‹…B\$ and stores the result in `Y`, overwriting the existing value of `Y`. Note that `Y` must not be aliased with either `A` or `B`.

``````julia> A=[1.0 2.0; 3.0 4.0]; B=[1.0 1.0; 1.0 1.0]; Y = similar(B); A_mul_B!(Y, A, B);

julia> Y
2x2 Array{Float64,2}:
3.0  3.0
7.0  7.0``````

## Examples

1. Matrix-matrix multiplication:

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [1.0 1.0; 1.0 1.0];
julia> Y = similar(B);
julia> A_mul_B!(Y, A, B);
julia> Y
2×2 Array{Float64,2}:
3.0  3.0
7.0  7.0``````

This example calculates the matrix-matrix product `A⋅B` and stores the result in `Y`.

2. Matrix-vector multiplication:

``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [1.0, 1.0];
julia> Y = similar(B);
julia> A_mul_B!(Y, A, B);
julia> Y
2-element Array{Float64,1}:
3.0
7.0``````

It performs the matrix-vector multiplication `A⋅B` and stores the result in `Y`.

3. Avoid aliasing:
``````julia> A = [1.0 2.0; 3.0 4.0];
julia> B = [1.0 1.0; 1.0 1.0];
julia> A_mul_B!(A, A, B);  # Aliasing A with itself
ERROR: Mutating arrays is not allowed inside a loop``````

It's important to avoid aliasing `Y` with either `A` or `B`. Mutating the arrays being multiplied inside the function call can lead to errors.