Go to the documentation of this file.
22 #define ArrayConstr_D 0
23 #define ArrayDestr_D 0
32 std::ostream&
operator<<(std::ostream& os, std::unique_ptr<F>& a) {
59 Array(
const uint sz,
const F& dft)
61 F* d =
data_;
for(uint i =
size_; i--;) *d++ = dft;
70 Array(
const F* dft,
const uint sz)
84 Array(
const uint sz,
const F& first,
const F& diff) :
89 for(uint i = sz - 1; i--;) *d++ = *e++ + diff;
105 std::memcpy((
void*)
data_, (
void*)a.data_,
n_*
sizeof(F));
113 <<
", data = " <<
data_);
133 operator const F*()
const {
return data_; }
138 "i = " << i <<
", size = " <<
size_);
144 "i = " << i <<
", size = " <<
size_);
152 for(uint i =
size_; i--;) *d++ *= n;
160 F* d =
data_;
const H* e = (
const H*)a;
161 for(uint i =
n_; i--;) *d++ *= *e++;
167 F* d =
data_;
for(uint i =
size_; i--;) *d++ = n;
173 std::memcpy((
void*)
data_, (
void*)a.data_,
n_*
sizeof(F));
180 F* d =
data_;
const H* e = (
const H*)a;
181 for(uint i =
size_; i--;) *d++ = *e++;
186 F* d =
data_;
for(uint i =
size_; i--;) *d++ += n;
192 if (
size_ == 0 && a.size() > 0) *
this =
Array<F>(a.size(), F(0));
193 F* d =
data_;
const H* e = (
const H*)a;
194 for(uint i =
size_; i--;) *d++ += *e++;
199 F* d =
data_;
for(uint i =
size_; i--;) *d++ -= n;
205 if (
size_ == 0 && a.size() > 0) *
this =
Array<F>(a.size(), F(0));
206 F* d =
data_;
const H* e = (
const H*)a;
207 for(uint i =
size_; i--;) *d++ -= *e++;
213 F* d = (F*)a;
const F* e =
data_;
214 for(uint i =
size_; i--;) *d++ = -*e++;
221 for(uint i =
size_; i--;++d) *d = fnc(*d);
235 F* d =
data_;
const H* e = (
const H*)a;
236 for(uint i =
size_; i--; ++d)
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--);
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;
341 const F* d = (
const F*)x;
342 for (uint i = n; i--;)
343 if (*d++ != y)
return false;
358 template<
class F,
class G>
363 const F* a = (
const F*)array;
364 for(uint i = array.
size(); i--;) *r++ = *a++ * val;
373 template<
class F,
class G>
374 Array<typename Combtype<F,G>::type>
388 os <<
"Array<F>(" << array.size() <<
", [";
389 const F* d = (
const F*)array;
390 for (uint i = array.size(); i--;) {
392 os << ((i == 0) ?
"" :
", ");
std::ostream & info(std::ostream &os) const
uint size() const
Returns the requested size of the array.
Array(const Array< F > &a)
Copy constructor.
Array< F > & operator-=(const F n)
Subtraction operator.
uint cursize() const
Returns the size of the allocated memory.
int memory() const
Returns the memory usage in bytes.
Array< F > & apply(const Array< H > &a, F fnc(const H &, const F &))
Application operator to each component.
void pointerOutput(std::ostream &os, const F &val)
Array< F > & operator*=(const G n)
Scaling operator.
Array< F > & operator-=(const Array< H > &a)
Subtraction operator.
Point< typename Combtype< F, Real >::type, dim > operator*(const Real x, const Point< F, dim > &y)
#define conceptsAssert(cond, exc)
Assert that a certain condition is fulfilled.
Array(const uint sz, const F &first, const F &diff)
Constructor for equidistant values.
Array< F > & operator=(const F n)
Assignement operator.
uint size_
Current real size of the array.
#define DEBUGL(doit, msg)
const F & operator[](const int i) const
Index operator.
Array< F > & operator=(const Array< H > &a)
Assignement operator.
Array(const Array< H > &a)
Type conversion constructor.
Array(const F *dft, const uint sz)
Constructor.
Array< F > & operator+=(const Array< H > &a)
Addition operator.
Exception class for assertions.
std::ostream & operator<<(std::ostream &os, const Level< dim > &c)
Array< F > & operator+=(const F n)
Addition operator.
Array(const uint sz=0)
Constructor.
Array< F > & apply(const Array< H > &a, F fnc(const H &))
Application operator to each component.
Taking for a complex type the appropiate real type and for a real type itself.
void memorycpy(F *dest, const G *src, size_t n)
Copies n entries from src to dest (faster than std::memcpy)
Array< F > & apply(F &fnc(F &))
Application operator to each component, e.g.
void resize(const uint sz)
Resizes the array.
bool operator==(const Point< F, dim > &x, const Point< F, dim > &y)
Array< F > & operator*=(const Array< H > &a)
Multiplication operator.
void resizePreserve(const uint sz)
Resizes the array.
uint n_
Requested size of the array.
Array< F > & operator=(const Array< F > &a)
Assignement operator.
Array< F > operator-() const
Negation operator.
void zeros()
Fills the memory with zeros.
#define conceptsAssert3(cond, exc, msg)
Assert that a certain condition is fulfilled.
std::string typeOf(const T &t)
Return the typeid name of a class object.
Array< F > & reverse()
Reverse the order of the entries.
Array(const uint sz, const F &dft)
Constructor.
Basic namespace for Concepts-2.
Array(const Array< H > &a, F fnc(const H &))
Constructor by applying a function to another array.