41#include <gtest/gtest.h>
71 EXPECT_NEAR(
GSL_REAL(e1), 1.0, 1e-6);
72 EXPECT_NEAR(
GSL_IMAG(e1), 0.0, 1e-6);
73 EXPECT_NEAR(
GSL_REAL(e2), 1.0, 1e-6);
74 EXPECT_NEAR(
GSL_IMAG(e2), 0.0, 1e-6);
96 std::vector<double> eigenvalues(3);
97 for (
size_t i = 0; i < 3; ++i) {
102 std::sort(eigenvalues.begin(), eigenvalues.end());
103 EXPECT_NEAR(eigenvalues[0], 2.0, 1e-6);
104 EXPECT_NEAR(eigenvalues[1], 3.0, 1e-6);
105 EXPECT_NEAR(eigenvalues[2], 4.0, 1e-6);
121 EXPECT_EQ(result, 0);
127 EXPECT_NEAR(
GSL_REAL(e1), 1.0, 1e-6);
128 EXPECT_NEAR(
GSL_IMAG(e1), 0.0, 1e-6);
129 EXPECT_NEAR(
GSL_REAL(e2), 1.0, 1e-6);
130 EXPECT_NEAR(
GSL_IMAG(e2), 0.0, 1e-6);
150 EXPECT_EQ(result, 0);
153 std::vector<double> eigenvalues(2);
154 for (
size_t i = 0; i < 2; ++i) {
159 std::sort(eigenvalues.begin(), eigenvalues.end());
160 EXPECT_NEAR(eigenvalues[0], 2.0, 1e-6);
161 EXPECT_NEAR(eigenvalues[1], 3.0, 1e-6);
175 EXPECT_NE(result, 0);
184 EXPECT_NE(w1,
nullptr);
189 EXPECT_NE(w2,
nullptr);
void gsl_eigen_nonsymmv_free(gsl_eigen_nonsymmv_workspace *w)
Free a workspace allocated by gsl_eigen_nonsymmv_alloc.
int gsl_eigen_nonsymm(gsl_matrix *A, gsl_vector_complex *eval, gsl_eigen_nonsymm_workspace *)
Compute eigenvalues of a real nonsymmetric matrix.
int gsl_eigen_nonsymmv(gsl_matrix *A, gsl_vector_complex *eval, gsl_matrix_complex *evec, gsl_eigen_nonsymmv_workspace *w)
Compute eigenvalues and a simplified set of eigenvectors.
gsl_eigen_nonsymm_workspace * gsl_eigen_nonsymm_alloc(size_t n)
Allocate a nonsymmetric eigenvalue workspace for matrices.
void gsl_eigen_nonsymm_free(gsl_eigen_nonsymm_workspace *w)
Free a workspace allocated by gsl_eigen_nonsymm_alloc.
gsl_eigen_nonsymmv_workspace * gsl_eigen_nonsymmv_alloc(size_t n)
Allocate a nonsymmetric eigenvalue/vector workspace for matrices.
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 .
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.
gsl_complex gsl_vector_complex_get(const gsl_vector_complex *v, size_t i)
Get complex entry .
gsl_vector_complex * gsl_vector_complex_alloc(size_t n)
Allocate a zero-initialized complex vector of length .
void gsl_matrix_set_identity(gsl_matrix *m)
Set to identity on the main diagonal.
void gsl_vector_complex_free(gsl_vector_complex *v)
Free a vector allocated by gsl_vector_complex_alloc.
gsl_matrix_complex * gsl_matrix_complex_alloc(size_t n1, size_t n2)
Allocate a zero-initialized complex matrix of size .
void gsl_matrix_set_zero(gsl_matrix *m)
Set all entries to zero.
TEST_F(GSLEigenTest, EigenNonsymm_Identity)
Complex number stored as .
Workspace for nonsymmetric eigenvalue computation.
Workspace for nonsymmetric eigenvalues/eigenvectors.
Dense complex matrix in row-major storage.
Dense real matrix in row-major storage.
Dense complex vector with stride.