61#include <gtest/gtest.h>
75 EXPECT_EQ(m->
size1, 3);
76 EXPECT_EQ(m->
size2, 4);
77 EXPECT_NE(m->
data,
nullptr);
102 for (
size_t i = 0; i < 2; ++i) {
103 for (
size_t j = 0; j < 2; ++j) {
116 for (
size_t i = 0; i < 2; ++i) {
117 for (
size_t j = 0; j < 2; ++j) {
129 for (
size_t i = 0; i < 3; ++i) {
130 for (
size_t j = 0; j < 3; ++j) {
131 double expected = (i == j) ? 1.0 : 0.0;
141 EXPECT_EQ(v->
size, 5);
142 EXPECT_NE(v->
data,
nullptr);
165 for (
size_t i = 0; i < 4; ++i) {
219 EXPECT_DOUBLE_EQ(
GSL_REAL(result), 1.0);
220 EXPECT_DOUBLE_EQ(
GSL_IMAG(result), 2.0);
223 EXPECT_DOUBLE_EQ(
GSL_REAL(result), 3.0);
224 EXPECT_DOUBLE_EQ(
GSL_IMAG(result), 4.0);
236 EXPECT_DOUBLE_EQ(
GSL_REAL(result), 1.0);
237 EXPECT_DOUBLE_EQ(
GSL_IMAG(result), 2.0);
241 EXPECT_DOUBLE_EQ(
GSL_REAL(result), 2.0);
242 EXPECT_DOUBLE_EQ(
GSL_IMAG(result), 4.0);
gsl_complex gsl_complex_rect(double x, double y)
Construct .
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_vector_free(gsl_vector *v)
Free a vector allocated by gsl_vector_alloc.
void gsl_vector_scale(gsl_vector *v, double x)
Scale a vector in-place.
gsl_vector * gsl_vector_alloc(size_t n)
Allocate a zero-initialized real vector of length .
void gsl_matrix_complex_free(gsl_matrix_complex *m)
Free a matrix allocated by gsl_matrix_complex_alloc.
void gsl_vector_complex_scale(gsl_vector_complex *v, gsl_complex x)
Scale a complex vector in-place.
void gsl_matrix_complex_set(gsl_matrix_complex *m, size_t i, size_t j, gsl_complex x)
Set complex entry .
gsl_complex gsl_vector_complex_get(const gsl_vector_complex *v, size_t i)
Get complex entry .
void gsl_vector_set_all(gsl_vector *v, double x)
Set all entries to x.
double gsl_vector_get(const gsl_vector *v, size_t i)
Get .
gsl_vector_complex * gsl_vector_complex_alloc(size_t n)
Allocate a zero-initialized complex vector of length .
void gsl_matrix_set_all(gsl_matrix *m, double x)
Set all entries to x.
void gsl_matrix_set_identity(gsl_matrix *m)
Set to identity on the main diagonal.
void gsl_vector_complex_set(gsl_vector_complex *v, size_t i, gsl_complex x)
Set complex entry .
void gsl_vector_complex_free(gsl_vector_complex *v)
Free a vector allocated by gsl_vector_complex_alloc.
void gsl_vector_set(gsl_vector *v, size_t i, double x)
Set .
gsl_matrix_complex * gsl_matrix_complex_alloc(size_t n1, size_t n2)
Allocate a zero-initialized complex matrix of size .
void gsl_vector_add(gsl_vector *a, const gsl_vector *b)
Add another vector in-place.
void gsl_matrix_set_zero(gsl_matrix *m)
Set all entries to zero.
TEST_F(GSLMatrixTest, MatrixAllocation)
Complex number stored as .
Dense complex matrix in row-major storage.
Dense real matrix in row-major storage.
Dense complex vector with stride.
Dense real vector with stride.