Sum of matrix elements
mps_sum( rop, op [, orientation] ) rop = mps_sum( op [, orientation] )
Overloaded usage:
rop = sum( op [, orientation] )
multi-precision matrix
single character string
single character string
Compute the sum of the elements of matrix op
according to orientation
parameter using the specified
algorithm
. The result is return in rop
which must be of the right size for the specified computation.
Computes the sum of all of the elements of op
along the specified orientation
and returns the
result in rop
. The orientation is specified as
a single character either '*', 'r' and 'c' respectively for row, column
and whole matrix.
Creates a multi-precision matrix of the correct size and with the same precision as
op
containing the result.
Overloaded usage.
// Sum of all the elements of a matrix. A = [1 2; 3 4] mpsA = mps_init2(A,100) rop = mps_init(1,1,100) rop = mps_sum(A) // Column-wise sum of the elements of a matrix. A = [1 2; 3 4] mpsA = mps_init2(A,100) rop = mps_init(1,2,100) mps_sum(rop,A,'c') // Sum of all the elements of a matrix using the quick algorithm. A = [1 2; 3 4] mpsA = mps_init2(A,100) rop = mps_init(1,1,100) mps_sum(rop,A,'*','q') // Sum of all the elements of a matrix using the overloaded sum() function. A = [1 2; 3 4] mpsA = mps_init2(A,100) rop = sum(A) | ![]() | ![]() |