59 dims[i] = dimensions[i];
116 for (int32_t i = 0; i <
num_dims; i++)
117 dimensions[i] =
dims[i];
126 REQUIRE(
dims[2] > matIdx,
"Provided index (%d) is out of range, must be smaller than %d\n", matIdx,
dims[2]);
130 int64_t idx = int64_t(matIdx)*int64_t(
dims[0])*
dims[1];
132 for (int64_t i=0; i<
dims[0]; i++)
133 for (int64_t j=0; j<i-1; j++)
135 aux =
array[idx + i + j*dims[0]];
136 array[idx + i + j*dims[0]] =
array[idx + j + i*dims[0]];
137 array[idx + j + i*dims[1]] = aux;
149 array[i] = const_elem;
179 "The length of the given array (%d) does not match the length of internal array (%d).\n", ndarray.
len_array,
len_array);
181 "The provided number of dimensions (%d) does not match the internal number of dimensions (%d).\n", ndarray.
num_dims,
num_dims);
207 "The length of the given array (%d) does not match the length of internal array (%d).\n", ndarray.
len_array,
len_array);
209 "The provided number of dimensions (%d) does not match the internal number of dimensions (%d).\n", ndarray.
num_dims,
num_dims);
272 "Provided number of dimensions (%d) does not match internal number of dimensions (%d).\n", index.
size(),
num_dims);
274 for (int32_t i =
num_dims - 1; i >= 0; i--)
276 REQUIRE(index[i] <
dims[i],
"Provided index (%d) on dimension %d must be smaller than %d. \n", index[i], i,
dims[i]);
278 y += index[i] * fact;
289 "The provided number of dimensions (%d) does not match the internal number of dimensions (%d).\n", curr_index.
size(),
num_dims);
291 for (int32_t i =
num_dims - 1; i >= 0; i--)
295 if (curr_index[i] <
dims[i])
307 "Provided axes size (%d) must be smaller than 2.\n", axes.
size());
309 "Number of dimensions (%d) must be smaller than 2. Only 1-d and 2-d array can be expanded currently.\n",
num_dims);
317 T* data_big = &big_array.
array[0];
318 for (int32_t vi = 0; vi < big_array.
len_array; vi++)
322 if (axes.
size() == 1)
324 y = inds_big[axes[0]];
326 else if (axes.
size() == 2)
328 int32_t ind1 = axes[0];
329 int32_t ind2 = axes[1];
330 y = inds_big[ind1] *
dims[1] + inds_big[ind2];
333 *data_big =
array[y];
SGNDArray< T > & operator*=(T val)
void transpose_matrix(index_t matIdx) const
SGNDArray< T > & operator+=(SGNDArray &ndarray)
SGNDArray< T > clone() const
#define SG_SNOTIMPLEMENTED
SGNDArray< T > & operator-=(SGNDArray &ndarray)
SGVector< index_t > get_dimensions() const
shogun reference count managed data
T get_value(SGVector< index_t > index) const
virtual void copy_data(const SGReferencedData &orig)
void set_const(T const_elem)
all of classes and functions are contained in the shogun namespace
T max_element(index_t &max_at)
void next_index(SGVector< index_t > &curr_index) const
shogun n-dimensional array
void expand(SGNDArray &big_array, SGVector< index_t > &axes)