addRow in PIVector2D
git-svn-id: svn://db.shs.com.ru/pip@799 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
16
main.cpp
16
main.cpp
@@ -1,14 +1,14 @@
|
|||||||
#include "pip.h"
|
#include "pip.h"
|
||||||
|
|
||||||
PIKbdListener kbd(0, 0, false);
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
//PISystemInfo::machineID();
|
PIVector<double> v;
|
||||||
kbd.enableExitCapture();
|
for (int i=0; i<9; ++i) v << i;
|
||||||
PIThread t;
|
PIVector2D<double> v2(3,3,v);
|
||||||
t.start(10);
|
piCout << v2;
|
||||||
//WAIT_FOR_EXIT;
|
v2.addRow(PIVector<double>() << 99 << 88 << 77 << 66);
|
||||||
piSleep(20.);
|
v2.addRow(v2.row(1));
|
||||||
t.stop();
|
piCout << v2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,12 @@ public:
|
|||||||
inline Col col(size_t index) {return Col(this, index);}
|
inline Col col(size_t index) {return Col(this, index);}
|
||||||
inline ColConst col(size_t index) const {return ColConst(this, index);}
|
inline ColConst col(size_t index) const {return ColConst(this, index);}
|
||||||
inline PIVector2D<T> & setRow(size_t row, const Row & other) {
|
inline PIVector2D<T> & setRow(size_t row, const Row & other) {
|
||||||
size_t sz = piMin<size_t>(cols_, other.p_->cols_);
|
size_t sz = piMin<size_t>(cols_, other.sz_);
|
||||||
|
mat._copyRaw(mat.data(cols_ * row), other.data(), sz);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline PIVector2D<T> & setRow(size_t row, const RowConst & other) {
|
||||||
|
size_t sz = piMin<size_t>(cols_, other.sz_);
|
||||||
mat._copyRaw(mat.data(cols_ * row), other.data(), sz);
|
mat._copyRaw(mat.data(cols_ * row), other.data(), sz);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -179,6 +184,30 @@ public:
|
|||||||
mat._copyRaw(mat.data(cols_ * row), other.data(), sz);
|
mat._copyRaw(mat.data(cols_ * row), other.data(), sz);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
inline PIVector2D<T> & addRow(const Row & other) {
|
||||||
|
size_t sz = piMin<size_t>(cols_, other.sz_);
|
||||||
|
size_t ps = mat.size();
|
||||||
|
mat.resize(mat.size() + cols_);
|
||||||
|
mat._copyRaw(mat.data(ps), other.data(), sz);
|
||||||
|
rows_++;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline PIVector2D<T> & addRow(const RowConst & other) {
|
||||||
|
size_t sz = piMin<size_t>(cols_, other.sz_);
|
||||||
|
size_t ps = mat.size();
|
||||||
|
mat.resize(mat.size() + cols_);
|
||||||
|
mat._copyRaw(mat.data(ps), other.data(), sz);
|
||||||
|
rows_++;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
inline PIVector2D<T> & addRow(const PIVector<T> & other) {
|
||||||
|
size_t sz = piMin<size_t>(cols_, other.size());
|
||||||
|
size_t ps = mat.size();
|
||||||
|
mat.resize(mat.size() + cols_);
|
||||||
|
mat._copyRaw(mat.data(ps), other.data(), sz);
|
||||||
|
rows_++;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
PIVector<PIVector<T> > toVectors() const {
|
PIVector<PIVector<T> > toVectors() const {
|
||||||
PIVector<PIVector<T> > ret;
|
PIVector<PIVector<T> > ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user