48 const float *cos_vn =
data->cos_vn;
50 float *r_covmat =
data->r_covmat;
51 const int n =
data->n;
52 const int nbr_cos_vn =
data->nbr_cos_vn;
74 for (k = 0; k < nbr_cos_vn; k++) {
75 r_covmat[
a] += (cos_vn[k * n + i] -
center[i]) * (cos_vn[k * n + j] -
center[j]);
79 for (k = 0; k < nbr_cos_vn; k++) {
80 r_covmat[
a] += cos_vn[k * n + i] * cos_vn[k * n + j];
83 r_covmat[
a] *=
data->covfac;
86 r_covmat[j * n + i] = r_covmat[
a];
104 const int nbr_cos_vn,
106 const bool use_sample_correction,
112 const float covfac = 1.0f / (
float)(use_sample_correction ? nbr_cos_vn - 1 : nbr_cos_vn);
114 memset(r_covmat, 0,
sizeof(*r_covmat) * (
size_t)(n * n));
119 .r_covmat = r_covmat,
122 .nbr_cos_vn = nbr_cos_vn,
140 const int nbr_cos_v3,
141 const bool use_sample_correction,
142 float r_covmat[3][3],
146 const float mean_fac = 1.0f / (
float)nbr_cos_v3;
150 for (i = 0; i < nbr_cos_v3; i++) {
160 3, (
const float *)cos_v3, nbr_cos_v3,
center, use_sample_correction, (
float *)r_covmat);
typedef float(TangentPoint)[2]
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void zero_v3(float r[3])
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
void BLI_task_parallel_range(const int start, const int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
NSNotificationCenter * center
Read Guarded memory(de)allocation.
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 nbr_cos_vn, const float *center, const bool use_sample_correction, float *r_covmat)
Compute the covariance matrix of given set of nD coordinates.
struct CovarianceData CovarianceData
void BLI_covariance_m3_v3n(const float(*cos_v3)[3], const int nbr_cos_v3, const bool use_sample_correction, float r_covmat[3][3], float r_center[3])
Compute the covariance matrix of given set of 3D coordinates.