Blender  V3.3
Classes | Typedefs | Functions
math_statistics.c File Reference
#include "MEM_guardedalloc.h"
#include "BLI_math.h"
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BLI_strict_flags.h"

Go to the source code of this file.

Classes

struct  CovarianceData
 

Typedefs

typedef struct CovarianceData CovarianceData
 

Functions

static void covariance_m_vn_ex_task_cb (void *__restrict userdata, const int a, const TaskParallelTLS *__restrict UNUSED(tls))
 
void BLI_covariance_m_vn_ex (const int n, const float *cos_vn, const int cos_vn_num, const float *center, const bool use_sample_correction, float *r_covmat)
 Compute the covariance matrix of given set of nD coordinates. More...
 
void BLI_covariance_m3_v3n (const float(*cos_v3)[3], const int cos_v3_num, const bool use_sample_correction, float r_covmat[3][3], float r_center[3])
 Compute the covariance matrix of given set of 3D coordinates. More...
 

Typedef Documentation

◆ CovarianceData

Function Documentation

◆ BLI_covariance_m3_v3n()

void BLI_covariance_m3_v3n ( const float(*)  cos_v3[3],
int  cos_v3_num,
bool  use_sample_correction,
float  r_covmat[3][3],
float  r_center[3] 
)

Compute the covariance matrix of given set of 3D coordinates.

Parameters
cos_v3the 3D points to compute covariance from.
cos_v3_numthe number of 3D coordinates in cos_v3.
Returns
r_covmat the computed covariance matrix.
r_center the computed center (mean) of 3D points (may be NULL).

Definition at line 103 of file math_statistics.c.

References BLI_covariance_m_vn_ex(), center, copy_v3_v3(), float(), madd_v3_v3fl(), and zero_v3().

Referenced by mesh_calc_eigen_matrix().

◆ BLI_covariance_m_vn_ex()

void BLI_covariance_m_vn_ex ( int  n,
const float cos_vn,
int  cos_vn_num,
const float center,
bool  use_sample_correction,
float r_covmat 
)

Compute the covariance matrix of given set of nD coordinates.

Parameters
nthe dimension of the vectors (and hence, of the covariance matrix to compute).
cos_vnthe nD points to compute covariance from.
cos_vn_numthe number of nD coordinates in cos_vn.
centerthe center (or mean point) of cos_vn. If NULL, it is assumed cos_vn is already centered.
use_sample_correctionwhether to apply sample correction (i.e. get 'sample variance' instead of 'population variance').
Returns
r_covmat the computed covariance matrix.

Definition at line 74 of file math_statistics.c.

References BLI_parallel_range_settings_defaults(), BLI_task_parallel_range(), center, covariance_m_vn_ex_task_cb(), data, float(), and TaskParallelSettings::use_threading.

Referenced by BLI_covariance_m3_v3n().

◆ covariance_m_vn_ex_task_cb()

static void covariance_m_vn_ex_task_cb ( void *__restrict  userdata,
const int  a,
const TaskParallelTLS *__restrict   UNUSEDtls 
)
static

Definition at line 27 of file math_statistics.c.

References Freestyle::a, center, and data.

Referenced by BLI_covariance_m_vn_ex().