15.04.2014 - Version 0.3.8_beta, last version of 0.3.8 branch. Too much added and fixed...

This commit is contained in:
peri4
2014-04-15 13:19:07 +04:00
parent f50891b376
commit 77abb0bbea
46 changed files with 4538 additions and 2515 deletions

View File

@@ -94,6 +94,11 @@ const complexd complexd_i(0., 1.);
const complexd complexd_0(0.);
const complexd complexd_1(1.);
__PIVECTOR_SIMPLE_FUNCTIONS__(complexi)
__PIVECTOR_SIMPLE_FUNCTIONS__(complexf)
__PIVECTOR_SIMPLE_FUNCTIONS__(complexd)
__PIVECTOR_SIMPLE_FUNCTIONS__(complexld)
const double deg2rad = M_PI_180;
const double rad2deg = M_180_PI;
@@ -194,7 +199,7 @@ public:
Type at(uint index) const {return c[index];}
Type & operator [](uint index) {return c[index];}
Type operator [](uint index) const {return c[index];}
_CVector & operator =(const _CVector & v) {c = v.c; return *this;}
_CVector & operator =(const _CVector & v) {memcpy(&c, &(v.c), sizeof(Type) * Size); return *this;}
bool operator ==(const _CVector & v) const {PIMV_FOR(i, 0) if (c[i] != v[i]) return false; return true;}
bool operator !=(const _CVector & v) const {return !(*this == c);}
void operator +=(const _CVector & v) {PIMV_FOR(i, 0) c[i] += v[i];}
@@ -222,8 +227,10 @@ public:
PIMathVectorT<Size1, Type1> turnTo() {PIMathVectorT<Size1, Type1> tv; uint sz = piMin<uint>(Size, Size1); for (uint i = 0; i < sz; ++i) tv[i] = c[i]; return tv;}
private:
void resize(uint size, const Type & new_value = Type()) {c.resize(size, new_value);}
PIVector<Type> c;
void resize(uint size, const Type & new_value = Type()) {s = size; for (int i = 0; i < s; ++i) c[i] = new_value;}
int s;
Type c[Size];
};
@@ -291,9 +298,8 @@ public:
Type & at(uint col, uint row) {return m[col][row];}
Type at(uint col, uint row) const {return m[col][row];}
PIVector<Type> & operator [](uint col) {return m[col];}
PIVector<Type> operator [](uint col) const {return m[col];}
void operator =(const _CMatrix & sm) {m = sm.m;}
Type * operator [](uint col) {return m[col];}
void operator =(const _CMatrix & sm) {memcpy(&m, &(sm.m), sizeof(Type) * Cols * Rows);}
bool operator ==(const _CMatrix & sm) const {PIMM_FOR_WB(c, r) if (m[c][r] != sm.m[c][r]) return false; return true;}
bool operator !=(const _CMatrix & sm) const {return !(*this == sm);}
void operator +=(const _CMatrix & sm) {PIMM_FOR_WB(c, r) m[c][r] += sm.m[c][r];}
@@ -408,8 +414,9 @@ public:
_CMatrixI transposed() {_CMatrixI tm; PIMM_FOR_WB(c, r) tm[r][c] = m[c][r]; return tm;}
private:
void resize(uint cols, uint rows, const Type & new_value = Type()) {m.resize(cols); PIMM_FOR_C(i) m[i].resize(rows, new_value);}
PIVector<PIVector<Type> > m;
void resize(uint cols_, uint rows_, const Type & new_value = Type()) {c_ = cols_; r_ = rows_; PIMM_FOR_WB(c, r) m[c][r] = new_value;}
int c_, r_;
Type m[Cols][Rows];
};