OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
TestGSLMatrix.cpp File Reference

Unit tests for GSL matrix and vector operations. More...

#include <gtest/gtest.h>
#include <cmath>
#include "Utilities/GSLComplex.h"
#include "Utilities/GSLMatrix.h"
Include dependency graph for TestGSLMatrix.cpp:

Go to the source code of this file.

Classes

class  GSLMatrixTest
 

Functions

 TEST_F (GSLMatrixTest, MatrixAllocation)
 
 TEST_F (GSLMatrixTest, MatrixSetGet)
 
 TEST_F (GSLMatrixTest, MatrixSetAll)
 
 TEST_F (GSLMatrixTest, MatrixSetZero)
 
 TEST_F (GSLMatrixTest, MatrixSetIdentity)
 
 TEST_F (GSLMatrixTest, VectorAllocation)
 
 TEST_F (GSLMatrixTest, VectorSetGet)
 
 TEST_F (GSLMatrixTest, VectorSetAll)
 
 TEST_F (GSLMatrixTest, VectorScale)
 
 TEST_F (GSLMatrixTest, VectorAdd)
 
 TEST_F (GSLMatrixTest, ComplexMatrix)
 
 TEST_F (GSLMatrixTest, ComplexVector)
 

Detailed Description

Unit tests for GSL matrix and vector operations.

This file contains unit tests for GSL-compatible matrix and vector data structures and operations. The implementation provides wrappers around standard containers with GSL-compatible APIs.

Test:
GSLMatrixTest::MatrixAllocation Tests matrix memory allocation and deallocation. Verifies that matrices are correctly allocated with specified dimensions and that memory is properly managed.
Test:
GSLMatrixTest::MatrixSetGet Tests setting and getting individual matrix elements. Verifies that values can be stored and retrieved correctly using row and column indices.
Test:
GSLMatrixTest::MatrixSetAll Tests setting all matrix elements to a constant value. Verifies that gsl_matrix_set_all() correctly initializes all elements.
Test:
GSLMatrixTest::MatrixSetZero Tests zeroing a matrix. Verifies that gsl_matrix_set_zero() sets all elements to zero, even if the matrix was previously initialized with non-zero values.
Test:
GSLMatrixTest::MatrixSetIdentity Tests creating an identity matrix. Verifies that gsl_matrix_set_identity() sets diagonal elements to 1 and off-diagonal elements to 0.
Test:
GSLMatrixTest::VectorAllocation Tests vector memory allocation and deallocation. Verifies correct initialization of vector size and data pointer.
Test:
GSLMatrixTest::VectorSetGet Tests setting and getting individual vector elements. Verifies that values can be stored and retrieved correctly using element indices.
Test:
GSLMatrixTest::VectorSetAll Tests setting all vector elements to a constant value. Verifies uniform initialization of all elements.
Test:
GSLMatrixTest::VectorScale Tests vector scaling operation: \(\mathbf{v} \leftarrow \alpha \mathbf{v}\). Verifies that all elements are multiplied by the scaling factor.
Test:
GSLMatrixTest::VectorAdd Tests vector addition: \(\mathbf{v}_1 \leftarrow \mathbf{v}_1 + \mathbf{v}_2\). Verifies element-wise addition of two vectors.
Test:
GSLMatrixTest::ComplexMatrix Tests complex matrix operations. Verifies that complex matrices can be allocated, elements can be set and retrieved, and complex number operations work correctly.
Test:
GSLMatrixTest::ComplexVector Tests complex vector operations including scaling with complex scalars. Verifies that complex vectors can be manipulated correctly.

Definition in file TestGSLMatrix.cpp.

Function Documentation

◆ TEST_F() [1/12]

TEST_F ( GSLMatrixTest  ,
ComplexMatrix   
)

Definition at line 209 of file TestGSLMatrix.cpp.

References gsl_complex_rect(), GSL_IMAG, gsl_matrix_complex_alloc(), gsl_matrix_complex_free(), gsl_matrix_complex_get(), gsl_matrix_complex_set(), and GSL_REAL.

Here is the call graph for this function:

◆ TEST_F() [2/12]

TEST_F ( GSLMatrixTest  ,
ComplexVector   
)

◆ TEST_F() [3/12]

TEST_F ( GSLMatrixTest  ,
MatrixAllocation   
)

Definition at line 73 of file TestGSLMatrix.cpp.

References gsl_matrix::data, gsl_matrix_alloc(), gsl_matrix_free(), gsl_matrix::size1, and gsl_matrix::size2.

Here is the call graph for this function:

◆ TEST_F() [4/12]

TEST_F ( GSLMatrixTest  ,
MatrixSetAll   
)

Definition at line 98 of file TestGSLMatrix.cpp.

References gsl_matrix_alloc(), gsl_matrix_free(), gsl_matrix_get(), and gsl_matrix_set_all().

Here is the call graph for this function:

◆ TEST_F() [5/12]

TEST_F ( GSLMatrixTest  ,
MatrixSetGet   
)

Definition at line 82 of file TestGSLMatrix.cpp.

References gsl_matrix_alloc(), gsl_matrix_free(), gsl_matrix_get(), and gsl_matrix_set().

Here is the call graph for this function:

◆ TEST_F() [6/12]

TEST_F ( GSLMatrixTest  ,
MatrixSetIdentity   
)

Definition at line 125 of file TestGSLMatrix.cpp.

References gsl_matrix_alloc(), gsl_matrix_free(), gsl_matrix_get(), and gsl_matrix_set_identity().

Here is the call graph for this function:

◆ TEST_F() [7/12]

TEST_F ( GSLMatrixTest  ,
MatrixSetZero   
)

Definition at line 111 of file TestGSLMatrix.cpp.

References gsl_matrix_alloc(), gsl_matrix_free(), gsl_matrix_get(), gsl_matrix_set_all(), and gsl_matrix_set_zero().

Here is the call graph for this function:

◆ TEST_F() [8/12]

TEST_F ( GSLMatrixTest  ,
VectorAdd   
)

Definition at line 187 of file TestGSLMatrix.cpp.

References gsl_vector_add(), gsl_vector_alloc(), gsl_vector_free(), gsl_vector_get(), and gsl_vector_set().

Here is the call graph for this function:

◆ TEST_F() [9/12]

TEST_F ( GSLMatrixTest  ,
VectorAllocation   
)

Definition at line 139 of file TestGSLMatrix.cpp.

References gsl_vector::data, gsl_vector_alloc(), gsl_vector_free(), and gsl_vector::size.

Here is the call graph for this function:

◆ TEST_F() [10/12]

TEST_F ( GSLMatrixTest  ,
VectorScale   
)

Definition at line 172 of file TestGSLMatrix.cpp.

References gsl_vector_alloc(), gsl_vector_free(), gsl_vector_get(), gsl_vector_scale(), and gsl_vector_set().

Here is the call graph for this function:

◆ TEST_F() [11/12]

TEST_F ( GSLMatrixTest  ,
VectorSetAll   
)

Definition at line 161 of file TestGSLMatrix.cpp.

References gsl_vector_alloc(), gsl_vector_free(), gsl_vector_get(), and gsl_vector_set_all().

Here is the call graph for this function:

◆ TEST_F() [12/12]

TEST_F ( GSLMatrixTest  ,
VectorSetGet   
)

Definition at line 147 of file TestGSLMatrix.cpp.

References gsl_vector_alloc(), gsl_vector_free(), gsl_vector_get(), and gsl_vector_set().

Here is the call graph for this function: