Пример #1
0
 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++;
     }
 }
Пример #2
0
        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);
            }

        }
Пример #3
0
        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
        }
Пример #4
0
        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;
        }
Пример #5
0
        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;
        }
Пример #6
0
        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;
        }
Пример #7
0
 /**
  * Default constructor.
  * Constructs a 1d Vector.
  * @param i
  */
 Vector(size_t i = 1)
 :
 isize(i) {
     data_m.resize(i);
 }