MF_centerOfGravityIndMD_centerOfGravityIndME_centerOfGravityInd
FunctionCenter of gravity of a matrix with respect to the element indizes
Syntax C/C++#include <MFstd.h>
fComplex MF_centerOfGravityInd( fMatrix MA, ui ht, ui len );
C++ VecObj#include <OptiVec.h>
complex<T> matrix<T>::centerOfGravityInd();
Pascal/Delphiuses MFstd;
function MF_centerOfGravityInd( MA:fMatrix; ht, len:UIntSize ): fComplex

Alternative syntax for the complex types (obsolete, but still supported):
procedure MF_centerOfGravityInd( var COG:fComplex; MA:fMatrix; ht, len:UIntSize );
CUDA function C/C++#include <cudaMFstd.h>
int cudaMF_centerOfGravityInd( fComplex *h_RetVal, fMatrix d_MA, ui ht, ui len );
int cusdMF_centerOfGravityInd( fComplex *d_RetVal, fMatrix d_MA, ui ht, ui len );
fComplex MFcu_centerOfGravityInd( fMatrix h_MA, ui ht, ui len );
CUDA function Pascal/Delphiuses MFstd;
function cudaMF_centerOfGravityInd( var h_RetVal:fComplex; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function cusdMF_centerOfGravityInd( d_RetVal:PfComplex; d_MA:fMatrix; ht, len:UIntSize ): IntBool;
function MFcu_centerOfGravityInd( h_MA:fMatrix; ht, len:UIntSize ): fComplex

Alternative syntax:
procedure MFcu_centerOfGravityInd( var h_RetVal:fComplex; h_MA:fMatrix; ht, len:UIntSize );
DescriptionThe center of gravity of the matrix MA is determined. It is assumend that the values of MA represent point masses situated at the positions given by the element indices. The center of gravity is returned as a complex number whose real part contains the X coordinate and whose imaginary part contains the Y coordinate. Please note that this ordering of the coordinates is different from the ordering of matrix element indices (where the first index gives the i-th row, in other words, the Y coordinate). If all elements of MA are 0, there is no mass and, strictly speaking, no center of gravity. In this case, the center of gravity is assumed as the geometrical center of MA, i.e. as ( (len-1) / 2; ( (ht-1) / 2; ).
In order to calculate the center of gravity of an MZ matrix over explicitly given X-Y coordinates, call MF_centerOfGravityV.
Return value(Interpolated) coordinates of the center of gravity
See alsoMF_centerOfGravityV

MatrixLib Table of Contents  OptiVec home