|
Last change
on this file since 2c69a9 was e651e7, checked in by Frederik Heber <heber@…>, 16 years ago |
|
Wrapper class for gsl_matrix along with working Unit test.
- new class GSLMatrix wraps all useful functions of the GSL library.
- new unit tests GSLMatrixSymmetricUnitTest (symmetric case) and GSLMatrixUnitTest tests each part and is working.
Signed-off-by: Frederik Heber <heber@…>
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * gslmatrix.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 8, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef GSLMATRIX_HPP_
|
|---|
| 9 | #define GSLMATRIX_HPP_
|
|---|
| 10 |
|
|---|
| 11 | using namespace std;
|
|---|
| 12 |
|
|---|
| 13 | /*********************************************** includes ***********************************/
|
|---|
| 14 |
|
|---|
| 15 | #include <gsl/gsl_matrix.h>
|
|---|
| 16 |
|
|---|
| 17 | /****************************************** forward declarations *****************************/
|
|---|
| 18 |
|
|---|
| 19 | class GSLMatrix;
|
|---|
| 20 |
|
|---|
| 21 | /********************************************** declarations *******************************/
|
|---|
| 22 |
|
|---|
| 23 | class GSLMatrix {
|
|---|
| 24 | friend class LinearSystemOfEquations;
|
|---|
| 25 |
|
|---|
| 26 | public:
|
|---|
| 27 | GSLMatrix(size_t m, size_t n);
|
|---|
| 28 | GSLMatrix(const GSLMatrix * const src);
|
|---|
| 29 | ~GSLMatrix();
|
|---|
| 30 |
|
|---|
| 31 | // Accessing
|
|---|
| 32 | void SetFromDoubleArray(double * x);
|
|---|
| 33 | double Get(size_t m, size_t n);
|
|---|
| 34 | void Set(size_t m, size_t n, double x);
|
|---|
| 35 | double *Pointer(size_t m, size_t n);
|
|---|
| 36 | const double *const_Pointer(size_t m, size_t n);
|
|---|
| 37 |
|
|---|
| 38 | // Initializing
|
|---|
| 39 | void SetAll(double x);
|
|---|
| 40 | void SetZero();
|
|---|
| 41 | void SetIdentity();
|
|---|
| 42 |
|
|---|
| 43 | // Exchanging elements
|
|---|
| 44 | bool SwapRows(size_t i, size_t j);
|
|---|
| 45 | bool SwapColumns(size_t i, size_t j);
|
|---|
| 46 | bool SwapRowColumn(size_t i, size_t j);
|
|---|
| 47 | bool Transpose();
|
|---|
| 48 | bool IsNull();
|
|---|
| 49 | bool IsPositive();
|
|---|
| 50 | bool IsNegative();
|
|---|
| 51 | bool IsNonNegative();
|
|---|
| 52 | bool IsPositiveDefinite();
|
|---|
| 53 |
|
|---|
| 54 | GSLMatrix& operator=(const GSLMatrix& rhs);
|
|---|
| 55 |
|
|---|
| 56 | private:
|
|---|
| 57 | gsl_matrix *matrix;
|
|---|
| 58 |
|
|---|
| 59 | size_t rows;
|
|---|
| 60 | size_t columns;
|
|---|
| 61 | };
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | #endif /* GSLMATRIX_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.