2.2.3.9.71 matrixbase::SumRows

Contents

Description

Sum the rows of this matrix placing the result in a vector.

Syntax

int SumRows( vectorbase & vbSum )

Parameters

vbSum
[output] vector containing the summed rows

Return

Returns 0 on success or -1 on failure.

Examples

EX1

void matrixbase_SumRows_ex1()
{
    int rc, ii,jj;
    matrix<double> mat = {
        {-1,  0,  3,  99},
        { 0,  2,  6,   0},
        { 1,  4,  9,   0}
    };
    mat[0][3]=NANUM;
        
    vector vRSum;
    int nRet = mat.SumRows(vRSum);
}

Remark

Sum the rows of this matrix placing the result in a vector. The underlying base type of the vector must not be less than the underlying base type of the matrix.

See Also

SumColumns, SumDiagonals

Header to Include

origin.h