uses MtxExpr, Math387;
var am,bm: Matrix;
av: Vector;
ac: TCplx;
arr: TDoubleArray;
i: integer;
begin
ac := '1+2i'; //Convert from string to complex number
am := RandGauss(5,5,true); //5x5 complex matrix with Gaussian noise
av := Ramp(25); //real vector = [0, 1, 2,...., 23, 24]
bm := am*av + ac + 2; // (*,/) treat Matrices as vectors
// Same as: ./ and .* operators (not linear algebra)
//To make linear algebra multiplication and divison use functions
bm := Divide(am,bm) + 2; //matrix divison
bm := Mul(am,bm) + 2; //matrix multiply
//of course you can mix matrices and vectors
av.Resize(5);
av := Mul(av,bm) + 2; //vector from left and matrix multiply
av.CopyToArray(arr); //copy data to array of double
av := Vector(arr); //copy data from array to vector
for i := 0 to am.Rows-1 do //standard loop example
begin
av.CValues[i] := am.CValues[i,0]*av.CValues[i];
end;
end;