#ifndef __Vector_H__ #define __Vector_H__ #include "PBaseExpressionTemplateClass.h" class Vector : public PExprGen { public: Vector(size_t size, double w = 0) : p_size(size) { p_data = new double[p_size]; for (size_t i(0); i < p_size; ++i) { p_data[i] = w; } } virtual ~Vector() { delete [] p_data; } double operator[] (size_t i) const { return p_data[i]; } template void operator = (const PExprGen& a_) { const A& a(a_); //on peut mettre un #pragma omp parallel et la boucle sera parallèlisée for (size_t i(0); i < p_size; ++i) { p_data[i] = a[i]; } } template void operator += (const PExprGen& a_) { const A& a(a_); for (size_t i(0); i < p_size; ++i) { p_data[i] += a[i]; } } private: double * p_data; size_t p_size; }; #endif