diff --git a/dynare++/sylv/cc/Vector.cc b/dynare++/sylv/cc/Vector.cc index f826fc96095691c484acaa4f04f88a5a9c86ea26..8a8232d89f78f8f202ea8a6b0f60593529c12ff3 100644 --- a/dynare++/sylv/cc/Vector.cc +++ b/dynare++/sylv/cc/Vector.cc @@ -6,16 +6,12 @@ #include <dynblas.h> -#include <cstring> -#include <cstdlib> #include <cmath> #include <algorithm> #include <limits> #include <iostream> #include <iomanip> -ZeroPad zero_pad; - Vector::Vector(const Vector &v) : len(v.len), data{new double[len], [](double *arr) { delete[] arr; }} { @@ -156,19 +152,10 @@ void Vector::zeros() { if (s == 1) - { - double *p = base(); - for (int i = 0; i < len/ZeroPad::length; - i++, p += ZeroPad::length) - memcpy(p, zero_pad.getBase(), sizeof(double)*ZeroPad::length); - for (; p < base()+len; p++) - *p = 0.0; - } + std::fill_n(base(), len, 0.0); else - { - for (int i = 0; i < len; i++) - operator[](i) = 0.0; - } + for (int i = 0; i < len; i++) + operator[](i) = 0.0; } void @@ -410,8 +397,3 @@ ConstVector::print() const std::cout << i << '\t' << std::setw(8) << operator[](i) << std::endl; std::cout.flags(ff); } - -ZeroPad::ZeroPad() -{ - pad.fill(0.0); -} diff --git a/dynare++/sylv/cc/Vector.hh b/dynare++/sylv/cc/Vector.hh index eca0f4bc90058164c15e19ac89aa28ae0a192c2e..76183c6c70e8d327c8c33b6442fff39f87cd1e00 100644 --- a/dynare++/sylv/cc/Vector.hh +++ b/dynare++/sylv/cc/Vector.hh @@ -9,7 +9,6 @@ * to avoid running virtual method invokation mechanism. Some * members, and methods are thus duplicated */ -#include <array> #include <memory> #include <complex> @@ -216,19 +215,4 @@ public: void print() const; }; -class ZeroPad -{ -public: - static const int length = 16; -private: - std::array<double, length> pad; -public: - ZeroPad(); - const double * - getBase() const - { - return pad.data(); - } -}; - #endif /* VECTOR_H */