CMatrix:Volume


The Volume method returns the sum of all matrix values.

Syntax

nVolume = CMatrix:Volume()

where

    nVolume is the "volume" or sum of all values in the matrix.

  

This method computes the sum of all CMatrix elements. If the matrix elements was cponsidered to be a grid of height values, then the sum of all members would be the volume under the matrix.

Example

The following script computes the volume of the CMatrix:

M = CMatrix:new()

-- create a CMatrix

M:Init( 5, 7, 1 )

-- setup a 5 x 7 matrix

Printf("Vol = %lg", M:Volume() )

-- result: Vol = 35

Related Topics

Init

Normalize

CMatrix class

TNorm function