【发布时间】:2022-07-29 14:42:15
【问题描述】:
我一直在使用 GSL 来支持使用 C 进行的一些矩阵操作。不过,我在使用其 Cholesky 分解函数时遇到了挑战,至少可以说 GSL 参考手册中的文档很少。如何获得函数的下三角矩阵输出?
下面是我目前的代码...
# include <gsl/gsl_matrix.h>
# include <gsl/gsl_linalg.h>
#define rows 6
#define cols 6
double cov[rows*cols] = {107.3461, 12.0710, -48.3746, 174.7796, 21.0202, -80.6075,
12.0710, 8.0304, -5.9610, 20.2434, 2.2427, -9.312,
-48.3746, -5.9610, 25.2222, -78.6277, -9.4400, 36.1789,
174.7796, 20.2434, -78.6277, 291.3491, 35.0176, -134.3626,
21.0202, 2.2427, -9.4400, 35.0176, 4.2144, -16.1499,
-80.6075, -9.3129, 36.1789, -134.3626, -16.1499, 61.9666};
gsl_matrix_view m = gsl_matrix_view_array(cov, rows, cols);
int gsl_linalg_cholesky_decomp1(gsl_matrix *m)
... don't know what to do after this step
我知道手动计算的公式,但我更愿意利用这个库。
在这方面的任何帮助将不胜感激。
【问题讨论】:
-
GSL LU Decomp Example 似乎是正确的。