Cleanup: Subdiv: Remove common_ prefix
[blender.git] / source / blender / blenlib / BLI_math_statistics.h
blobeb4a7bb94cc38d08d849365dadcea5bdadafdb66
1 /* SPDX-FileCopyrightText: 2015 Blender Authors
3 * SPDX-License-Identifier: GPL-2.0-or-later */
5 #pragma once
7 /** \file
8 * \ingroup bli
9 */
11 #include "BLI_math_inline.h"
12 #include "BLI_sys_types.h"
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
18 #ifdef BLI_MATH_GCC_WARN_PRAGMA
19 # pragma GCC diagnostic push
20 # pragma GCC diagnostic ignored "-Wredundant-decls"
21 #endif
23 /* -------------------------------------------------------------------- */
24 /** \name Covariance Matrices
25 * \{ */
27 /**
28 * \brief Compute the covariance matrix of given set of nD coordinates.
30 * \param n: the dimension of the vectors (and hence, of the covariance matrix to compute).
31 * \param cos_vn: the nD points to compute covariance from.
32 * \param cos_vn_num: the number of nD coordinates in cos_vn.
33 * \param center: the center (or mean point) of cos_vn. If NULL,
34 * it is assumed cos_vn is already centered.
35 * \param use_sample_correction: whether to apply sample correction
36 * (i.e. get 'sample variance' instead of 'population variance').
37 * \return r_covmat the computed covariance matrix.
39 void BLI_covariance_m_vn_ex(int n,
40 const float *cos_vn,
41 int cos_vn_num,
42 const float *center,
43 bool use_sample_correction,
44 float *r_covmat);
45 /**
46 * \brief Compute the covariance matrix of given set of 3D coordinates.
48 * \param cos_v3: the 3D points to compute covariance from.
49 * \param cos_v3_num: the number of 3D coordinates in cos_v3.
50 * \return r_covmat the computed covariance matrix.
51 * \return r_center the computed center (mean) of 3D points (may be NULL).
53 void BLI_covariance_m3_v3n(const float (*cos_v3)[3],
54 int cos_v3_num,
55 bool use_sample_correction,
56 float r_covmat[3][3],
57 float r_center[3]);
59 #ifdef BLI_MATH_GCC_WARN_PRAGMA
60 # pragma GCC diagnostic pop
61 #endif
63 /** \} */
65 #ifdef __cplusplus
67 #endif