Matrix.AddTensorProd Method

TMtx AddTensorProd(TVec Vec1, TVec Vec2, Boolean ConjVec2)

Calculates the tensor product of two vectors and adds the result to calling matrix.

#NameTypeDescription
1Vec1TVecsource TVec
2Vec2TVecsource TVec
3ConjVec2Boolean

Result: stored in self (calling object), returns self for chaining

Remarks:

Calculates the tensor product of Vec1 and Vec2 vectors and adds the result to the calling matrix by using the following formula:

Y=Vec1 X Vec2 + Y.

If the ConjVec2 parameter is true, then the result will be tensor product of Vec1 and conjugated Vec2. The Dew.Math.Matrix.Rows property is set to Vec1.Dew.Math.Matrix.Length and Dew.Math.Matrix.Cols property is set to Vec2.Dew.Math.Matrix.Length. The Dew.Math.Matrix.Complex property of the calling matrix is adjusted automatically.

Examples
Matrix a;
Matrix b;
Vector v1;
Vector v2;
// Test non quadratic general matrix

a.SetIt(2,2,false,new double[] {0,2,2,0});
v1.SetIt(false,new double[] {1,0});
v2.setIt(false,new double[] {0,1});
a.AddTensorProd(v1,v2,false);
b.SetIt(false,new double[] {1,2,2,1});
if !(a = b) then raise Exception.Create(@"Not same");
See Also: Matrix.TensorProd