FunctionCenter of gravity of an MZ matrix over explicitly given X and Y axes
Syntax C/C++#include <MFstd.h>
fComplex MF_centerOfGravityV( fVector X, fVector Y, fMatrix MZ, ui ht, ui len );
C++ VecObj#include <OptiVec.h>
complex<T> matrix<T>::centerOfGravityV( const vector<T>& X, const vector<T>& Y );
Pascal/Delphiuses MFstd;
procedure MF_centerOfGravityV( var COG:fComplex; X, Y:fVector; MZ:fMatrix; ht, len:UIntSize );
CUDA function C/C++#include <cudaMFstd.h>
int cudaMF_centerOfGravityV( fComplex *h_RetVal, fVector d_X, fVector d_Y, fMatrix d_MZ, ui ht, ui len );
int cusdMF_centerOfGravityV( fComplex *d_RetVal, fVector d_X, fVector d_Y, fMatrix d_MZ, ui ht, ui len );
fComplex MFcu_centerOfGravityV( fVector h_X, fVector h_Y, fMatrix h_MZ, ui ht, ui len );
CUDA function Pascal/Delphiuses MFstd;
function cudaMF_centerOfGravityV( var h_RetVal:fComplex; d_X, d_Y:fVector; d_MZ:fMatrix; ht, len:UIntSize ): IntBool;
function cusdMF_centerOfGravityV( d_RetVal:PfComplex; d_X, d_Y:fVector; d_MZ:fMatrix; ht, len:UIntSize ): IntBool;
function MFcu_centerOfGravityV( h_X, h_Y:fVector; h_MZ:fMatrix; ht, len:UIntSize ): fComplex

Alternative syntax:
procedure MFcu_centerOfGravityV( var h_RetVal:fComplex; h_X, h_Y:fVector; h_MZ:fMatrix; ht, len:UIntSize );
DescriptionThe center of gravity of the matrix MZ is determined. It is assumend that the values of MZ represent point masses situated at the coordinates specified by the vectors X and Y. 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 ( (X[size-1)] - X[0]) / 2; (X[size-1)] - X[0]) / 2; ).
In order to calculate the center of gravity of an MZ matrix over the element indices, call MF_centerOfGravityInd.
Return value(Interpolated) coordinates of the center of gravity
See alsoMF_centerOfGravityInd

MatrixLib Table of Contents  OptiVec home