24 #if !defined (octave_dim_vector_h)
25 #define octave_dim_vector_h 1
88 for (
int i = 0; i < l; i++)
112 for (j = 0; j < l; j++)
124 assert (count () == 0);
145 #define ASSIGN_REP(i) rep[i] = d ## i;
146 #define DIM_VECTOR_CTOR(N) \
147 dim_vector (OCT_MAKE_DECL_LIST (octave_idx_type, d, N)) \
150 OCT_ITERATE_MACRO (ASSIGN_REP, N) \
204 #undef DIM_VECTOR_CTOR
208 #ifdef BOUNDS_CHECKING
209 assert (i >= 0 && i < ndims ());
217 #ifdef BOUNDS_CHECKING
218 assert (i >= 0 && i < ndims ());
223 void chop_trailing_singletons (
void)
226 if (l > 2 && rep[l-1] == 1)
231 while (l > 2 && rep[l-1] == 1);
236 void chop_all_singletons (
void);
290 int length (
void)
const {
return ndims (); }
296 void resize (
int n,
int fill_value = 0)
311 std::string str (
char sep =
'x')
const;
313 bool all_zero (
void)
const
317 for (
int i = 0; i <
length (); i++)
329 bool empty_2d (
void)
const
335 bool zero_by_zero (
void)
const
340 bool any_zero (
void)
const
344 for (
int i = 0; i <
length (); i++)
376 for (
int i = n; i < n_dims; i++)
394 bool any_neg (
void)
const
399 for (i = 0; i < n_dims; i++)
444 int first_non_singleton (
int def = 0)
const
446 for (
int i = 0; i <
length (); i++)
460 for (
int i =
length () - 1; i >= 0; i--)
461 k = k * rep[i] + idx[i];
471 for (
int i = nidx - 1; i >= 0; i--)
472 k = k * rep[i] + idx[i];
486 for (i = start; i <
length (); i++)
488 if (++(*idx) == rep[i])
504 for (
int i = 0; i < nd; i++)
505 retval.
rep[i] = k *= rep[i];
517 for (
int i = 1; i <
length (); i++)
518 k += rep[i-1] * idx[i];
543 for (
int i = 0; i < a_len; i++)
octave_idx_type compute_index(octave_idx_type n, const dim_vector &dims)
octave_idx_type & count(void) const
bool all_ones(const Array< octave_idx_type > &arr)
octave_idx_type * resizerep(int n, octave_idx_type fill_value)
Clone and resize this->rep to length n, filling by given value.
bool operator!=(const dim_vector &a, const dim_vector &b)
ComplexSVD & operator=(const ComplexSVD &a)
#define OCTREFCOUNT_ATOMIC_DECREMENT(x)
bool is_vector(const dim_vector &dim)
ComplexNDArray concat(NDArray &ra, ComplexNDArray &rb, const Array< octave_idx_type > &ra_idx)
#define OCTREFCOUNT_ATOMIC_INCREMENT(x)
void freerep(void)
Free the rep.
void increment_index(Array< octave_idx_type > &ra_idx, const dim_vector &dimensions, int start_dimension)
octave_idx_type & ndims(void) const
bool operator==(const dim_vector &a, const dim_vector &b)
#define DIM_VECTOR_CTOR(N)
static octave_idx_type * newrep(int ndims)
Construct a new rep with count = 1 and ndims given.
octave_idx_type elem(int i) const
octave_idx_type * clonerep(void)
Clone this->rep.
octave_idx_type num_ones(const Array< octave_idx_type > &ra_idx)