Beispiel #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++;
     }
 }
Beispiel #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);
            }

        }
Beispiel #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
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #7
0
 /**
  * Default constructor.
  * Constructs a 1d Vector.
  * @param i
  */
 Vector(size_t i = 1)
 :
 isize(i) {
     data_m.resize(i);
 }