22#define ArrayConstr_D 0
32 std::ostream& operator<<(std::ostream&
os, std::unique_ptr<F>& a) {
51 DEBUGL(ArrayConstr_D,
"start: size = " << sz <<
", data = " <<
data_);
89 for(
uint i = sz - 1; i--;) *d++ = *e++ +
diff;
105 std::memcpy((
void*)
data_, (
void*)a.
data_,
n_*
sizeof(F));
112 DEBUGL(ArrayDestr_D,
"start: size = " <<
size_ <<
", n = " <<
n_
113 <<
", data = " <<
data_);
115 DEBUGL(ArrayDestr_D,
"done.");
133 operator const F*()
const {
return data_; }
138 "i = " << i <<
", size = " <<
size_);
144 "i = " << i <<
", size = " <<
size_);
160 F* d =
data_;
const H* e = (
const H*)a;
161 for(
uint i =
n_; i--;) *d++ *= *e++;
173 std::memcpy((
void*)
data_, (
void*)a.
data_,
n_*
sizeof(F));
180 F* d =
data_;
const H* e = (
const H*)a;
193 F* d =
data_;
const H* e = (
const H*)a;
206 F* d =
data_;
const H* e = (
const H*)a;
213 F* d = (F*)a;
const F* e =
data_;
235 F* d =
data_;
const H* e = (
const H*)a;
251 F* d =
data_;
const H* e = (
const H*)a;
252 for(
uint i =
n_; i--;++d) {
270 std::ostream& info(std::ostream&
os)
const;
283 if (size_ > 0)
delete[] data_;
284 data_ =
new F[size_ = sz];
293 std::memcpy((
void*)data, (
void*)data_, n_*
sizeof(F));
303 os <<
"Array<F>(" << n_ <<
", [";
305 for (
uint i = n_; i--;)
306 os << *d++ << ((i == 0) ?
"" :
", ");
312 F *d = data_, *e = data_ + (n_-1);
313 for(
uint i = std::floor(
double(n_)/2.0); i--; )
314 std::swap(*d++, *e--);
319 std::ostream& operator<<(std::ostream&
os,
const Array<F>&
o) {
330 if (n != y.size())
return false;
331 const F* d = (
const F*)x;
const F* e = (
const F*)y;
332 for (
uint i = n; i--;)
333 if (*d++ != *e++)
return false;
338 inline bool operator==(
const Array<F>& x, F& y)
341 const F* d = (
const F*)x;
342 for (
uint i = n; i--;)
343 if (*d++ != y)
return false;
348 inline bool operator==(F& y,
const Array<F>& x)
358 template<
class F,
class G>
362 typename Combtype<F,G>::type* r = (
typename Combtype<F,G>::type*)
result;
363 const F* a = (
const F*)
array;
364 for(
uint i =
array.size(); i--;) *r++ = *a++ * val;
373 template<
class F,
class G>
388 os <<
"Array<F>(" <<
array.size() <<
", [";
389 const F* d = (
const F*)
array;
391 pointerOutput(
os, *d++);
392 os << ((i == 0) ?
"" :
", ");
Array< F > & operator*=(const G n)
Scaling operator.
Array< F > operator-() const
Negation operator.
Array< F > & operator*=(const Array< H > &a)
Multiplication operator.
uint size_
Current real size of the array.
Array< F > & operator+=(const F n)
Addition operator.
Array(const Array< F > &a)
Copy constructor.
Array(const uint sz, const F &dft)
Array< F > & operator=(const Array< F > &a)
Assignement operator.
Array< F > & apply(F &fnc(F &))
const F & operator[](const int i) const
Index operator.
uint size() const
Returns the requested size of the array.
void resize(const uint sz)
Array(const uint sz, const F &first, const F &diff)
Array< F > & operator=(const F n)
Assignement operator.
Array< F > & apply(const Array< H > &a, F fnc(const H &))
int memory() const
Returns the memory usage in bytes.
Array< F > & operator=(const Array< H > &a)
Assignement operator.
Array(const Array< H > &a, F fnc(const H &))
Array< F > & operator-=(const F n)
Subtraction operator.
Array(const uint sz=0)
Constructor.
uint n_
Requested size of the array.
Array< F > & apply(const Array< H > &a, F fnc(const H &, const F &))
Array< F > & reverse()
Reverse the order of the entries.
void zeros()
Fills the memory with zeros.
Array(const Array< H > &a)
Type conversion constructor.
Array< F > & operator-=(const Array< H > &a)
Subtraction operator.
void resizePreserve(const uint sz)
Array(const F *dft, const uint sz)
uint cursize() const
Returns the size of the allocated memory.
Array< F > & operator+=(const Array< H > &a)
Addition operator.
#define conceptsAssert(cond, exc)
#define DEBUGL(doit, msg)
#define conceptsAssert3(cond, exc, msg)
std::string typeOf(const T &t)
void memorycpy(F *dest, const G *src, size_t n)
Copies n entries from src to dest (faster than std::memcpy)
Set< F > makeSet(uint n, const F &first,...)