HP 3000 Manuals

CSUM [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

CSUM 

The CSUM function returns an array that contains the sum of the elements
of each column of an array.  Both arrays must be of the same type.  The
result has the format

     MAT num_array1 = CSUM(num_array2)

where element i of num_array1 is the sum of the elements in column i in
num_array2.  num_array2 is dimensioned (m,n) and num_array1 is
dimensioned (n).  The data type of the resulting array is the same as
that of the argument.

The CSUM function is used in the MAT = statement, with two dimensional
arrays.

Syntax 

CSUM(array)

Parameters 

array            Structured collection of variables of the same type.
                 The structure is determined when the array is declared.
                 This array can be of any type.

Examples 

     10  DIM A(4)
     20  DIM B(3,4)
     .
     .
     .
     80 MAT A = CSUM(B)

IF B is

     8 5 7 3
     0 2 9 1
     4 6 0 5

then A is

     12 13 16 9



MPE/iX 5.0 Documentation