Scalar functions of a matrix

next - skip - up - start

    int m = A.Nrows();                    // number of rows
    int n = A.Ncols();                    // number of columns
    Real r = A.AsScalar();                // value of 1x1 matrix
    Real ssq = A.SumSquare();             // sum of squares of elements
    Real sav = A.SumAbsoluteValue();      // sum of absolute values
    Real s = A.Sum();                     // sum of values
    Real mav = A.MaximumAbsoluteValue();  // maximum of absolute values
    Real norm = A.Norm1();                // maximum of sum of absolute
                                             values of elements of a column
    Real norm = A.NormInfinity();         // maximum of sum of absolute
                                             values of elements of a row
    Real t = A.Trace();                   // trace
    LogAndSign ld = A.LogDeterminant();   // log of determinant
    bool z = A.IsZero();                  // test all elements zero
    MatrixType mt = A.Type();             // type of matrix
    Real* s = Store();                    // pointer to array of elements
    int l = Storage();                    // length of array of elements
    bool s = A.IsSingular();              // A is a CroutMatrix or
                                             BandLUMatrix
    MatrixBandWidth mbw = A.BandWidth();  // upper and lower bandwidths
A.LogDeterminant() returns a value of type LogAndSign. If ld is of type LogAndSign use
    ld.Value()    to get the value of the determinant
    ld.Sign()     to get the sign of the determinant (values 1, 0, -1)
    ld.LogValue() to get the log of the absolute value.
A.IsZero() returns Boolean value true if the matrix A has all elements equal to 0.0.

IsSingular is defined only for CroutMatrix and BandLUMatrix. It returns true if one of the diagonal elements of the LU decomposition is exactly zero.

MatrixType mt = A.Type() returns the type of a matrix. Use (char*)mt to get a string (UT, LT, Rect, Sym, Diag, Band, UB, LB, Crout, BndLU) showing the type (Vector types are returned as Rect).

MatrixBandWidth has member functions Upper() and Lower() for finding the upper and lower bandwidths (number of diagonals above and below the diagonal, both zero for a diagonal matrix). For non-band matrices -1 is returned for both these values.

The versions Sum(A), SumSquare(A), SumAbsoluteValue(A), MaximumAbsoluteValue(A), Trace(A), LogDeterminant(A), Norm1(A), NormInfinity(A) can be used in place of A.Sum(), A.SumSquare(), A.SumAbsoluteValue(), A.MaximumAbsoluteValue(), A.Trace(), A.LogDeterminant(), A.Norm1(), A.NormInfinity().

next - skip - up - start