*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> f90/sum (3)              
Title
Content
Arch
Section
 

Contents


SUM(3I)						       Last changed: 1-6-98

NAME    [Toc]    [Back]

     SUM - Sums	array elements

SYNOPSIS    [Toc]    [Back]

     SUM ([ARRAY=]array	[,[DIM=]dim] [,[MASK=]mask])

     SUM ([ARRAY=]array	[,[MASK=]mask])

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     The SUM intrinsic function	sums all the elements of array along
     dimension dim that	correspond to the true elements	of mask.  It
     accepts the following arguments:

     array     Must be of type integer,	real, or complex.  It must not be
	       scalar.

     dim       Must be scalar and of type integer with a value in the range
	       1 <= dim	<= n, where n is the rank of array.  The
	       corresponding actual argument must not be an optional dummy
	       argument.  This function	does a check on	dim when present.

     mask      Must be of type logical and must	be conformable with array.

     SUM is a transformational intrinsic function.  The	name of	this
     intrinsic cannot be passed	as an argument.

RETURN VALUES    [Toc]    [Back]

     The result	is of the same type and	kind type parameter as array.  It
     is	scalar if dim is absent	or if array has	rank one; otherwise, the
     result is an array	of rank	n-1 and	of shape
     (d	, d , ..., d	 , d	 , ...,	d ),
       1   2	    dim-1   dim+1	 n
     where (d ,	d , ..., d )
	     1	 2	  n
     is	the shape of array.

     The result	of SUM(array) has a value equal	to the sum of all the
     elements of array.	 If array has size 0, it has the value 0.

     The result	of SUM(array,MASK=mask)	has a value equal to the sum of	the
     elements of array corresponding to	the true elements of mask.  It has
     the value 0 if there are no true elements.

     If	array has rank one, SUM(array,dim[,mask]) has a	value equal to that
     of	SUM(array[,MASK=mask]).	 Otherwise, the	value of element
     (s	, s , ..., s	 , s	 , ...,	s )
       1   2	    dim-1   dim+1	 n
     of	SUM(array,dim[,mask]) is equal to
     SUM(array(s , s , ..., s	  , : ,	s     ,	..., s )
		1   2	     dim-1	 dim+1	      n
     [,	MASK=mask(s , s	, ..., s     , : , s	 , ...,	s )]).
		   1   2	dim-1	    dim+1	 n

EXAMPLES    [Toc]    [Back]

     Example 1:	 The value of SUM((/ 1,	2, 3 /)) is 6.

     Example 2:	 SUM(C,	MASK= C	.GT. 0.0) forms	the arithmetic sum of the
     positive elements of C.

     Example 3:	 Assume	that B is the following	array:

	| 1 3 5	|
	| 2 4 6	|


     In	this case, the following are true:

     * SUM(B, DIM = 1) is [3, 7, 11]

     * SUM(B, DIM = 2) is [9, 12]

SEE ALSO    [Toc]    [Back]

      
      
     Intrinsic Procedures Reference Manual, publication	SR-2138, for the
     printed version of	this man page.

SUM(3I)						       Last changed: 1-6-98

NAME    [Toc]    [Back]

     SUM - Sums	array elements

SYNOPSIS    [Toc]    [Back]

     SUM ([ARRAY=]array	[,[DIM=]dim] [,[MASK=]mask])

     SUM ([ARRAY=]array	[,[MASK=]mask])

IMPLEMENTATION    [Toc]    [Back]

     UNICOS, UNICOS/mk,	and IRIX systems

STANDARDS    [Toc]    [Back]

     Fortran 90

DESCRIPTION    [Toc]    [Back]

     The SUM intrinsic function	sums all the elements of array along
     dimension dim that	correspond to the true elements	of mask.  It
     accepts the following arguments:

     array     Must be of type integer,	real, or complex.  It must not be
	       scalar.

     dim       Must be scalar and of type integer with a value in the range
	       1 <= dim	<= n, where n is the rank of array.  The
	       corresponding actual argument must not be an optional dummy
	       argument.  This function	does a check on	dim when present.

     mask      Must be of type logical and must	be conformable with array.

     SUM is a transformational intrinsic function.  The	name of	this
     intrinsic cannot be passed	as an argument.

RETURN VALUES    [Toc]    [Back]

     The result	is of the same type and	kind type parameter as array.  It
     is	scalar if dim is absent	or if array has	rank one; otherwise, the
     result is an array	of rank	n-1 and	of shape
     (d	, d , ..., d	 , d	 , ...,	d ),
       1   2	    dim-1   dim+1	 n
     where (d ,	d , ..., d )
	     1	 2	  n
     is	the shape of array.

     The result	of SUM(array) has a value equal	to the sum of all the
     elements of array.	 If array has size 0, it has the value 0.

     The result	of SUM(array,MASK=mask)	has a value equal to the sum of	the
     elements of array corresponding to	the true elements of mask.  It has
     the value 0 if there are no true elements.

     If	array has rank one, SUM(array,dim[,mask]) has a	value equal to that
     of	SUM(array[,MASK=mask]).	 Otherwise, the	value of element
     (s	, s , ..., s	 , s	 , ...,	s )
       1   2	    dim-1   dim+1	 n
     of	SUM(array,dim[,mask]) is equal to
     SUM(array(s , s , ..., s	  , : ,	s     ,	..., s )
		1   2	     dim-1	 dim+1	      n
     [,	MASK=mask(s , s	, ..., s     , : , s	 , ...,	s )]).
		   1   2	dim-1	    dim+1	 n

EXAMPLES    [Toc]    [Back]

     Example 1:	 The value of SUM((/ 1,	2, 3 /)) is 6.

     Example 2:	 SUM(C,	MASK= C	.GT. 0.0) forms	the arithmetic sum of the
     positive elements of C.

     Example 3:	 Assume	that B is the following	array:

	| 1 3 5	|
	| 2 4 6	|


     In	this case, the following are true:

     * SUM(B, DIM = 1) is [3, 7, 11]

     * SUM(B, DIM = 2) is [9, 12]

SEE ALSO    [Toc]    [Back]

      
      
     Intrinsic Procedures Reference Manual, publication	SR-2138, for the
     printed version of	this man page.

[ Back ]
 Similar pages
Name OS Title
glarrayelementext IRIX specify the array elements used to render a vertex
product IRIX Forms the product of array elements
count IRIX Counts the number of true array elements
size IRIX Returns the total number of elements in an array
dlaed4 IRIX rank-one modification to a diagonal matrix whose elements are given in the array d, and that D(i) < D(j) for i
slaed4 IRIX rank-one modification to a diagonal matrix whose elements are given in the array d, and that D(i) < D(j) for i
slaed5 IRIX modification of a 2-by-2 diagonal matrix diag( D ) + RHO The diagonal elements in the array D are assumed to s
dlaed5 IRIX modification of a 2-by-2 diagonal matrix diag( D ) + RHO The diagonal elements in the array D are assumed to s
lreplace IRIX Replace elements in a list with new elements
unpack IRIX Unpacks an array of rank one into an array under control of a mask
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service