How to multiply two matrix


#1

Hi,

I have a X matrix of dim of (4,1)
I have a H matrix of (1,4)

I need a matrix of 4,4 of H`X

How?

  let z_t = &H.transpose()*&X;

H: Matrix { data: VecStorage { data: [1.0, 0.0, 0.0, 0.0], nrows: Dynamic { value: 1 }, ncols: Dynamic { value: 4 } } }

X: Matrix { data: VecStorage { data: [1.2, -1.3, 2.1, 3.2], nrows: Dynamic { value: 4 }, ncols: Dynamic { value: 1 } } }

thread ‘main’ panicked at 'assertion failed: (left == right)

left: 1,

right: 4: gemm: dimensions mismatch for multiplication.’, /Users/.cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.16.13/src/base/blas.rs:667:13

note: Run with RUST_BACKTRACE=1 for a backtrace.


#2

Hi!

The dimensions of your matrices don’t match for multiplication. H' has dimension (4,1) so you can’t multiply it with a matrix of dimension (4,1) so H'X does not make sense. Did you mean to do (HX)' or perhaps XH ?