Matrix::TensorProd Method

TMtx *TensorProd(TVec *MtxCol, TVec *MtxRow) const;

Calculates the tensor product of two vectors.

#NameTypeDescription
1MtxColTVec *
2MtxRowTVec *
Remarks:

Calculates the tensor product of mtxCol and mtxRow vectors and stores the results in the calling matrix. The Matrix::Rows property is set to mtxCol.TMtxVecBase::Length and Matrix::Cols property is set to mtxRow.TMtxVecBase::Length. The TMtxVec::Complex property of the calling matrix is adjusted automatically.

Examples
#include "MtxVec.h"
#include "Units.MtxVec.h"

using namespace Dew;
using namespace Dew::Math;
using namespace Dew::Math::Units::MtxVec;

void Example()
{
    TVec *mtxCol, *mtxRow;
    TMtx* V;

    CreateIt(mtxCol, mtxRow);
    CreateIt(V);
    mtxCol->Size(3);
    mtxCol->SetIt(false, DewArray<double>{0, 2, 3});
    mtxRow->Copy(mtxCol);
    V->TensorProd(mtxCol, mtxRow);
    // V becomes:
    // [0,0,0]
    // [0,4,6]
    // [0,6,9]
    FreeIt(mtxCol, mtxRow);
    FreeIt(V);
}
See Also: Matrix::AddTensorProd
Declared in Dew::Math::Matrix · Dew.Math/MtxExpr.h · Cross-compiler