|
Last change
on this file since 247d49 was 247d49, checked in by Frederik Heber <heber@…>, 16 years ago |
|
Wrapper class for gsl_linalg along with working Unit test.
Signed-off-by: Frederik Heber <heber@…>
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * linearsystemofequations.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 8, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | using namespace std;
|
|---|
| 9 |
|
|---|
| 10 | /*********************************************** includes ***********************************/
|
|---|
| 11 |
|
|---|
| 12 | #include <gsl/gsl_linalg.h>
|
|---|
| 13 |
|
|---|
| 14 | /****************************************** forward declarations *****************************/
|
|---|
| 15 |
|
|---|
| 16 | class Vector;
|
|---|
| 17 | class GSLMatrix;
|
|---|
| 18 | class GSLVector;
|
|---|
| 19 |
|
|---|
| 20 | /********************************************** declarations *******************************/
|
|---|
| 21 |
|
|---|
| 22 | /** Solver class for a linear system of equations in the form \f$A \cdot x = b\F$.
|
|---|
| 23 | *
|
|---|
| 24 | */
|
|---|
| 25 | class LinearSystemOfEquations {
|
|---|
| 26 | public:
|
|---|
| 27 | LinearSystemOfEquations(int n, int m);
|
|---|
| 28 | ~LinearSystemOfEquations();
|
|---|
| 29 |
|
|---|
| 30 | // setting
|
|---|
| 31 | void Setb(Vector *x);
|
|---|
| 32 | void Setb(double *x);
|
|---|
| 33 | void SetA(double *x);
|
|---|
| 34 | bool SetSymmetric(bool symmetric);
|
|---|
| 35 |
|
|---|
| 36 | // solving
|
|---|
| 37 | bool GetSolutionAsArray(double *&array);
|
|---|
| 38 | bool GetSolutionAsVector(Vector &v);
|
|---|
| 39 |
|
|---|
| 40 | GSLVector *b;
|
|---|
| 41 | GSLVector *x;
|
|---|
| 42 | GSLMatrix *A;
|
|---|
| 43 |
|
|---|
| 44 | private:
|
|---|
| 45 | bool Solve();
|
|---|
| 46 |
|
|---|
| 47 | int rows;
|
|---|
| 48 | int columns;
|
|---|
| 49 |
|
|---|
| 50 | bool IsSymmetric;
|
|---|
| 51 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.