SUM

Platform

x64, Win32, .NET

Purpose

To sum the elements of an array.

Class

Transformational function.

Syntax

FUNCTION SUM(ARRAY, DIM [,MASK])
FUNCTION SUM(ARRAY [,MASK])
INTEGER DIM

Description

ARRAY is an array of any type. The result is a scalar or array with the same type as elements of ARRAY. DIM is a scalar integer in the range 1 < DIM < n where n is the rank of ARRAY. MASK is an array of type logical which is conformable with ARRAY. Elements of MASK are set to true when corresponding elements of ARRAY are to be included in the sum.

If DIM is present, summation is along the dimension specified by DIM resulting in an array of rank n - 1. If DIM is absent, the result is a scalar giving the sum of all the elements (for which MASK is true).

Example

If A is then SUM(A, DIM = 1) is [5, 7, 9] and SUM(A, DIM = 2) is [6, 15].

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited