Menu

[r147]: / trunk / include / zgsmatrix- / zgsmatrix.hpp  Maximize  Restore  History

Download this file

144 lines (127 with data), 6.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
//=============================================================================
//! Complex Double-precision General Sparse Matrix Class
class zgsmatrix
{
public:
///////////////////////////////////////////////
/////////////////// objects ///////////////////
///////////////////////////////////////////////
long m; //!< matrix row size
long n; //!< matrix column size
std::vector<zcomponent> data; //!< matrix data
std::vector< std::vector<uint32_t> > rows; //!< array of vector to store the entry information of component for each row
std::vector< std::vector<uint32_t> > cols; //!< array of vector to store the entry information of component for each column
///////////////////////////////////////////////
///////////////// constructors ////////////////
///////////////////////////////////////////////
inline zgsmatrix();
inline zgsmatrix(const zgsmatrix&);
inline zgsmatrix(const _zgsmatrix&);
inline zgsmatrix(const long&, const long&, const long=0);
inline zgsmatrix(const char*);
inline ~zgsmatrix(); //destructor
///////////////////////////////////////////////
////////////////// functions //////////////////
///////////////////////////////////////////////
//////// cast ////////
inline _zgematrix to_zgematrix() const;
//////// io ////////
inline comple operator()(const long&, const long&) const;
inline comple& operator()(const long&, const long&);
inline zgsmatrix& put(const long&, const long&, const comple&);
inline zgsmatrix& del(const long, const long); //<-- NOT (const long&)
inline zgsmatrix& del(const long); //<-- NOT (const long&)
inline friend std::ostream& operator<<(std::ostream&, const zgsmatrix&);
inline void write(const char*) const;
inline void read(const char*);
//////// misc ////////
inline void clear();
inline zgsmatrix& zero();
inline void chsign();
inline void copy(const zgsmatrix&);
inline void shallow_copy(const _zgsmatrix&);
inline zgsmatrix& resize(const long&, const long&, const long=0, const long=0);
inline void stretch(const long&, const long&);
inline void expand(const long&);
inline bool isListed(const long&, const long&);
inline long number(const long&, const long&);
inline void checkup();
inline void diet(const double=DBL_MIN);
inline _zrovector row(const long&) const;
inline _zcovector col(const long&) const;
inline friend void swap(zgsmatrix&, zgsmatrix&);
inline friend _zgsmatrix _(zgsmatrix&);
//////// calc ////////
inline friend _zgsmatrix t(const zgsmatrix&);
////inline friend _zgematrix i(const zgsmatrix&);
inline friend _zgsmatrix conj(const zgsmatrix&);
inline friend _zgsmatrix conjt(const zgsmatrix&);
inline friend void idamax(long&, long&, const zgsmatrix&);
inline friend comple damax(const zgsmatrix&);
///////////////////////////////////////////////
///////////// numerical operators /////////////
///////////////////////////////////////////////
//////// = ////////
inline zgsmatrix& operator=(const zgsmatrix&);
inline zgsmatrix& operator=(const _zgsmatrix&);
//////// += ////////
inline zgsmatrix& operator+=(const zgsmatrix&);
inline zgsmatrix& operator+=(const _zgsmatrix&);
//////// -= ////////
inline zgsmatrix& operator-=(const zgsmatrix&);
inline zgsmatrix& operator-=(const _zgsmatrix&);
//////// *= ////////
inline zgsmatrix& operator*=(const zgsmatrix&);
inline zgsmatrix& operator*=(const _zgsmatrix&);
inline zgsmatrix& operator*=(const double&);
inline zgsmatrix& operator*=(const comple&);
//////// /= ////////
inline zgsmatrix& operator/=(const double&);
inline zgsmatrix& operator/=(const comple&);
//////// unary ////////
inline friend const zgsmatrix& operator+(const zgsmatrix&);
inline friend _zgsmatrix operator-(const zgsmatrix&);
//////// + ////////
inline friend _zgematrix operator+(const zgsmatrix&, const zgematrix&);
inline friend _zgematrix operator+(const zgsmatrix&, const _zgematrix&);
inline friend _zgematrix operator+(const zgsmatrix&, const zhematrix&);
inline friend _zgematrix operator+(const zgsmatrix&, const _zhematrix&);
inline friend _zgematrix operator+(const zgsmatrix&, const zgbmatrix&);
inline friend _zgematrix operator+(const zgsmatrix&, const _zgbmatrix&);
inline friend _zgsmatrix operator+(const zgsmatrix&, const zgsmatrix&);
inline friend _zgsmatrix operator+(const zgsmatrix&, const _zgsmatrix&);
inline friend _zgsmatrix operator+(const zgsmatrix&, const zhsmatrix&);
inline friend _zgsmatrix operator+(const zgsmatrix&, const _zhsmatrix&);
//////// - ////////
inline friend _zgematrix operator-(const zgsmatrix&, const zgematrix&);
inline friend _zgematrix operator-(const zgsmatrix&, const _zgematrix&);
inline friend _zgematrix operator-(const zgsmatrix&, const zhematrix&);
inline friend _zgematrix operator-(const zgsmatrix&, const _zhematrix&);
inline friend _zgematrix operator-(const zgsmatrix&, const zgbmatrix&);
inline friend _zgematrix operator-(const zgsmatrix&, const _zgbmatrix&);
inline friend _zgsmatrix operator-(const zgsmatrix&, const zgsmatrix&);
inline friend _zgsmatrix operator-(const zgsmatrix&, const _zgsmatrix&);
inline friend _zgsmatrix operator-(const zgsmatrix&, const zhsmatrix&);
inline friend _zgsmatrix operator-(const zgsmatrix&, const _zhsmatrix&);
//////// * ////////
inline friend _zcovector operator*(const zgsmatrix&, const zcovector&);
inline friend _zcovector operator*(const zgsmatrix&, const _zcovector&);
inline friend _zgematrix operator*(const zgsmatrix&, const zgematrix&);
inline friend _zgematrix operator*(const zgsmatrix&, const _zgematrix&);
inline friend _zgematrix operator*(const zgsmatrix&, const zhematrix&);
inline friend _zgematrix operator*(const zgsmatrix&, const _zhematrix&);
inline friend _zgematrix operator*(const zgsmatrix&, const zgbmatrix&);
inline friend _zgematrix operator*(const zgsmatrix&, const _zgbmatrix&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const zgsmatrix&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const _zgsmatrix&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const zhsmatrix&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const _zhsmatrix&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const double&);
inline friend _zgsmatrix operator*(const zgsmatrix&, const comple&);
//////// / ////////
inline friend _zgsmatrix operator/(const zgsmatrix&, const double&);
inline friend _zgsmatrix operator/(const zgsmatrix&, const comple&);
//////// double, comple ////////
inline friend _zgsmatrix operator*(const double&, const zgsmatrix&);
inline friend _zgsmatrix operator*(const comple&, const zgsmatrix&);
};
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.