6 #ifndef MYRAMATH_DENSE_INTRANGE_H 7 #define MYRAMATH_DENSE_INTRANGE_H 14 #include <myramath/utility/detail/LIBPUBLIC.h> 19 #ifdef MYRAMATH_ENABLE_CPP11 20 #include <initializer_list> 27 template<
class T>
class Array1;
44 typedef std::pair<intRange,intRange> Pair;
77 intRange window(
int n0,
int n1)
const;
83 int& operator() (
int n)
const;
84 int& operator[] (
int n)
const;
98 Pair split_first(
int n)
const;
107 Pair split_last(
int n)
const;
110 std::vector<int> make_vector()
const;
116 template<
class Functor>
void transform(
const Functor& f)
const 118 for (
int n = 0; n < N; ++n)
119 *pointer(n) = f( *pointer(n) );
123 void assign(
const intCRange& that)
const;
131 int* pointer(
int n)
const;
134 void check_size(
const intCRange& that)
const;
137 void check_size(
int S)
const;
153 typedef std::pair<intCRange,intCRange> Pair;
161 intCRange(
const int* in_begin,
int in_N);
166 #ifdef MYRAMATH_ENABLE_CPP11 194 const int& operator() (
int n)
const;
195 const int& operator[] (
int n)
const;
198 const int& at(
int n)
const;
209 Pair split_first(
int n)
const;
218 Pair split_last(
int n)
const;
221 std::vector<int> make_vector()
const;
226 const int* pointer(
int n)
const;
237 LIBPUBLIC std::ostream& operator << (std::ostream& out,
const intCRange& r);
std::vector< T > cumsum(const std::vector< T > &v)
Returns cumulative sum. For example, cumsum({4,8,9,13}) = {0,4,12,21,34}.
Definition: cumsum.h:19
int N
---------— Data members, all public ----------------—
Definition: intRange.h:40
void transform(const Functor &f) const
Overwrites every x(n) in this intRange with f(x(n)).
Definition: intRange.h:116
Abstraction layer, serializable objects write themselves to these.
Definition: Streams.h:39
Represents a mutable intRange.
Definition: intRange.h:33
int N
---------— Data members, all public ----------------—
Definition: intRange.h:149
Container of values, allows random (i) access.
Definition: Array1.h:32
Represents a const intRange.
Definition: intRange.h:142