|
Last change
on this file since e6fe8a was 22b47e, checked in by Frederik Heber <heber@…>, 16 years ago |
|
Wrapper class for gsl_vector along with working Unit test.
- new class GSLVector wraps all useful functions of the GSL library.
- new unit test GSLVectorUnitTest tests each part and is working.
Signed-off-by: Frederik Heber <heber@…>
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * gslvector.hpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: Jan 8, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #ifndef GSLVECTOR_HPP_
|
|---|
| 9 | #define GSLVECTOR_HPP_
|
|---|
| 10 |
|
|---|
| 11 | using namespace std;
|
|---|
| 12 |
|
|---|
| 13 | /*********************************************** includes ***********************************/
|
|---|
| 14 |
|
|---|
| 15 | #include <gsl/gsl_vector.h>
|
|---|
| 16 |
|
|---|
| 17 | /****************************************** forward declarations *****************************/
|
|---|
| 18 |
|
|---|
| 19 | class GSLVector;
|
|---|
| 20 |
|
|---|
| 21 | /********************************************** declarations *******************************/
|
|---|
| 22 |
|
|---|
| 23 | class GSLVector {
|
|---|
| 24 | friend class LinearSystemOfEquations;
|
|---|
| 25 |
|
|---|
| 26 | public:
|
|---|
| 27 | GSLVector(size_t m);
|
|---|
| 28 | GSLVector(const GSLVector * const src);
|
|---|
| 29 | ~GSLVector();
|
|---|
| 30 |
|
|---|
| 31 | // Accessing
|
|---|
| 32 | void SetFromDoubleArray(double *x);
|
|---|
| 33 | double Get(size_t m);
|
|---|
| 34 | double Set(size_t m, double x);
|
|---|
| 35 | double *Pointer(size_t m);
|
|---|
| 36 | const double *const_Pointer(size_t m);
|
|---|
| 37 |
|
|---|
| 38 | // Initializing
|
|---|
| 39 | void SetAll(double x);
|
|---|
| 40 | void SetZero();
|
|---|
| 41 | int SetBasis(size_t m);
|
|---|
| 42 |
|
|---|
| 43 | // Exchanging elements
|
|---|
| 44 | int SwapElements(size_t i, size_t j);
|
|---|
| 45 | int Reverse();
|
|---|
| 46 |
|
|---|
| 47 | private:
|
|---|
| 48 | gsl_vector *vector;
|
|---|
| 49 |
|
|---|
| 50 | size_t dimension;
|
|---|
| 51 | };
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 | #endif /* GSLVECTOR_HPP_ */
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.