28 #if defined (HAVE_CONFIG_H)
55 for (
int i = 0; i < nd; i++)
70 std::ostringstream buf;
72 for (
int i = 0; i <
ndims (); i++)
80 std::string retval = buf.str ();
90 for (
int i = 0; i <
ndims (); i++)
102 int n_dims =
ndims ();
104 for (
int i = 0; i < n_dims; i++)
110 throw std::bad_alloc ();
123 if (new_dims.
ndims () == 2 &&
xelem(0) == 1 && new_dims.
elem(1) == 1)
124 return new_dims.
as_row ();
142 int orig_nd =
ndims ();
143 int ndb = dvb.
ndims ();
144 int new_nd = (dim < ndb ? ndb : dim + 1);
145 if (new_nd > orig_nd)
152 for (
int i = 0; i < ndb; i++)
154 if (i != dim &&
xelem(i) != dvb(i))
161 for (
int i = ndb; i < new_nd; i++)
163 if (i != dim &&
xelem(i) != 1)
171 xelem(dim) += (dim < ndb ? dvb(dim) : 1);
175 if (ndb == 2 && dvb(0) == 0 && dvb(1) == 0)
177 else if (orig_nd == 2 &&
xelem(0) == 0 &&
xelem(1) == 0)
208 bool e2dvb = dvb(0) + dvb(1) == 1;
228 int n_dims =
ndims ();
237 std::fill_n (retval.
m_dims + n_dims,
n - n_dims, 1);
252 for (
int i =
n; i < n_dims; i++)
273 retval(i) =
elem (i);
charNDArray max(char d, const charNDArray &m)
Vector representing the dimensions (size) of an Array.
OCTAVE_API Array< octave_idx_type > as_array(void) const
OCTAVE_API bool concat(const dim_vector &dvb, int dim)
This corresponds to cat().
OCTAVE_API void chop_all_singletons(void)
OCTAVE_API std::string str(char sep='x') const
octave_idx_type m_num_dims
void resize(int n, int fill_value=0)
static dim_vector alloc(int n)
static OCTAVE_API octave_idx_type dim_max(void)
OCTAVE_API int num_ones(void) const
OCTAVE_API bool hvcat(const dim_vector &dvb, int dim)
This corresponds to [,] (horzcat, dim = 0) and [;] (vertcat, dim = 1).
void chop_trailing_singletons(void)
octave_idx_type & xelem(int i)
octave_idx_type ndims(void) const
Number of dimensions.
OCTAVE_API dim_vector squeeze(void) const
OCTAVE_API dim_vector redim(int n) const
Force certain dimensionality, preserving numel ().
dim_vector as_row(void) const
octave_idx_type & elem(int i)
OCTAVE_API octave_idx_type safe_numel(void) const
The following function will throw a std::bad_alloc () exception if the requested size is larger than ...
static const octave_idx_type idx_max