45#include <gtest/gtest.h>
99 EXPECT_NEAR(det, -2.0, 1e-10);
145 for (
size_t i = 0; i < 3; ++i) {
146 for (
size_t j = 0; j < 3; ++j) {
147 double expected = (i == j) ? 1.0 : 0.0;
171 EXPECT_EQ(result, 0);
194 EXPECT_NEAR(
GSL_REAL(det), 1.0, 1e-10);
195 EXPECT_NEAR(
GSL_IMAG(det), 0.0, 1e-10);
221 EXPECT_NEAR(
GSL_REAL(result), 1.0, 1e-10);
222 EXPECT_NEAR(
GSL_IMAG(result), 0.0, 1e-10);
gsl_complex gsl_complex_rect(double x, double y)
Construct .
int gsl_linalg_LU_decomp_complex(gsl_matrix_complex *A, gsl_permutation *p, int *signum)
Alias for gsl_linalg_complex_LU_decomp.
int gsl_linalg_LU_invert_complex(const gsl_matrix_complex *LU, const gsl_permutation *p, gsl_matrix_complex *inverse)
Alias for gsl_linalg_complex_LU_invert.
void gsl_permutation_free(gsl_permutation *p)
Free a permutation allocated by gsl_permutation_alloc.
int gsl_linalg_LU_invert(const gsl_matrix *LU, const gsl_permutation *p, gsl_matrix *inverse)
Invert a matrix from its LU decomposition (real).
gsl_permutation * gsl_permutation_alloc(size_t n)
Allocate an identity permutation of size .
gsl_complex gsl_linalg_LU_det_complex(const gsl_matrix_complex *LU, int signum)
Alias for gsl_linalg_complex_LU_det.
double gsl_linalg_LU_det(const gsl_matrix *LU, int signum)
Determinant from LU decomposition (real).
int gsl_linalg_LU_decomp(gsl_matrix *A, gsl_permutation *p, int *signum)
In-place LU decomposition with partial pivoting (real).
gsl_matrix * gsl_matrix_alloc(size_t n1, size_t n2)
Allocate a zero-initialized real matrix of size .
void gsl_matrix_set(gsl_matrix *m, size_t i, size_t j, double x)
Set .
double gsl_matrix_get(const gsl_matrix *m, size_t i, size_t j)
Get .
gsl_complex gsl_matrix_complex_get(const gsl_matrix_complex *m, size_t i, size_t j)
Get complex entry .
void gsl_matrix_free(gsl_matrix *m)
Free a matrix allocated by gsl_matrix_alloc.
void gsl_matrix_complex_free(gsl_matrix_complex *m)
Free a matrix allocated by gsl_matrix_complex_alloc.
void gsl_matrix_complex_set(gsl_matrix_complex *m, size_t i, size_t j, gsl_complex x)
Set complex entry .
void gsl_matrix_set_identity(gsl_matrix *m)
Set to identity on the main diagonal.
gsl_matrix_complex * gsl_matrix_complex_alloc(size_t n1, size_t n2)
Allocate a zero-initialized complex matrix of size .
TEST_F(GSLLinalgTest, LUDecomp)
Complex number stored as .
Dense complex matrix in row-major storage.
Dense real matrix in row-major storage.
Permutation vector for LU decomposition.