typedef enum _vsip_mat_uplo { VSIP_TR_LOW = 0, // Lower triangular VSIP_TR_UPP = 1 // Upper triangular } vsip_mat_uplo; vsip_chol_f* vsip_chold_create_f(vsip_mat_uplo uplo, vsip_length n); vsip_cchol_f* vsip_cchold_create_f(vsip_mat_uplo uplo, vsip_length n);
This function creates a Cholesky decomposition object for a symmetric positive definite matrix of size
. The Cholesky
decomposition expresses a matrix
as the product of a lower triangular matrix
and its transpose:
(when uplo =
VSIP_MAT_LOWER) or
(when uplo = VSIP_MAT_UPPER).
vsip_mat_uplo uplo: Specifies whether to store the upper (VSIP_MAT_UPP) or lower (VSIP_MAT_LOW) triangle of the matrix.
vsip_length n: The dimension of the square matrix (
).
On success: Pointer to the newly created Cholesky decomposition object
On error (e.g., memory allocation failure): NULL
vsip_chol_f *chold; vsip_length n = 100; // Create Cholesky decomposition object for lower triangle chold = vsip_chold_create_f(VSIP_MAT_LOW, n); if (chold == NULL) { fprintf(stderr, "Error: Could not create Cholesky object\n"); return -1; }
The matrix must be symmetric and positive definite, otherwise the decomposition will fail.
The object should be freed with vsip_dchold_destroy_p when no longer needed.