Classes | |
class | subview< eT > |
Class for storing data required to construct or apply operations to a submatrix (i.e. where the submatrix starts and ends as well as a reference/pointer to the original matrix),. More... | |
class | subview_col< eT > |
class | subview_row< eT > |
Functions | |
subview::~subview () | |
arma_inline | subview::subview (const Mat< eT > &in_m, const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2) |
arma_inline | subview::subview (Mat< eT > &in_m, const u32 in_row1, const u32 in_col1, const u32 in_row2, const u32 in_col2) |
void | subview::fill (const eT val) |
void | subview::operator+= (const eT val) |
void | subview::operator-= (const eT val) |
void | subview::operator*= (const eT val) |
void | subview::operator/= (const eT val) |
template<typename T1 > | |
void | subview::operator= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview::operator+= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview::operator-= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview::operator%= (const Base< eT, T1 > &x) |
template<typename T1 > | |
void | subview::operator/= (const Base< eT, T1 > &x) |
void | subview::operator= (const subview &x) |
x.submat(...) = y.submat(...) | |
void | subview::operator+= (const subview &x) |
void | subview::operator-= (const subview &x) |
void | subview::operator%= (const subview &x) |
void | subview::operator/= (const subview &x) |
void | subview::zeros () |
arma_inline eT & | subview::operator[] (const u32 i) |
arma_inline eT | subview::operator[] (const u32 i) const |
arma_inline eT & | subview::operator() (const u32 i) |
arma_inline eT | subview::operator() (const u32 i) const |
arma_inline eT & | subview::operator() (const u32 in_row, const u32 in_col) |
arma_inline eT | subview::operator() (const u32 in_row, const u32 in_col) const |
arma_inline eT & | subview::at (const u32 in_row, const u32 in_col) |
arma_inline eT | subview::at (const u32 in_row, const u32 in_col) const |
arma_inline eT * | subview::colptr (const u32 in_col) |
arma_inline const eT * | subview::colptr (const u32 in_col) const |
bool | subview::check_overlap (const subview &x) const |
bool | subview::is_vec () const |
static void | subview::extract (Mat< eT > &out, const subview &in) |
X = Y.submat(...). | |
static void | subview::plus_inplace (Mat< eT > &out, const subview &in) |
X += Y.submat(...). | |
static void | subview::minus_inplace (Mat< eT > &out, const subview &in) |
X -= Y.submat(...). | |
static void | subview::times_inplace (Mat< eT > &out, const subview &in) |
X *= Y.submat(...). | |
static void | subview::schur_inplace (Mat< eT > &out, const subview &in) |
X = Y.submat(...). | |
static void | subview::div_inplace (Mat< eT > &out, const subview &in) |
X /= Y.submat(...). | |
arma_inline | subview_col::subview_col (const Mat< eT > &in_m, const u32 in_col) |
arma_inline | subview_col::subview_col (Mat< eT > &in_m, const u32 in_col) |
arma_inline | subview_col::subview_col (const Mat< eT > &in_m, const u32 in_col, const u32 in_row1, const u32 in_row2) |
arma_inline | subview_col::subview_col (Mat< eT > &in_m, const u32 in_col, const u32 in_row1, const u32 in_row2) |
void | subview_col::operator= (const subview< eT > &x) |
void | subview_col::operator= (const subview_col &x) |
x.submat(...) = y.submat(...) | |
template<typename T1 > | |
void | subview_col::operator= (const Base< eT, T1 > &x) |
arma_inline | subview_row::subview_row (const Mat< eT > &in_m, const u32 in_row) |
arma_inline | subview_row::subview_row (Mat< eT > &in_m, const u32 in_row) |
arma_inline | subview_row::subview_row (const Mat< eT > &in_m, const u32 in_row, const u32 in_col1, const u32 in_col2) |
arma_inline | subview_row::subview_row (Mat< eT > &in_m, const u32 in_row, const u32 in_col1, const u32 in_col2) |
void | subview_row::operator= (const subview< eT > &x) |
void | subview_row::operator= (const subview_row &x) |
x.submat(...) = y.submat(...) | |
template<typename T1 > | |
void | subview_row::operator= (const Base< eT, T1 > &x) |
Definition at line 22 of file subview_meat.hpp.
arma_inline subview< eT >::subview | ( | const Mat< eT > & | in_m, | |
const u32 | in_row1, | |||
const u32 | in_col1, | |||
const u32 | in_row2, | |||
const u32 | in_col2 | |||
) | [inline, protected, inherited] |
Definition at line 30 of file subview_meat.hpp.
arma_inline subview< eT >::subview | ( | Mat< eT > & | in_m, | |
const u32 | in_row1, | |||
const u32 | in_col1, | |||
const u32 | in_row2, | |||
const u32 | in_col2 | |||
) | [inline, protected, inherited] |
Definition at line 48 of file subview_meat.hpp.
void subview< eT >::fill | ( | const eT | val | ) | [inline, inherited] |
Definition at line 67 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
void subview< eT >::operator+= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 89 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
void subview< eT >::operator-= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 111 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
void subview< eT >::operator*= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 133 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
void subview< eT >::operator/= | ( | const eT | val | ) | [inline, inherited] |
Definition at line 155 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
void subview< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Reimplemented in subview_col< eT >, and subview_row< eT >.
Definition at line 178 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Base< elem_type, derived >::get_ref(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00179 { 00180 arma_extra_debug_sigprint(); 00181 00182 const unwrap<T1> tmp(in.get_ref()); 00183 00184 const Mat<eT>& x = tmp.M; 00185 subview<eT>& t = *this; 00186 00187 arma_debug_assert_same_size(t, x, "insert into submatrix"); 00188 00189 00190 for(u32 col = 0; col<t.n_cols; ++col) 00191 { 00192 eT* t_coldata = t.colptr(col); 00193 const eT* x_coldata = x.colptr(col); 00194 00195 for(u32 row = 0; row<t.n_rows; ++row) 00196 { 00197 t_coldata[row] = x_coldata[row]; 00198 } 00199 00200 } 00201 }
void subview< eT >::operator+= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 209 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Base< elem_type, derived >::get_ref(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00210 { 00211 arma_extra_debug_sigprint(); 00212 00213 const unwrap<T1> tmp(in.get_ref()); 00214 00215 const Mat<eT>& x = tmp.M; 00216 subview<eT>& t = *this; 00217 00218 arma_debug_assert_same_size(t, x, "matrix addition"); 00219 00220 00221 for(u32 col = 0; col<t.n_cols; ++col) 00222 { 00223 eT* t_coldata = t.colptr(col); 00224 const eT* x_coldata = x.colptr(col); 00225 00226 for(u32 row = 0; row<t.n_rows; ++row) 00227 { 00228 t_coldata[row] += x_coldata[row]; 00229 } 00230 } 00231 00232 }
void subview< eT >::operator-= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 240 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Base< elem_type, derived >::get_ref(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00241 { 00242 arma_extra_debug_sigprint(); 00243 00244 const unwrap<T1> tmp(in.get_ref()); 00245 00246 const Mat<eT>& x = tmp.M; 00247 subview<eT>& t = *this; 00248 00249 arma_debug_assert_same_size(t, x, "matrix subtraction"); 00250 00251 00252 for(u32 col = 0; col<t.n_cols; ++col) 00253 { 00254 eT* t_coldata = t.colptr(col); 00255 const eT* x_coldata = x.colptr(col); 00256 00257 for(u32 row = 0; row<t.n_rows; ++row) 00258 { 00259 t_coldata[row] -= x_coldata[row]; 00260 } 00261 } 00262 00263 }
void subview< eT >::operator%= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 271 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Base< elem_type, derived >::get_ref(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00272 { 00273 arma_extra_debug_sigprint(); 00274 00275 const unwrap<T1> tmp(in.get_ref()); 00276 00277 const Mat<eT>& x = tmp.M; 00278 subview<eT>& t = *this; 00279 00280 arma_debug_assert_same_size(t, x, "matrix schur product"); 00281 00282 00283 for(u32 col = 0; col<t.n_cols; ++col) 00284 { 00285 eT* t_coldata = t.colptr(col); 00286 const eT* x_coldata = x.colptr(col); 00287 00288 for(u32 row = 0; row<t.n_rows; ++row) 00289 { 00290 t_coldata[row] *= x_coldata[row]; 00291 } 00292 } 00293 00294 }
void subview< eT >::operator/= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Definition at line 302 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Base< elem_type, derived >::get_ref(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00303 { 00304 arma_extra_debug_sigprint(); 00305 00306 const unwrap<T1> tmp(in.get_ref()); 00307 00308 const Mat<eT>& x = tmp.M; 00309 subview<eT>& t = *this; 00310 00311 arma_debug_assert_same_size(t, x, "element-wise matrix division"); 00312 00313 00314 for(u32 col = 0; col<t.n_cols; ++col) 00315 { 00316 eT* t_coldata = t.colptr(col); 00317 const eT* x_coldata = x.colptr(col); 00318 00319 for(u32 row = 0; row<t.n_rows; ++row) 00320 { 00321 t_coldata[row] /= x_coldata[row]; 00322 } 00323 } 00324 00325 }
void subview< eT >::operator= | ( | const subview< eT > & | x | ) | [inline, inherited] |
x.submat(...) = y.submat(...)
Reimplemented in subview_col< eT >, and subview_row< eT >.
Definition at line 333 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, subview< eT >::check_overlap(), field< oT >::col(), subview< eT >::colptr(), subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00334 { 00335 arma_extra_debug_sigprint(); 00336 00337 const bool overlap = check_overlap(x_in); 00338 00339 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00340 const subview<eT>* tmp_subview = overlap ? new subview<eT>(*tmp_mat, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; 00341 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00342 00343 subview<eT>& t = *this; 00344 00345 arma_debug_assert_same_size(t, x, "insert into submatrix"); 00346 00347 00348 for(u32 col = 0; col<t.n_cols; ++col) 00349 { 00350 eT* t_coldata = t.colptr(col); 00351 const eT* x_coldata = x.colptr(col); 00352 00353 for(u32 row = 0; row<t.n_rows; ++row) 00354 { 00355 t_coldata[row] = x_coldata[row]; 00356 } 00357 00358 } 00359 00360 if(overlap) 00361 { 00362 delete tmp_subview; 00363 delete tmp_mat; 00364 } 00365 00366 }
void subview< eT >::operator+= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 373 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, subview< eT >::check_overlap(), field< oT >::col(), subview< eT >::colptr(), subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_rows, field< oT >::row(), and subview< eT >::subview().
00374 { 00375 arma_extra_debug_sigprint(); 00376 00377 const bool overlap = check_overlap(x_in); 00378 00379 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00380 const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; 00381 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00382 00383 00384 subview<eT>& t = *this; 00385 00386 arma_debug_assert_same_size(t, x, "matrix addition"); 00387 00388 00389 for(u32 col = 0; col<t.n_cols; ++col) 00390 { 00391 eT* t_coldata = t.colptr(col); 00392 const eT* x_coldata = x.colptr(col); 00393 00394 for(u32 row = 0; row<t.n_rows; ++row) 00395 { 00396 t_coldata[row] += x_coldata[row]; 00397 } 00398 00399 } 00400 00401 }
void subview< eT >::operator-= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 408 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, subview< eT >::check_overlap(), field< oT >::col(), subview< eT >::colptr(), subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_rows, field< oT >::row(), and subview< eT >::subview().
00409 { 00410 arma_extra_debug_sigprint(); 00411 00412 const bool overlap = check_overlap(x_in); 00413 00414 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00415 const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; 00416 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00417 00418 subview<eT>& t = *this; 00419 00420 arma_debug_assert_same_size(t, x, "matrix subtraction"); 00421 00422 00423 for(u32 col = 0; col<t.n_cols; ++col) 00424 { 00425 eT* t_coldata = t.colptr(col); 00426 const eT* x_coldata = x.colptr(col); 00427 00428 for(u32 row = 0; row<t.n_rows; ++row) 00429 { 00430 t_coldata[row] -= x_coldata[row]; 00431 } 00432 } 00433 00434 if(overlap) 00435 { 00436 delete tmp_subview; 00437 delete tmp_mat; 00438 } 00439 00440 }
void subview< eT >::operator%= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 447 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, subview< eT >::check_overlap(), field< oT >::col(), subview< eT >::colptr(), subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_rows, field< oT >::row(), and subview< eT >::subview().
00448 { 00449 arma_extra_debug_sigprint(); 00450 00451 const bool overlap = check_overlap(x_in); 00452 00453 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00454 const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; 00455 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00456 00457 subview<eT>& t = *this; 00458 00459 arma_debug_assert_same_size(t, x, "matrix schur product"); 00460 00461 00462 for(u32 col = 0; col<t.n_cols; ++col) 00463 { 00464 eT* t_coldata = t.colptr(col); 00465 const eT* x_coldata = x.colptr(col); 00466 00467 for(u32 row = 0; row<t.n_rows; ++row) 00468 { 00469 t_coldata[row] *= x_coldata[row]; 00470 } 00471 } 00472 00473 if(overlap) 00474 { 00475 delete tmp_subview; 00476 delete tmp_mat; 00477 } 00478 00479 }
void subview< eT >::operator/= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 486 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, subview< eT >::check_overlap(), field< oT >::col(), subview< eT >::colptr(), subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_rows, field< oT >::row(), and subview< eT >::subview().
00487 { 00488 arma_extra_debug_sigprint(); 00489 00490 const bool overlap = check_overlap(x_in); 00491 00492 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00493 const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; 00494 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00495 00496 subview<eT>& t = *this; 00497 00498 arma_debug_assert_same_size(t, x, "element-wise matrix division"); 00499 00500 00501 for(u32 col = 0; col<t.n_cols; ++col) 00502 { 00503 eT* t_coldata = t.colptr(col); 00504 const eT* x_coldata = x.colptr(col); 00505 00506 for(u32 row = 0; row<t.n_rows; ++row) 00507 { 00508 t_coldata[row] /= x_coldata[row]; 00509 } 00510 } 00511 00512 if(overlap) 00513 { 00514 delete tmp_subview; 00515 delete tmp_mat; 00516 } 00517 00518 }
void subview< eT >::zeros | ( | ) | [inline, inherited] |
Definition at line 525 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
arma_inline eT & subview< eT >::operator[] | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 549 of file subview_meat.hpp.
References arma_check(), subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::m_ptr, subview< eT >::n_rows, and access::rw().
00550 { 00551 arma_check( (m_ptr == 0), "subview::operator[]: matrix is read-only"); 00552 00553 const u32 in_col = i / n_rows; 00554 const u32 in_row = i % n_rows; 00555 00556 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00557 return access::rw( (*m_ptr).mem[index] ); 00558 }
arma_inline eT subview< eT >::operator[] | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 565 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, and subview< eT >::n_rows.
arma_inline eT & subview< eT >::operator() | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 579 of file subview_meat.hpp.
References arma_check(), subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::m_ptr, subview< eT >::n_elem, subview< eT >::n_rows, and access::rw().
00580 { 00581 arma_check( (m_ptr == 0), "subview::operator(): matrix is read-only"); 00582 arma_debug_check( (i >= n_elem), "subview::operator(): index out of bounds"); 00583 00584 const u32 in_col = i / n_rows; 00585 const u32 in_row = i % n_rows; 00586 00587 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00588 return access::rw( (*m_ptr).mem[index] ); 00589 }
arma_inline eT subview< eT >::operator() | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 596 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::n_elem, and subview< eT >::n_rows.
arma_inline eT & subview< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | [inline, inherited] |
Definition at line 612 of file subview_meat.hpp.
References arma_check(), subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::m_ptr, subview< eT >::n_cols, subview< eT >::n_elem, subview< eT >::n_rows, and access::rw().
00613 { 00614 arma_check( (m_ptr == 0), "subview::operator(): matrix is read-only"); 00615 arma_debug_check( ( (n_elem == 0) || (in_row >= n_rows) || (in_col >= n_cols)), "subview::operator(): index out of bounds"); 00616 00617 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00618 return access::rw( (*m_ptr).mem[index] ); 00619 }
arma_inline eT subview< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | const [inline, inherited] |
Definition at line 626 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::n_cols, subview< eT >::n_elem, and subview< eT >::n_rows.
arma_inline eT & subview< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | [inline, inherited] |
Definition at line 639 of file subview_meat.hpp.
References arma_check(), subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::m_ptr, and access::rw().
00640 { 00641 arma_check( (m_ptr == 0), "subview::at(): matrix is read-only"); 00642 00643 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00644 return access::rw( (*m_ptr).mem[index] ); 00645 }
arma_inline eT subview< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | const [inline, inherited] |
Definition at line 652 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, and subview< eT >::m.
arma_inline eT * subview< eT >::colptr | ( | const u32 | in_col | ) | [inline, inherited] |
Definition at line 663 of file subview_meat.hpp.
References arma_check(), subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, subview< eT >::m_ptr, and access::rw().
Referenced by accu(), subview< eT >::div_inplace(), subview< eT >::extract(), subview< eT >::fill(), subview< eT >::minus_inplace(), subview< eT >::operator%=(), subview< eT >::operator*=(), subview< eT >::operator+=(), subview< eT >::operator-=(), subview< eT >::operator/=(), subview< eT >::operator=(), subview< eT >::plus_inplace(), prod(), subview< eT >::schur_inplace(), and subview< eT >::zeros().
00664 { 00665 arma_check( (m_ptr == 0), "subview::colptr(): matrix is read-only"); 00666 00667 return & access::rw((*m_ptr).mem[ (in_col + aux_col1)*m.n_rows + aux_row1 ]); 00668 }
arma_inline const eT * subview< eT >::colptr | ( | const u32 | in_col | ) | const [inline, inherited] |
Definition at line 675 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, and subview< eT >::m.
bool subview< eT >::check_overlap | ( | const subview< eT > & | x | ) | const [inline, inherited] |
Definition at line 685 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_col2, subview< eT >::aux_row1, subview< eT >::aux_row2, and subview< eT >::m.
Referenced by subview< eT >::operator%=(), subview< eT >::operator+=(), subview< eT >::operator-=(), subview< eT >::operator/=(), and subview< eT >::operator=().
00686 { 00687 const subview<eT>& t = *this; 00688 00689 if(&t.m != &x.m) 00690 { 00691 return false; 00692 } 00693 else 00694 { 00695 const bool row_overlap = 00696 ( 00697 ( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) 00698 || 00699 ( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) 00700 ); 00701 00702 const bool col_overlap = 00703 ( 00704 ( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) 00705 || 00706 ( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) ) 00707 ); 00708 00709 00710 return (row_overlap & col_overlap); 00711 } 00712 }
bool subview< eT >::is_vec | ( | ) | const [inline, inherited] |
Definition at line 719 of file subview_meat.hpp.
References subview< eT >::n_cols, and subview< eT >::n_rows.
Referenced by subview< eT >::extract().
void subview< eT >::extract | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X = Y.submat(...).
Definition at line 730 of file subview_meat.hpp.
References Mat< eT >::at(), subview< eT >::aux_col1, subview< eT >::aux_row1, field< oT >::col(), Mat< eT >::colptr(), subview< eT >::colptr(), subview< eT >::is_vec(), subview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, subview< eT >::n_cols, Mat< eT >::n_rows, subview< eT >::n_rows, field< oT >::row(), and Mat< eT >::set_size().
00731 { 00732 arma_extra_debug_sigprint(); 00733 00734 // 00735 const bool alias = (&actual_out == &in.m); 00736 00737 Mat<eT>* tmp = (alias) ? new Mat<eT> : 0; 00738 Mat<eT>& out = (alias) ? (*tmp) : actual_out; 00739 00740 // 00741 00742 const u32 n_rows = in.n_rows; // number of rows in the subview 00743 const u32 n_cols = in.n_cols; // number of columns in the subview 00744 00745 out.set_size(n_rows, n_cols); 00746 00747 arma_extra_debug_print(arma_boost::format("out.n_rows = %d out.n_cols = %d in.m.n_rows = %d in.m.n_cols = %d") % out.n_rows % out.n_cols % in.m.n_rows % in.m.n_cols ); 00748 00749 00750 if(in.is_vec() == true) 00751 { 00752 if(n_cols == 1) // a column vector 00753 { 00754 arma_extra_debug_print("subview::extract(): copying col (going across rows)"); 00755 00756 eT* out_mem = out.memptr(); 00757 const eT* in_coldata = in.colptr(0); // the first column of the subview, taking into account any row offset 00758 00759 for(u32 row=0; row<n_rows; ++row) 00760 { 00761 out_mem[row] = in_coldata[row]; 00762 } 00763 } 00764 else // a row vector 00765 { 00766 arma_extra_debug_print("subview::extract(): copying row (going across columns)"); 00767 00768 const Mat<eT>& X = in.m; 00769 00770 eT* out_mem = out.memptr(); 00771 const u32 row = in.aux_row1; 00772 const u32 start_col = in.aux_col1; 00773 00774 for(u32 i=0; i<n_cols; ++i) 00775 { 00776 out_mem[i] = X.at(row, i+start_col); 00777 } 00778 } 00779 } 00780 else // general submatrix 00781 { 00782 arma_extra_debug_print("subview::extract(): general submatrix"); 00783 00784 for(u32 col = 0; col<n_cols; ++col) 00785 { 00786 eT* out_coldata = out.colptr(col); 00787 const eT* in_coldata = in.colptr(col); 00788 00789 for(u32 row = 0; row<n_rows; ++row) 00790 { 00791 out_coldata[row] = in_coldata[row]; 00792 } 00793 } 00794 } 00795 00796 00797 if(alias) 00798 { 00799 actual_out = out; 00800 delete tmp; 00801 } 00802 00803 }
void subview< eT >::plus_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X += Y.submat(...).
Definition at line 811 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Mat< eT >::colptr(), subview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, subview< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, subview< eT >::n_rows, and field< oT >::row().
00812 { 00813 arma_extra_debug_sigprint(); 00814 00815 arma_debug_assert_same_size(out, in, "matrix addition"); 00816 00817 if(&out != &in.m) 00818 { 00819 const u32 n_rows = out.n_rows; 00820 const u32 n_cols = out.n_cols; 00821 00822 for(u32 col = 0; col<n_cols; ++col) 00823 { 00824 eT* out_coldata = out.colptr(col); 00825 const eT* in_coldata = in.colptr(col); 00826 00827 for(u32 row = 0; row<n_rows; ++row) 00828 { 00829 out_coldata[row] += in_coldata[row]; 00830 } 00831 } 00832 } 00833 else 00834 { 00835 // X += X.submat(...) 00836 // this only makes sense if X and X.submat(...) are the same size 00837 00838 eT* out_mem = out.memptr(); 00839 00840 for(u32 i=0; i<out.n_elem; ++i) 00841 { 00842 out_mem[i] *= eT(2); 00843 } 00844 } 00845 00846 }
void subview< eT >::minus_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X -= Y.submat(...).
Definition at line 854 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Mat< eT >::colptr(), subview< eT >::m, Mat< eT >::n_cols, subview< eT >::n_cols, Mat< eT >::n_rows, subview< eT >::n_rows, field< oT >::row(), and Mat< eT >::zeros().
00855 { 00856 arma_extra_debug_sigprint(); 00857 00858 arma_debug_assert_same_size(out, in, "matrix subtraction"); 00859 00860 if(&out != &in.m) 00861 { 00862 const u32 n_rows = out.n_rows; 00863 const u32 n_cols = out.n_cols; 00864 00865 for(u32 col = 0; col<n_cols; ++col) 00866 { 00867 eT* out_coldata = out.colptr(col); 00868 const eT* in_coldata = in.colptr(col); 00869 00870 for(u32 row = 0; row<n_rows; ++row) 00871 { 00872 out_coldata[row] -= in_coldata[row]; 00873 } 00874 } 00875 } 00876 else 00877 { 00878 out.zeros(); 00879 } 00880 00881 }
void subview< eT >::times_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X *= Y.submat(...).
Definition at line 889 of file subview_meat.hpp.
References glue_times::apply_inplace(), and subview< eT >::m.
00890 { 00891 arma_extra_debug_sigprint(); 00892 00893 arma_debug_assert_mul_size(out, in, "matrix multiply"); 00894 00895 if(&out != &in.m) 00896 { 00897 glue_times::apply_inplace(out, Mat<eT>(in)); 00898 } 00899 else 00900 { 00901 glue_times::apply_inplace(out, out); 00902 } 00903 00904 }
void subview< eT >::schur_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X = Y.submat(...).
Definition at line 912 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Mat< eT >::colptr(), subview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, subview< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, subview< eT >::n_rows, and field< oT >::row().
00913 { 00914 arma_extra_debug_sigprint(); 00915 00916 arma_debug_assert_same_size(out, in, "matrix schur product"); 00917 00918 if(&out != &in.m) 00919 { 00920 const u32 n_rows = out.n_rows; 00921 const u32 n_cols = out.n_cols; 00922 00923 for(u32 col = 0; col<n_cols; ++col) 00924 { 00925 eT* out_coldata = out.colptr(col); 00926 const eT* in_coldata = in.colptr(col); 00927 00928 for(u32 row = 0; row<n_rows; ++row) 00929 { 00930 out_coldata[row] *= in_coldata[row]; 00931 } 00932 } 00933 } 00934 else 00935 { 00936 eT* out_mem = out.memptr(); 00937 00938 for(u32 i=0; i<out.n_elem; ++i) 00939 { 00940 const eT tmp = out_mem[i]; 00941 out_mem[i] = tmp*tmp; 00942 } 00943 } 00944 00945 }
void subview< eT >::div_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X /= Y.submat(...).
Definition at line 953 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), Mat< eT >::colptr(), subview< eT >::m, Mat< eT >::memptr(), Mat< eT >::n_cols, subview< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, subview< eT >::n_rows, and field< oT >::row().
00954 { 00955 arma_extra_debug_sigprint(); 00956 00957 arma_debug_assert_same_size(out, in, "element-wise matrix division"); 00958 00959 if(&out != &in.m) 00960 { 00961 const u32 n_rows = out.n_rows; 00962 const u32 n_cols = out.n_cols; 00963 00964 for(u32 col = 0; col<n_cols; ++col) 00965 { 00966 eT* out_coldata = out.colptr(col); 00967 const eT* in_coldata = in.colptr(col); 00968 00969 for(u32 row = 0; row<n_rows; ++row) 00970 { 00971 out_coldata[row] /= in_coldata[row]; 00972 } 00973 } 00974 } 00975 else 00976 { 00977 eT* out_mem = out.memptr(); 00978 00979 for(u32 i=0; i<out.n_elem; ++i) 00980 { 00981 const eT tmp = out_mem[i]; 00982 out_mem[i] = tmp/tmp; // using tmp/tmp as tmp might be zero 00983 } 00984 } 00985 00986 }
arma_inline subview_col< eT >::subview_col | ( | const Mat< eT > & | in_m, | |
const u32 | in_col | |||
) | [inline, protected, inherited] |
Definition at line 998 of file subview_meat.hpp.
00999 : subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) 01000 { 01001 arma_extra_debug_sigprint(); 01002 }
arma_inline subview_col< eT >::subview_col | ( | Mat< eT > & | in_m, | |
const u32 | in_col | |||
) | [inline, protected, inherited] |
Definition at line 1008 of file subview_meat.hpp.
01009 : subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) 01010 { 01011 arma_extra_debug_sigprint(); 01012 }
arma_inline subview_col< eT >::subview_col | ( | const Mat< eT > & | in_m, | |
const u32 | in_col, | |||
const u32 | in_row1, | |||
const u32 | in_row2 | |||
) | [inline, protected, inherited] |
Definition at line 1018 of file subview_meat.hpp.
01019 : subview<eT>(in_m, in_row1, in_col, in_row2, in_col) 01020 { 01021 arma_extra_debug_sigprint(); 01022 }
arma_inline subview_col< eT >::subview_col | ( | Mat< eT > & | in_m, | |
const u32 | in_col, | |||
const u32 | in_row1, | |||
const u32 | in_row2 | |||
) | [inline, protected, inherited] |
Definition at line 1028 of file subview_meat.hpp.
01029 : subview<eT>(in_m, in_row1, in_col, in_row2, in_col) 01030 { 01031 arma_extra_debug_sigprint(); 01032 }
void subview_col< eT >::operator= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 1039 of file subview_meat.hpp.
Referenced by subview_col< eT >::operator=().
01040 { 01041 arma_extra_debug_sigprint(); 01042 01043 subview<eT>::operator=(X); 01044 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 01045 }
void subview_col< eT >::operator= | ( | const subview_col< eT > & | x | ) | [inline, inherited] |
x.submat(...) = y.submat(...)
Reimplemented from subview< eT >.
Definition at line 1052 of file subview_meat.hpp.
References subview_col< eT >::operator=().
01053 { 01054 arma_extra_debug_sigprint(); 01055 01056 subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' 01057 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 01058 }
void subview_col< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Reimplemented from subview< eT >.
Definition at line 1066 of file subview_meat.hpp.
References subview_col< eT >::operator=().
01067 { 01068 arma_extra_debug_sigprint(); 01069 01070 subview<eT>::operator=(X); 01071 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 01072 }
arma_inline subview_row< eT >::subview_row | ( | const Mat< eT > & | in_m, | |
const u32 | in_row | |||
) | [inline, protected, inherited] |
Definition at line 1085 of file subview_meat.hpp.
01086 : subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) 01087 { 01088 arma_extra_debug_sigprint(); 01089 }
arma_inline subview_row< eT >::subview_row | ( | Mat< eT > & | in_m, | |
const u32 | in_row | |||
) | [inline, protected, inherited] |
Definition at line 1095 of file subview_meat.hpp.
01096 : subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) 01097 { 01098 arma_extra_debug_sigprint(); 01099 }
arma_inline subview_row< eT >::subview_row | ( | const Mat< eT > & | in_m, | |
const u32 | in_row, | |||
const u32 | in_col1, | |||
const u32 | in_col2 | |||
) | [inline, protected, inherited] |
Definition at line 1105 of file subview_meat.hpp.
01106 : subview<eT>(in_m, in_row, in_col1, in_row, in_col2) 01107 { 01108 arma_extra_debug_sigprint(); 01109 }
arma_inline subview_row< eT >::subview_row | ( | Mat< eT > & | in_m, | |
const u32 | in_row, | |||
const u32 | in_col1, | |||
const u32 | in_col2 | |||
) | [inline, protected, inherited] |
Definition at line 1115 of file subview_meat.hpp.
01116 : subview<eT>(in_m, in_row, in_col1, in_row, in_col2) 01117 { 01118 arma_extra_debug_sigprint(); 01119 }
void subview_row< eT >::operator= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 1126 of file subview_meat.hpp.
Referenced by subview_row< eT >::operator=().
01127 { 01128 arma_extra_debug_sigprint(); 01129 01130 subview<eT>::operator=(X); 01131 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01132 }
void subview_row< eT >::operator= | ( | const subview_row< eT > & | x | ) | [inline, inherited] |
x.submat(...) = y.submat(...)
Reimplemented from subview< eT >.
Definition at line 1139 of file subview_meat.hpp.
References subview_row< eT >::operator=().
01140 { 01141 arma_extra_debug_sigprint(); 01142 01143 subview<eT>::operator=(X); // interprets 'subview_row' as 'subview' 01144 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01145 }
void subview_row< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Reimplemented from subview< eT >.
Definition at line 1153 of file subview_meat.hpp.
References subview_row< eT >::operator=().
01154 { 01155 arma_extra_debug_sigprint(); 01156 01157 subview<eT>::operator=(X); 01158 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01159 }