Matrix.AddProduct Method

function AddProduct(const Vec1: TMtxVec; const Vec2: TMtxVec): TMtxVec;

Add a product of two matrices.

#NameTypeDescription
1Vec1TMtxVec
2Vec2TMtxVec

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

Remarks:

Multiply Vec1 elements with coresponding Vec2 elements and add the result to the calling Matrix. The size of the calling Matrix is set implicitly.

Examples
var
    a, x, y, expected: Matrix;
begin
    a := [[1.0, 2.0], [3.0, 4.0]];
    x := [[1.0, 2.0], [3.0, 4.0]];
    y := [[5.0, 6.0], [7.0, 8.0]];
    a.AddProduct(x, y);
    expected := [[6.0, 14.0], [24.0, 36.0]];
    if not a.IsEqual(expected, 1e-10, TCompare.cmpAbsolute) then
        raise Exception.Create('Matrix.AddProduct: mismatch');
end;
See Also: Matrix.Mul, Matrix.Add

Indexed: function AddProduct(const Vec1: TMtxVec; const Vec2: TMtxVec; Vec1Index: Integer; Vec2Index: Integer; Index: Integer; Len: Integer): TMtxVec;

Multiply Vec1 elements [Vec1Index]..[Vec1Index+Len-1] with Vec2 elements [Vec2Index]..[Vec2Index+Len-1].

#NameTypeDescription
1Vec1TMtxVec
2Vec2TMtxVec
3Vec1IndexInteger
4Vec2IndexInteger
5IndexIntegerstart index
6LenIntegerelement count

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

Remarks:

Ad the results to the calling object elements [Index]..[Index+Len-1]. An exception is raised if Matrix.ConditionCheck is true and array borders are overrun.