Vector(const std::initializer_list<T>& l) { isize = l.size(); typename std::initializer_list<T>::iterator it; data_m.resize(isize); int index = 0; for (it = l.begin(); it != l.end(); ++it) { T v = (*it); data_m[index] = v; index++; } }
Vector(const VectorExpression<T2, A> &expr) : isize(0) { isize = expr.Size(0); data_m.resize(isize); for (int i = 0; i < isize; i++) { data_m[i] = expr(i); } }
Vector(const Vector &orig) : isize(orig.isize) { this->isize = orig.isize; data_m.resize(orig.data_m.size()); #if defined(ATL_CONCURRENCY_ENABLED) for (int i = 0; i < data_m.size(); i++) { data_m[i] = orig.data_m[i]; } #else data_m.insert(data_m.begin(), orig.data_m.begin(), orig.data_m.end()); #endif }
Vector& operator=(const Vector &other) { this->isize = other.isize; data_m.resize(other.data_m.size()); #if defined(ATL_CONCURRENCY_ENABLED) for (int i = 0; i < data_m.size(); i++) { data_m[i] = other.data_m[i]; } #else data_m.insert(data_m.begin(), other.data_m.begin(), other.data_m.end()); #endif return *this; }
Vector& operator=(const ArrayExpression<T2, A> &expr) { #ifdef ENABLE_BOUNDS_CHECKING assert(expr.Dimensions() == 1); #endif isize = expr.Size(0); data_m.resize(isize); for (int i = 0; i < isize; i++) { data_m[i] = expr(i); } return *this; }
Vector& operator=(const MatrixVectorExpression<T2, A> &expr) { isize = expr.Size(0); #ifdef ENABLE_BOUNDS_CHECKING assert(expr.Size(1) == 1); #endif data_m.resize(isize); for (int i = 0; i < isize; i++) { data_m[i] = expr(i, 0); } return *this; }
/** * Default constructor. * Constructs a 1d Vector. * @param i */ Vector(size_t i = 1) : isize(i) { data_m.resize(i); }