Classes | |
class | subview_cube< eT > |
Class for storing data required to construct or apply operations to a subcube (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube),. More... | |
Functions | |
subview_cube::~subview_cube () | |
arma_inline | subview_cube::subview_cube (const Cube< eT > &in_m, const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2) |
arma_inline | subview_cube::subview_cube (Cube< eT > &in_m, const u32 in_row1, const u32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u32 in_slice2) |
void | subview_cube::operator+= (const eT val) |
void | subview_cube::operator-= (const eT val) |
void | subview_cube::operator*= (const eT val) |
void | subview_cube::operator/= (const eT val) |
template<typename T1 > | |
void | subview_cube::operator= (const BaseCube< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator+= (const BaseCube< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator-= (const BaseCube< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator%= (const BaseCube< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator/= (const BaseCube< eT, T1 > &x) |
void | subview_cube::operator= (const subview_cube &x) |
x.subcube(...) = y.subcube(...) | |
void | subview_cube::operator+= (const subview_cube &x) |
void | subview_cube::operator-= (const subview_cube &x) |
void | subview_cube::operator%= (const subview_cube &x) |
void | subview_cube::operator/= (const subview_cube &x) |
template<typename T1 > | |
void | subview_cube::operator= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator+= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator-= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator%= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview_cube::operator/= (const Base< eT, T1 > &x) |
void | subview_cube::fill (const eT val) |
void | subview_cube::zeros () |
void | subview_cube::ones () |
arma_inline eT & | subview_cube::operator[] (const u32 i) |
arma_inline eT | subview_cube::operator[] (const u32 i) const |
arma_inline eT & | subview_cube::operator() (const u32 i) |
arma_inline eT | subview_cube::operator() (const u32 i) const |
arma_inline eT & | subview_cube::operator() (const u32 in_row, const u32 in_col, const u32 in_slice) |
arma_inline eT | subview_cube::operator() (const u32 in_row, const u32 in_col, const u32 in_slice) const |
arma_inline eT & | subview_cube::at (const u32 in_row, const u32 in_col, const u32 in_slice) |
arma_inline eT | subview_cube::at (const u32 in_row, const u32 in_col, const u32 in_slice) const |
arma_inline eT * | subview_cube::slice_colptr (const u32 in_slice, const u32 in_col) |
arma_inline const eT * | subview_cube::slice_colptr (const u32 in_slice, const u32 in_col) const |
bool | subview_cube::check_overlap (const subview_cube &x) const |
bool | subview_cube::check_overlap (const Mat< eT > &x) const |
static void | subview_cube::extract (Cube< eT > &out, const subview_cube &in) |
cube X = Y.subcube(...) | |
static void | subview_cube::extract (Mat< eT > &out, const subview_cube &in) |
mat X = Y.subcube(...) | |
static void | subview_cube::plus_inplace (Cube< eT > &out, const subview_cube &in) |
cube X += Y.subcube(...) | |
static void | subview_cube::minus_inplace (Cube< eT > &out, const subview_cube &in) |
cube X -= Y.subcube(...) | |
static void | subview_cube::schur_inplace (Cube< eT > &out, const subview_cube &in) |
cube X = Y.subcube(...) | |
static void | subview_cube::div_inplace (Cube< eT > &out, const subview_cube &in) |
cube X /= Y.subcube(...) | |
static void | subview_cube::plus_inplace (Mat< eT > &out, const subview_cube &in) |
mat X += Y.subcube(...) | |
static void | subview_cube::minus_inplace (Mat< eT > &out, const subview_cube &in) |
mat X -= Y.subcube(...) | |
static void | subview_cube::schur_inplace (Mat< eT > &out, const subview_cube &in) |
mat X = Y.subcube(...) | |
static void | subview_cube::div_inplace (Mat< eT > &out, const subview_cube &in) |
mat X /= Y.subcube(...) |
subview_cube< eT >::~subview_cube | ( | ) | [inline, inherited] |
Definition at line 22 of file subview_cube_meat.hpp.
arma_inline subview_cube< eT >::subview_cube | ( | const Cube< eT > & | in_m, | |
const u32 | in_row1, | |||
const u32 | in_col1, | |||
const u32 | in_slice1, | |||
const u32 | in_row2, | |||
const u32 | in_col2, | |||
const u32 | in_slice2 | |||
) | [inline, protected, inherited] |
Definition at line 32 of file subview_cube_meat.hpp.
00041 : m (in_m) 00042 , m_ptr (0) 00043 , aux_row1 (in_row1) 00044 , aux_col1 (in_col1) 00045 , aux_slice1 (in_slice1) 00046 , aux_row2 (in_row2) 00047 , aux_col2 (in_col2) 00048 , aux_slice2 (in_slice2) 00049 , n_rows (1 + in_row2 - in_row1) 00050 , n_cols (1 + in_col2 - in_col1) 00051 , n_elem_slice(n_rows * n_cols) 00052 , n_slices (1 + in_slice2 - in_slice1) 00053 , n_elem (n_elem_slice * n_slices) 00054 { 00055 arma_extra_debug_sigprint(); 00056 }
arma_inline subview_cube< eT >::subview_cube | ( | Cube< eT > & | in_m, | |
const u32 | in_row1, | |||
const u32 | in_col1, | |||
const u32 | in_slice1, | |||
const u32 | in_row2, | |||
const u32 | in_col2, | |||
const u32 | in_slice2 | |||
) | [inline, protected, inherited] |
Definition at line 63 of file subview_cube_meat.hpp.
00072 : m (in_m) 00073 , m_ptr (&in_m) 00074 , aux_row1 (in_row1) 00075 , aux_col1 (in_col1) 00076 , aux_slice1 (in_slice1) 00077 , aux_row2 (in_row2) 00078 , aux_col2 (in_col2) 00079 , aux_slice2 (in_slice2) 00080 , n_rows (1 + in_row2 - in_row1) 00081 , n_cols (1 + in_col2 - in_col1) 00082 , n_elem_slice(n_rows * n_cols) 00083 , n_slices (1 + in_slice2 - in_slice1) 00084 , n_elem (n_elem_slice * n_slices) 00085 { 00086 arma_extra_debug_sigprint(); 00087 }
void subview_cube< eT >::operator+= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 94 of file subview_cube_meat.hpp.
References subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00095 { 00096 arma_extra_debug_sigprint(); 00097 00098 for(u32 slice = 0; slice < n_slices; ++slice) 00099 { 00100 for(u32 col = 0; col < n_cols; ++col) 00101 { 00102 eT* coldata = slice_colptr(slice,col); 00103 00104 for(u32 row = 0; row < n_rows; ++row) 00105 { 00106 coldata[row] += val; 00107 } 00108 00109 } 00110 } 00111 00112 }
void subview_cube< eT >::operator-= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 119 of file subview_cube_meat.hpp.
References subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00120 { 00121 arma_extra_debug_sigprint(); 00122 00123 for(u32 slice = 0; slice < n_slices; ++slice) 00124 { 00125 for(u32 col = 0; col<n_cols; ++col) 00126 { 00127 eT* coldata = slice_colptr(slice,col); 00128 00129 for(u32 row = 0; row<n_rows; ++row) 00130 { 00131 coldata[row] -= val; 00132 } 00133 00134 } 00135 } 00136 }
void subview_cube< eT >::operator*= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 143 of file subview_cube_meat.hpp.
References subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00144 { 00145 arma_extra_debug_sigprint(); 00146 00147 for(u32 slice = 0; slice < n_slices; ++slice) 00148 { 00149 for(u32 col = 0; col<n_cols; ++col) 00150 { 00151 eT* coldata = slice_colptr(slice,col); 00152 00153 for(u32 row = 0; row<n_rows; ++row) 00154 { 00155 coldata[row] *= val; 00156 } 00157 00158 } 00159 } 00160 }
void subview_cube< eT >::operator/= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 167 of file subview_cube_meat.hpp.
References subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00168 { 00169 arma_extra_debug_sigprint(); 00170 00171 for(u32 slice = 0; slice < n_slices; ++slice) 00172 { 00173 for(u32 col = 0; col<n_cols; ++col) 00174 { 00175 eT* coldata = slice_colptr(slice,col); 00176 00177 for(u32 row = 0; row<n_rows; ++row) 00178 { 00179 coldata[row] /= val; 00180 } 00181 00182 } 00183 } 00184 }
void subview_cube< eT >::operator= | ( | const BaseCube< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 192 of file subview_cube_meat.hpp.
References BaseCube< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00193 { 00194 arma_extra_debug_sigprint(); 00195 00196 const unwrap_cube<T1> tmp(in.get_ref()); 00197 00198 const Cube<eT>& x = tmp.M; 00199 subview_cube<eT>& t = *this; 00200 00201 arma_debug_assert_same_size(t, x, "copy into subcube"); 00202 00203 00204 for(u32 slice = 0; slice < t.n_slices; ++slice) 00205 { 00206 for(u32 col = 0; col < t.n_cols; ++col) 00207 { 00208 eT* t_coldata = t.slice_colptr(slice,col); 00209 const eT* x_coldata = x.slice_colptr(slice,col); 00210 00211 for(u32 row = 0; row < t.n_rows; ++row) 00212 { 00213 t_coldata[row] = x_coldata[row]; 00214 } 00215 00216 } 00217 } 00218 }
void subview_cube< eT >::operator+= | ( | const BaseCube< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 226 of file subview_cube_meat.hpp.
References BaseCube< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00227 { 00228 arma_extra_debug_sigprint(); 00229 00230 const unwrap_cube<T1> tmp(in.get_ref()); 00231 00232 const Cube<eT>& x = tmp.M; 00233 subview_cube<eT>& t = *this; 00234 00235 arma_debug_assert_same_size(t, x, "cube addition"); 00236 00237 for(u32 slice = 0; slice < t.n_slices; ++slice) 00238 { 00239 for(u32 col = 0; col < t.n_cols; ++col) 00240 { 00241 eT* t_coldata = t.slice_colptr(slice,col); 00242 const eT* x_coldata = x.slice_colptr(slice,col); 00243 00244 for(u32 row = 0; row < t.n_rows; ++row) 00245 { 00246 t_coldata[row] += x_coldata[row]; 00247 } 00248 } 00249 } 00250 00251 }
void subview_cube< eT >::operator-= | ( | const BaseCube< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 259 of file subview_cube_meat.hpp.
References BaseCube< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00260 { 00261 arma_extra_debug_sigprint(); 00262 00263 const unwrap_cube<T1> tmp(in.get_ref()); 00264 00265 const Cube<eT>& x = tmp.M; 00266 subview_cube<eT>& t = *this; 00267 00268 arma_debug_assert_same_size(t, x, "cube subtraction"); 00269 00270 00271 for(u32 slice = 0; slice < t.n_slices; ++slice) 00272 { 00273 for(u32 col = 0; col < t.n_cols; ++col) 00274 { 00275 eT* t_coldata = t.slice_colptr(slice,col); 00276 const eT* x_coldata = x.slice_colptr(slice,col); 00277 00278 for(u32 row = 0; row < t.n_rows; ++row) 00279 { 00280 t_coldata[row] -= x_coldata[row]; 00281 } 00282 } 00283 } 00284 }
void subview_cube< eT >::operator%= | ( | const BaseCube< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 292 of file subview_cube_meat.hpp.
References BaseCube< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00293 { 00294 arma_extra_debug_sigprint(); 00295 00296 const unwrap_cube<T1> tmp(in.get_ref()); 00297 00298 const Cube<eT>& x = tmp.M; 00299 subview_cube<eT>& t = *this; 00300 00301 arma_debug_assert_same_size(t, x, "cube schur product"); 00302 00303 for(u32 slice = 0; slice < t.n_slices; ++slice) 00304 { 00305 for(u32 col = 0; col<t.n_cols; ++col) 00306 { 00307 eT* t_coldata = t.slice_colptr(slice,col); 00308 const eT* x_coldata = x.slice_colptr(slice,col); 00309 00310 for(u32 row = 0; row<t.n_rows; ++row) 00311 { 00312 t_coldata[row] *= x_coldata[row]; 00313 } 00314 } 00315 } 00316 00317 }
void subview_cube< eT >::operator/= | ( | const BaseCube< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 325 of file subview_cube_meat.hpp.
References BaseCube< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00326 { 00327 arma_extra_debug_sigprint(); 00328 00329 const unwrap_cube<T1> tmp(in.get_ref()); 00330 00331 const Cube<eT>& x = tmp.M; 00332 subview_cube<eT>& t = *this; 00333 00334 arma_debug_assert_same_size(t, x, "element-wise cube division"); 00335 00336 00337 for(u32 slice = 0; slice < t.n_slices; ++slice) 00338 { 00339 for(u32 col = 0; col<t.n_cols; ++col) 00340 { 00341 eT* t_coldata = t.slice_colptr(slice,col); 00342 const eT* x_coldata = x.slice_colptr(slice,col); 00343 00344 for(u32 row = 0; row<t.n_rows; ++row) 00345 { 00346 t_coldata[row] /= x_coldata[row]; 00347 } 00348 } 00349 } 00350 00351 }
void subview_cube< eT >::operator= | ( | const subview_cube< eT > & | x | ) | [inline, inherited] |
x.subcube(...) = y.subcube(...)
Definition at line 359 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::check_overlap(), subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00360 { 00361 arma_extra_debug_sigprint(); 00362 00363 const bool overlap = check_overlap(x_in); 00364 00365 Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; 00366 const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT>(*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x_in.aux_col2, x_in.aux_slice2) : 0; 00367 const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; 00368 00369 subview_cube<eT>& t = *this; 00370 00371 arma_debug_assert_same_size(t, x, "copy into subcube"); 00372 00373 00374 for(u32 slice = 0; slice < t.n_slices; ++slice) 00375 { 00376 for(u32 col = 0; col < t.n_cols; ++col) 00377 { 00378 eT* t_coldata = t.slice_colptr(slice,col); 00379 const eT* x_coldata = x.slice_colptr(slice,col); 00380 00381 for(u32 row = 0; row < t.n_rows; ++row) 00382 { 00383 t_coldata[row] = x_coldata[row]; 00384 } 00385 } 00386 } 00387 00388 if(overlap) 00389 { 00390 delete tmp_subview_cube; 00391 delete tmp_cube; 00392 } 00393 00394 }
void subview_cube< eT >::operator+= | ( | const subview_cube< eT > & | x | ) | [inline, inherited] |
Definition at line 401 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::check_overlap(), subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00402 { 00403 arma_extra_debug_sigprint(); 00404 00405 const bool overlap = check_overlap(x_in); 00406 00407 Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; 00408 const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT>(*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x_in.aux_col2, x_in.aux_slice2) : 0; 00409 const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; 00410 00411 subview_cube<eT>& t = *this; 00412 00413 arma_debug_assert_same_size(t, x, "cube addition"); 00414 00415 00416 for(u32 slice = 0; slice < t.n_slices; ++slice) 00417 { 00418 for(u32 col = 0; col < t.n_cols; ++col) 00419 { 00420 eT* t_coldata = t.slice_colptr(slice,col); 00421 const eT* x_coldata = x.slice_colptr(slice,col); 00422 00423 for(u32 row = 0; row < t.n_rows; ++row) 00424 { 00425 t_coldata[row] += x_coldata[row]; 00426 } 00427 } 00428 } 00429 00430 if(overlap) 00431 { 00432 delete tmp_subview_cube; 00433 delete tmp_cube; 00434 } 00435 00436 }
void subview_cube< eT >::operator-= | ( | const subview_cube< eT > & | x | ) | [inline, inherited] |
Definition at line 443 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::check_overlap(), subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00444 { 00445 arma_extra_debug_sigprint(); 00446 00447 const bool overlap = check_overlap(x_in); 00448 00449 Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; 00450 const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT>(*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x_in.aux_col2, x_in.aux_slice2) : 0; 00451 const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; 00452 00453 subview_cube<eT>& t = *this; 00454 00455 arma_debug_assert_same_size(t, x, "cube subtraction"); 00456 00457 00458 for(u32 slice = 0; slice < t.n_slices; ++slice) 00459 { 00460 for(u32 col = 0; col < t.n_cols; ++col) 00461 { 00462 eT* t_coldata = t.slice_colptr(slice,col); 00463 const eT* x_coldata = x.slice_colptr(slice,col); 00464 00465 for(u32 row = 0; row < t.n_rows; ++row) 00466 { 00467 t_coldata[row] -= x_coldata[row]; 00468 } 00469 } 00470 } 00471 00472 if(overlap) 00473 { 00474 delete tmp_subview_cube; 00475 delete tmp_cube; 00476 } 00477 00478 }
void subview_cube< eT >::operator%= | ( | const subview_cube< eT > & | x | ) | [inline, inherited] |
Definition at line 485 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::check_overlap(), subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00486 { 00487 arma_extra_debug_sigprint(); 00488 00489 const bool overlap = check_overlap(x_in); 00490 00491 Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; 00492 const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT>(*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x_in.aux_col2, x_in.aux_slice2) : 0; 00493 const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; 00494 00495 subview_cube<eT>& t = *this; 00496 00497 arma_debug_assert_same_size(t, x, "element-wise cube multiplication"); 00498 00499 00500 for(u32 slice = 0; slice < t.n_slices; ++slice) 00501 { 00502 for(u32 col = 0; col < t.n_cols; ++col) 00503 { 00504 eT* t_coldata = t.slice_colptr(slice,col); 00505 const eT* x_coldata = x.slice_colptr(slice,col); 00506 00507 for(u32 row = 0; row < t.n_rows; ++row) 00508 { 00509 t_coldata[row] *= x_coldata[row]; 00510 } 00511 } 00512 } 00513 00514 if(overlap) 00515 { 00516 delete tmp_subview_cube; 00517 delete tmp_cube; 00518 } 00519 00520 }
void subview_cube< eT >::operator/= | ( | const subview_cube< eT > & | x | ) | [inline, inherited] |
Definition at line 527 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::check_overlap(), subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
00528 { 00529 arma_extra_debug_sigprint(); 00530 00531 const bool overlap = check_overlap(x_in); 00532 00533 Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; 00534 const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT>(*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x_in.aux_col2, x_in.aux_slice2) : 0; 00535 const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; 00536 00537 subview_cube<eT>& t = *this; 00538 00539 arma_debug_assert_same_size(t, x, "element-wise cube division"); 00540 00541 00542 for(u32 slice = 0; slice < t.n_slices; ++slice) 00543 { 00544 for(u32 col = 0; col < t.n_cols; ++col) 00545 { 00546 eT* t_coldata = t.slice_colptr(slice,col); 00547 const eT* x_coldata = x.slice_colptr(slice,col); 00548 00549 for(u32 row = 0; row < t.n_rows; ++row) 00550 { 00551 t_coldata[row] /= x_coldata[row]; 00552 } 00553 } 00554 } 00555 00556 if(overlap) 00557 { 00558 delete tmp_subview_cube; 00559 delete tmp_cube; 00560 } 00561 00562 }
void subview_cube< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 570 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Base< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
00571 { 00572 arma_extra_debug_sigprint(); 00573 00574 const unwrap<T1> tmp(in.get_ref()); 00575 00576 const Mat<eT>& x = tmp.M; 00577 subview_cube<eT>& t = *this; 00578 00579 arma_debug_assert_same_size(t, x, "copy into subcube"); 00580 00581 00582 for(u32 col = 0; col < t.n_cols; ++col) 00583 { 00584 eT* t_coldata = t.slice_colptr(t.aux_slice1, col); 00585 const eT* x_coldata = x.colptr(col); 00586 00587 for(u32 row = 0; row < t.n_rows; ++row) 00588 { 00589 t_coldata[row] = x_coldata[row]; 00590 } 00591 00592 } 00593 }
void subview_cube< eT >::operator+= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 601 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Base< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
00602 { 00603 arma_extra_debug_sigprint(); 00604 00605 const unwrap<T1> tmp(in.get_ref()); 00606 00607 const Mat<eT>& x = tmp.M; 00608 subview_cube<eT>& t = *this; 00609 00610 arma_debug_assert_same_size(t, x, "cube addition"); 00611 00612 for(u32 col = 0; col < t.n_cols; ++col) 00613 { 00614 eT* t_coldata = t.slice_colptr(t.aux_slice1, col); 00615 const eT* x_coldata = x.colptr(col); 00616 00617 for(u32 row = 0; row < t.n_rows; ++row) 00618 { 00619 t_coldata[row] += x_coldata[row]; 00620 } 00621 } 00622 }
void subview_cube< eT >::operator-= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 630 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Base< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
00631 { 00632 arma_extra_debug_sigprint(); 00633 00634 const unwrap<T1> tmp(in.get_ref()); 00635 00636 const Mat<eT>& x = tmp.M; 00637 subview_cube<eT>& t = *this; 00638 00639 arma_debug_assert_same_size(t, x, "cube subtraction"); 00640 00641 for(u32 col = 0; col < t.n_cols; ++col) 00642 { 00643 eT* t_coldata = t.slice_colptr(t.aux_slice1, col); 00644 const eT* x_coldata = x.colptr(col); 00645 00646 for(u32 row = 0; row < t.n_rows; ++row) 00647 { 00648 t_coldata[row] -= x_coldata[row]; 00649 } 00650 } 00651 }
void subview_cube< eT >::operator%= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 659 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Base< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
00660 { 00661 arma_extra_debug_sigprint(); 00662 00663 const unwrap<T1> tmp(in.get_ref()); 00664 00665 const Mat<eT>& x = tmp.M; 00666 subview_cube<eT>& t = *this; 00667 00668 arma_debug_assert_same_size(t, x, "cube schur product"); 00669 00670 for(u32 col = 0; col<t.n_cols; ++col) 00671 { 00672 eT* t_coldata = t.slice_colptr(t.aux_slice1, col); 00673 const eT* x_coldata = x.colptr(col); 00674 00675 for(u32 row = 0; row<t.n_rows; ++row) 00676 { 00677 t_coldata[row] *= x_coldata[row]; 00678 } 00679 } 00680 }
void subview_cube< eT >::operator/= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 688 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Base< elem_type, derived >::get_ref(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
00689 { 00690 arma_extra_debug_sigprint(); 00691 00692 const unwrap<T1> tmp(in.get_ref()); 00693 00694 const Mat<eT>& x = tmp.M; 00695 subview_cube<eT>& t = *this; 00696 00697 arma_debug_assert_same_size(t, x, "element-wise cube division"); 00698 00699 00700 for(u32 col = 0; col<t.n_cols; ++col) 00701 { 00702 eT* t_coldata = t.slice_colptr(t.aux_slice1, col); 00703 const eT* x_coldata = x.colptr(col); 00704 00705 for(u32 row = 0; row<t.n_rows; ++row) 00706 { 00707 t_coldata[row] /= x_coldata[row]; 00708 } 00709 } 00710 }
void subview_cube< eT >::fill | ( | const eT | val | ) | [inline, inherited] |
Definition at line 717 of file subview_cube_meat.hpp.
References subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and subview_cube< eT >::slice_colptr().
Referenced by subview_cube< eT >::ones(), and subview_cube< eT >::zeros().
00718 { 00719 arma_extra_debug_sigprint(); 00720 00721 for(u32 slice = 0; slice < n_slices; ++slice) 00722 { 00723 for(u32 col = 0; col < n_cols; ++col) 00724 { 00725 eT* coldata = slice_colptr(slice,col); 00726 00727 for(u32 row = 0; row < n_rows; ++row) 00728 { 00729 coldata[row] = val; 00730 } 00731 } 00732 } 00733 00734 }
void subview_cube< eT >::zeros | ( | ) | [inline, inherited] |
Definition at line 741 of file subview_cube_meat.hpp.
References subview_cube< eT >::fill().
00742 { 00743 arma_extra_debug_sigprint(); 00744 00745 fill(eT(0)); 00746 }
void subview_cube< eT >::ones | ( | ) | [inline, inherited] |
Definition at line 753 of file subview_cube_meat.hpp.
References subview_cube< eT >::fill().
00754 { 00755 arma_extra_debug_sigprint(); 00756 00757 fill(eT(1)); 00758 }
arma_inline eT & subview_cube< eT >::operator[] | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 765 of file subview_cube_meat.hpp.
References arma_check(), subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::m_ptr, subview_cube< eT >::n_elem_slice, subview_cube< eT >::n_rows, and access::rw().
00766 { 00767 arma_check( (m_ptr == 0), "subview_cube::operator[]: cube is read-only"); 00768 00769 const u32 in_slice = i / n_elem_slice; 00770 const u32 offset = in_slice * n_elem_slice; 00771 const u32 j = i - offset; 00772 00773 const u32 in_col = j / n_rows; 00774 const u32 in_row = j % n_rows; 00775 00776 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00777 return access::rw( (*m_ptr).mem[index] ); 00778 }
arma_inline eT subview_cube< eT >::operator[] | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 785 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::n_elem_slice, and subview_cube< eT >::n_rows.
00786 { 00787 const u32 in_slice = i / n_elem_slice; 00788 const u32 offset = in_slice * n_elem_slice; 00789 const u32 j = i - offset; 00790 00791 const u32 in_col = j / n_rows; 00792 const u32 in_row = j % n_rows; 00793 00794 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00795 return m.mem[index]; 00796 }
arma_inline eT & subview_cube< eT >::operator() | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 803 of file subview_cube_meat.hpp.
References arma_check(), subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::m_ptr, subview_cube< eT >::n_elem, subview_cube< eT >::n_elem_slice, subview_cube< eT >::n_rows, and access::rw().
00804 { 00805 arma_check( (m_ptr == 0), "subview_cube::operator(): matrix is read-only"); 00806 arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); 00807 00808 const u32 in_slice = i / n_elem_slice; 00809 const u32 offset = in_slice * n_elem_slice; 00810 const u32 j = i - offset; 00811 00812 const u32 in_col = j / n_rows; 00813 const u32 in_row = j % n_rows; 00814 00815 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00816 return access::rw( (*m_ptr).mem[index] ); 00817 }
arma_inline eT subview_cube< eT >::operator() | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 824 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::n_elem, subview_cube< eT >::n_elem_slice, and subview_cube< eT >::n_rows.
00825 { 00826 arma_debug_check( (i >= n_elem), "subview_cube::operator(): index out of bounds"); 00827 00828 const u32 in_slice = i / n_elem_slice; 00829 const u32 offset = in_slice * n_elem_slice; 00830 const u32 j = i - offset; 00831 00832 const u32 in_col = j / n_rows; 00833 const u32 in_row = j % n_rows; 00834 00835 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00836 return m.mem[index]; 00837 }
arma_inline eT & subview_cube< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col, | |||
const u32 | in_slice | |||
) | [inline, inherited] |
Definition at line 844 of file subview_cube_meat.hpp.
References arma_check(), subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::m_ptr, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, and access::rw().
00845 { 00846 arma_check( (m_ptr == 0), "subview_cube::operator(): matrix is read-only"); 00847 arma_debug_check( ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) ), "subview_cube::operator(): location out of bounds"); 00848 00849 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00850 return access::rw( (*m_ptr).mem[index] ); 00851 }
arma_inline eT subview_cube< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col, | |||
const u32 | in_slice | |||
) | const [inline, inherited] |
Definition at line 858 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::n_slices.
00859 { 00860 arma_debug_check( ( (in_row >= n_rows) || (in_col >= n_cols) || (in_slice >= n_slices) ), "subview_cube::operator(): location out of bounds"); 00861 00862 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00863 return m.mem[index]; 00864 }
arma_inline eT & subview_cube< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col, | |||
const u32 | in_slice | |||
) | [inline, inherited] |
Definition at line 871 of file subview_cube_meat.hpp.
References arma_check(), subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::m_ptr, and access::rw().
00872 { 00873 arma_check( (m_ptr == 0), "subview_cube::at(): cube is read-only"); 00874 00875 const u32 index = (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00876 return access::rw( (*m_ptr).mem[index] ); 00877 }
arma_inline eT subview_cube< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col, | |||
const u32 | in_slice | |||
) | const [inline, inherited] |
Definition at line 884 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, and subview_cube< eT >::m.
arma_inline eT * subview_cube< eT >::slice_colptr | ( | const u32 | in_slice, | |
const u32 | in_col | |||
) | [inline, inherited] |
Definition at line 895 of file subview_cube_meat.hpp.
References arma_check(), subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, subview_cube< eT >::m, subview_cube< eT >::m_ptr, and access::rw().
Referenced by subview_cube< eT >::div_inplace(), subview_cube< eT >::extract(), subview_cube< eT >::fill(), subview_cube< eT >::minus_inplace(), subview_cube< eT >::operator%=(), subview_cube< eT >::operator*=(), subview_cube< eT >::operator+=(), subview_cube< eT >::operator-=(), subview_cube< eT >::operator/=(), subview_cube< eT >::operator=(), subview_cube< eT >::plus_inplace(), and subview_cube< eT >::schur_inplace().
00896 { 00897 arma_check( (m_ptr == 0), "subview_cube::slice_colptr(): cube is read-only"); 00898 00899 return & access::rw((*m_ptr).mem[ (in_slice + aux_slice1)*m.n_elem_slice + (in_col + aux_col1)*m.n_rows + aux_row1 ]); 00900 }
arma_inline const eT * subview_cube< eT >::slice_colptr | ( | const u32 | in_slice, | |
const u32 | in_col | |||
) | const [inline, inherited] |
Definition at line 907 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_slice1, and subview_cube< eT >::m.
bool subview_cube< eT >::check_overlap | ( | const subview_cube< eT > & | x | ) | const [inline, inherited] |
Definition at line 917 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_col1, subview_cube< eT >::aux_col2, subview_cube< eT >::aux_row1, subview_cube< eT >::aux_row2, subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, and subview_cube< eT >::m.
Referenced by subview_cube< eT >::operator%=(), subview_cube< eT >::operator+=(), subview_cube< eT >::operator-=(), subview_cube< eT >::operator/=(), and subview_cube< eT >::operator=().
00918 { 00919 const subview_cube<eT>& t = *this; 00920 00921 if(&t.m != &x.m) 00922 { 00923 return false; 00924 } 00925 else 00926 { 00927 const bool row_overlap = 00928 ( 00929 ( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) 00930 || 00931 ( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) 00932 ); 00933 00934 const bool col_overlap = 00935 ( 00936 ( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) 00937 || 00938 ( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) ) 00939 ); 00940 00941 const bool slice_overlap = 00942 ( 00943 ( (x.aux_slice1 >= t.aux_slice1) && (x.aux_slice1 <= t.aux_slice2) ) 00944 || 00945 ( (x.aux_slice2 >= t.aux_slice1) && (x.aux_slice2 <= t.aux_slice2) ) 00946 ); 00947 00948 return (row_overlap & col_overlap & slice_overlap); 00949 } 00950 }
bool subview_cube< eT >::check_overlap | ( | const Mat< eT > & | x | ) | const [inline, inherited] |
Definition at line 957 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, subview_cube< eT >::aux_slice2, subview_cube< eT >::m, and Mat< eT >::memptr().
00958 { 00959 const subview_cube<eT>& t = *this; 00960 00961 for(u32 slice = t.aux_slice1; slice <= t.aux_slice2; ++slice) 00962 { 00963 const Mat<eT>& y = *(t.m.mat_ptrs[slice]); 00964 00965 if( x.memptr() == y.memptr() ) 00966 { 00967 return true; 00968 } 00969 } 00970 00971 return false; 00972 }
void subview_cube< eT >::extract | ( | Cube< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
cube X = Y.subcube(...)
Definition at line 980 of file subview_cube_meat.hpp.
References subview_cube< eT >::m, Cube< eT >::n_cols, subview_cube< eT >::n_cols, Cube< eT >::n_rows, subview_cube< eT >::n_rows, Cube< eT >::n_slices, subview_cube< eT >::n_slices, Cube< eT >::set_size(), subview_cube< eT >::slice_colptr(), and Cube< eT >::slice_colptr().
00981 { 00982 arma_extra_debug_sigprint(); 00983 00984 // 00985 const bool alias = (&actual_out == &in.m); 00986 00987 Cube<eT>* tmp = (alias) ? new Cube<eT> : 0; 00988 Cube<eT>& out = (alias) ? (*tmp) : actual_out; 00989 00990 // 00991 00992 const u32 n_rows = in.n_rows; 00993 const u32 n_cols = in.n_cols; 00994 const u32 n_slices = in.n_slices; 00995 00996 out.set_size(n_rows, n_cols, n_slices); 00997 00998 arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d out.n_slices = %d in.m.n_rows = %d in.m.n_cols = %d in.m.n_slices = %d") % out.n_rows % out.n_cols % out.n_slices % in.m.n_rows % in.m.n_cols % in.m.n_slices); 00999 01000 01001 for(u32 slice = 0; slice<n_slices; ++slice) 01002 { 01003 for(u32 col = 0; col<n_cols; ++col) 01004 { 01005 eT* out_coldata = out.slice_colptr(slice,col); 01006 const eT* in_coldata = in.slice_colptr(slice,col); 01007 01008 for(u32 row = 0; row<n_rows; ++row) 01009 { 01010 out_coldata[row] = in_coldata[row]; 01011 } 01012 01013 } 01014 } 01015 01016 01017 if(alias) 01018 { 01019 actual_out = out; 01020 delete tmp; 01021 } 01022 01023 }
void subview_cube< eT >::extract | ( | Mat< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
mat X = Y.subcube(...)
Definition at line 1031 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Mat< eT >::colptr(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, subview_cube< eT >::n_slices, Mat< eT >::set_size(), and subview_cube< eT >::slice_colptr().
01032 { 01033 arma_extra_debug_sigprint(); 01034 01035 arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given subcube doesn't have exactly one slice" ); 01036 01037 out.set_size(in.n_rows, in.n_cols); 01038 01039 for(u32 col = 0; col < in.n_cols; ++col) 01040 { 01041 const eT* in_coldata = in.slice_colptr(in.aux_slice1, col); 01042 eT* out_coldata = out.colptr(col); 01043 01044 for(u32 row = 0; row < in.n_rows; ++row) 01045 { 01046 out_coldata[row] = in_coldata[row]; 01047 } 01048 } 01049 }
void subview_cube< eT >::plus_inplace | ( | Cube< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
cube X += Y.subcube(...)
Definition at line 1057 of file subview_cube_meat.hpp.
References subview_cube< eT >::m, Cube< eT >::memptr(), Cube< eT >::n_cols, subview_cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_rows, subview_cube< eT >::n_rows, Cube< eT >::n_slices, subview_cube< eT >::n_slices, subview_cube< eT >::slice_colptr(), and Cube< eT >::slice_colptr().
01058 { 01059 arma_extra_debug_sigprint(); 01060 01061 arma_debug_assert_same_size(out, in, "cube addition"); 01062 01063 if(&out != &in.m) 01064 { 01065 const u32 n_rows = out.n_rows; 01066 const u32 n_cols = out.n_cols; 01067 const u32 n_slices = out.n_slices; 01068 01069 for(u32 slice = 0; slice<n_slices; ++slice) 01070 { 01071 for(u32 col = 0; col<n_cols; ++col) 01072 { 01073 eT* out_coldata = out.slice_colptr(slice,col); 01074 const eT* in_coldata = in.slice_colptr(slice,col); 01075 01076 for(u32 row = 0; row<n_rows; ++row) 01077 { 01078 out_coldata[row] += in_coldata[row]; 01079 } 01080 } 01081 } 01082 } 01083 else 01084 { 01085 // X += X.subcube(...) 01086 // this only makes sense if X and X.subcube(...) are the same size 01087 01088 eT* out_mem = out.memptr(); 01089 01090 for(u32 i=0; i<out.n_elem; ++i) 01091 { 01092 out_mem[i] *= eT(2); 01093 } 01094 } 01095 01096 }
void subview_cube< eT >::minus_inplace | ( | Cube< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
cube X -= Y.subcube(...)
Definition at line 1104 of file subview_cube_meat.hpp.
References subview_cube< eT >::m, Cube< eT >::n_cols, subview_cube< eT >::n_cols, Cube< eT >::n_rows, subview_cube< eT >::n_rows, Cube< eT >::n_slices, subview_cube< eT >::n_slices, subview_cube< eT >::slice_colptr(), Cube< eT >::slice_colptr(), and Cube< eT >::zeros().
01105 { 01106 arma_extra_debug_sigprint(); 01107 01108 arma_debug_assert_same_size(out, in, "cube subtraction"); 01109 01110 if(&out != &in.m) 01111 { 01112 const u32 n_rows = out.n_rows; 01113 const u32 n_cols = out.n_cols; 01114 const u32 n_slices = out.n_slices; 01115 01116 for(u32 slice = 0; slice<n_slices; ++slice) 01117 { 01118 for(u32 col = 0; col<n_cols; ++col) 01119 { 01120 eT* out_coldata = out.slice_colptr(slice,col); 01121 const eT* in_coldata = in.slice_colptr(slice,col); 01122 01123 for(u32 row = 0; row<n_rows; ++row) 01124 { 01125 out_coldata[row] -= in_coldata[row]; 01126 } 01127 } 01128 } 01129 } 01130 else 01131 { 01132 // X -= X.subcube(...) 01133 // this only makes sense if X and X.subcube(...) are the same size 01134 01135 out.zeros(); 01136 } 01137 01138 }
void subview_cube< eT >::schur_inplace | ( | Cube< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
cube X = Y.subcube(...)
Definition at line 1146 of file subview_cube_meat.hpp.
References subview_cube< eT >::m, Cube< eT >::memptr(), Cube< eT >::n_cols, subview_cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_rows, subview_cube< eT >::n_rows, Cube< eT >::n_slices, subview_cube< eT >::n_slices, subview_cube< eT >::slice_colptr(), and Cube< eT >::slice_colptr().
01147 { 01148 arma_extra_debug_sigprint(); 01149 01150 arma_debug_assert_same_size(out, in, "cube schur product"); 01151 01152 if(&out != &in.m) 01153 { 01154 const u32 n_rows = out.n_rows; 01155 const u32 n_cols = out.n_cols; 01156 const u32 n_slices = out.n_slices; 01157 01158 for(u32 slice = 0; slice<n_slices; ++slice) 01159 { 01160 for(u32 col = 0; col<n_cols; ++col) 01161 { 01162 eT* out_coldata = out.slice_colptr(slice,col); 01163 const eT* in_coldata = in.slice_colptr(slice,col); 01164 01165 for(u32 row = 0; row<n_rows; ++row) 01166 { 01167 out_coldata[row] *= in_coldata[row]; 01168 } 01169 } 01170 } 01171 } 01172 else 01173 { 01174 // X %= X.subcube(...) 01175 // this only makes sense if X and X.subcube(...) are the same size 01176 01177 eT* out_mem = out.memptr(); 01178 01179 for(u32 i=0; i<out.n_elem; ++i) 01180 { 01181 const eT tmp = out_mem[i]; 01182 out_mem[i] = tmp*tmp; 01183 } 01184 } 01185 01186 }
void subview_cube< eT >::div_inplace | ( | Cube< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
cube X /= Y.subcube(...)
Definition at line 1194 of file subview_cube_meat.hpp.
References subview_cube< eT >::m, Cube< eT >::memptr(), Cube< eT >::n_cols, subview_cube< eT >::n_cols, Cube< eT >::n_elem, Cube< eT >::n_rows, subview_cube< eT >::n_rows, Cube< eT >::n_slices, subview_cube< eT >::n_slices, subview_cube< eT >::slice_colptr(), and Cube< eT >::slice_colptr().
01195 { 01196 arma_extra_debug_sigprint(); 01197 01198 arma_debug_assert_same_size(out, in, "element-wise cube division"); 01199 01200 if(&out != &in.m) 01201 { 01202 const u32 n_rows = out.n_rows; 01203 const u32 n_cols = out.n_cols; 01204 const u32 n_slices = out.n_slices; 01205 01206 for(u32 slice = 0; slice<n_slices; ++slice) 01207 { 01208 for(u32 col = 0; col<n_cols; ++col) 01209 { 01210 eT* out_coldata = out.slice_colptr(slice,col); 01211 const eT* in_coldata = in.slice_colptr(slice,col); 01212 01213 for(u32 row = 0; row<n_rows; ++row) 01214 { 01215 out_coldata[row] /= in_coldata[row]; 01216 } 01217 } 01218 } 01219 } 01220 else 01221 { 01222 // X /= X.subcube(...) 01223 // this only makes sense if X and X.subcube(...) are the same size 01224 01225 eT* out_mem = out.memptr(); 01226 01227 for(u32 i=0; i<out.n_elem; ++i) 01228 { 01229 const eT tmp = out_mem[i]; 01230 out_mem[i] = tmp/tmp; // using tmp/tmp as tmp might be zero 01231 } 01232 } 01233 01234 }
void subview_cube< eT >::plus_inplace | ( | Mat< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
mat X += Y.subcube(...)
Definition at line 1242 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Mat< eT >::colptr(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
01243 { 01244 arma_extra_debug_sigprint(); 01245 01246 arma_debug_assert_same_size(out, in, "matrix addition"); 01247 01248 for(u32 col = 0; col < in.n_cols; ++col) 01249 { 01250 const eT* in_coldata = in.slice_colptr(in.aux_slice1, col); 01251 eT* out_coldata = out.colptr(col); 01252 01253 for(u32 row = 0; row < in.n_rows; ++row) 01254 { 01255 out_coldata[row] += in_coldata[row]; 01256 } 01257 } 01258 01259 }
void subview_cube< eT >::minus_inplace | ( | Mat< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
mat X -= Y.subcube(...)
Definition at line 1267 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Mat< eT >::colptr(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
01268 { 01269 arma_extra_debug_sigprint(); 01270 01271 arma_debug_assert_same_size(out, in, "matrix subtraction"); 01272 01273 for(u32 col = 0; col < in.n_cols; ++col) 01274 { 01275 const eT* in_coldata = in.slice_colptr(in.aux_slice1, col); 01276 eT* out_coldata = out.colptr(col); 01277 01278 for(u32 row = 0; row < in.n_rows; ++row) 01279 { 01280 out_coldata[row] -= in_coldata[row]; 01281 } 01282 } 01283 01284 }
void subview_cube< eT >::schur_inplace | ( | Mat< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
mat X = Y.subcube(...)
Definition at line 1292 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Mat< eT >::colptr(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
01293 { 01294 arma_extra_debug_sigprint(); 01295 01296 arma_debug_assert_same_size(out, in, "matrix schur product"); 01297 01298 for(u32 col = 0; col < in.n_cols; ++col) 01299 { 01300 const eT* in_coldata = in.slice_colptr(in.aux_slice1, col); 01301 eT* out_coldata = out.colptr(col); 01302 01303 for(u32 row = 0; row < in.n_rows; ++row) 01304 { 01305 out_coldata[row] *= in_coldata[row]; 01306 } 01307 } 01308 01309 }
void subview_cube< eT >::div_inplace | ( | Mat< eT > & | out, | |
const subview_cube< eT > & | in | |||
) | [inline, static, inherited] |
mat X /= Y.subcube(...)
Definition at line 1317 of file subview_cube_meat.hpp.
References subview_cube< eT >::aux_slice1, Mat< eT >::colptr(), subview_cube< eT >::n_cols, subview_cube< eT >::n_rows, and subview_cube< eT >::slice_colptr().
01318 { 01319 arma_extra_debug_sigprint(); 01320 01321 arma_debug_assert_same_size(out, in, "matrix element-wise division"); 01322 01323 for(u32 col = 0; col < in.n_cols; ++col) 01324 { 01325 const eT* in_coldata = in.slice_colptr(in.aux_slice1, col); 01326 eT* out_coldata = out.colptr(col); 01327 01328 for(u32 row = 0; row < in.n_rows; ++row) 01329 { 01330 out_coldata[row] /= in_coldata[row]; 01331 } 01332 } 01333 01334 }