<< mps_sum mpscilab mps_transpose >>

mpscilab >> mpscilab > mps_trace

mps_trace

Evaluate the trace of a square matrix.

Calling Sequence

mps_trace( rop, op )
rop = mps_trace( op )

Arguments

rop

multi-precision scalar

op

Scilab or multi-precision square matrix

Description

Evaluates the trace of a square matrix op returning the result in rop.

Usage notes

When the input is a multi-precision matrix the trace is evaluated as an accurate sum using the mpfr_sum() function.

Examples

// Standard usage.
A = [ 1 2 3;
      4 5 6;
      7 8 9 ]
mpsA = mps_init2(A,100)
rop = mps_trace(mpsA)

See Also

<< mps_sum mpscilab mps_transpose >>