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 |
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) |
void | subview_col::operator= (const subview< eT > &x) |
x.submat(...) = y.submat(...) | |
void | subview_col::operator= (const subview_col &x) |
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) |
void | subview_row::operator= (const subview< eT > &x) |
x.submat(...) = y.submat(...) | |
void | subview_row::operator= (const subview_row &x) |
template<typename T1 > | |
void | subview_row::operator= (const Base< eT, T1 > &x) |
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.
00031 : m(in_m) 00032 , m_ptr(0) 00033 , aux_row1(in_row1) 00034 , aux_col1(in_col1) 00035 , aux_row2(in_row2) 00036 , aux_col2(in_col2) 00037 , n_rows(1 + in_row2 - in_row1) 00038 , n_cols(1 + in_col2 - in_col1) 00039 , n_elem(n_rows*n_cols) 00040 { 00041 arma_extra_debug_sigprint(); 00042 }
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.
00049 : m(in_m) 00050 , m_ptr(&in_m) 00051 , aux_row1(in_row1) 00052 , aux_col1(in_col1) 00053 , aux_row2(in_row2) 00054 , aux_col2(in_col2) 00055 , n_rows(1 + in_row2 - in_row1) 00056 , n_cols(1 + in_col2 - in_col1) 00057 , n_elem(n_rows*n_cols) 00058 { 00059 arma_extra_debug_sigprint(); 00060 }
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().
00068 { 00069 arma_extra_debug_sigprint(); 00070 00071 for(u32 col = 0; col<n_cols; ++col) 00072 { 00073 eT* coldata = colptr(col); 00074 00075 for(u32 row = 0; row != n_rows; ++row) 00076 { 00077 coldata[row] = val; 00078 } 00079 } 00080 00081 00082 }
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().
00090 { 00091 arma_extra_debug_sigprint(); 00092 00093 for(u32 col = 0; col<n_cols; ++col) 00094 { 00095 eT* coldata = colptr(col); 00096 00097 for(u32 row = 0; row<n_rows; ++row) 00098 { 00099 coldata[row] += val; 00100 } 00101 00102 } 00103 00104 }
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().
00112 { 00113 arma_extra_debug_sigprint(); 00114 00115 for(u32 col = 0; col<n_cols; ++col) 00116 { 00117 eT* coldata = colptr(col); 00118 00119 for(u32 row = 0; row<n_rows; ++row) 00120 { 00121 coldata[row] -= val; 00122 } 00123 00124 } 00125 00126 }
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().
00134 { 00135 arma_extra_debug_sigprint(); 00136 00137 for(u32 col = 0; col<n_cols; ++col) 00138 { 00139 eT* coldata = colptr(col); 00140 00141 for(u32 row = 0; row<n_rows; ++row) 00142 { 00143 coldata[row] *= val; 00144 } 00145 00146 } 00147 00148 }
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().
00156 { 00157 arma_extra_debug_sigprint(); 00158 00159 for(u32 col = 0; col<n_cols; ++col) 00160 { 00161 eT* coldata = colptr(col); 00162 00163 for(u32 row = 0; row<n_rows; ++row) 00164 { 00165 coldata[row] /= val; 00166 } 00167 00168 } 00169 00170 }
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 00435 }
void subview< eT >::operator%= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 442 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().
00443 { 00444 arma_extra_debug_sigprint(); 00445 00446 const bool overlap = check_overlap(x_in); 00447 00448 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00449 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; 00450 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00451 00452 subview<eT>& t = *this; 00453 00454 arma_debug_assert_same_size(t, x, "matrix schur product"); 00455 00456 00457 for(u32 col = 0; col<t.n_cols; ++col) 00458 { 00459 eT* t_coldata = t.colptr(col); 00460 const eT* x_coldata = x.colptr(col); 00461 00462 for(u32 row = 0; row<t.n_rows; ++row) 00463 { 00464 t_coldata[row] *= x_coldata[row]; 00465 } 00466 00467 } 00468 00469 }
void subview< eT >::operator/= | ( | const subview< eT > & | x | ) | [inline, inherited] |
Definition at line 476 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().
00477 { 00478 arma_extra_debug_sigprint(); 00479 00480 const bool overlap = check_overlap(x_in); 00481 00482 Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; 00483 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; 00484 const subview<eT>& x = overlap ? (*tmp_subview) : x_in; 00485 00486 subview<eT>& t = *this; 00487 00488 arma_debug_assert_same_size(t, x, "element-wise matrix division"); 00489 00490 00491 for(u32 col = 0; col<t.n_cols; ++col) 00492 { 00493 eT* t_coldata = t.colptr(col); 00494 const eT* x_coldata = x.colptr(col); 00495 00496 for(u32 row = 0; row<t.n_rows; ++row) 00497 { 00498 t_coldata[row] /= x_coldata[row]; 00499 } 00500 00501 } 00502 00503 }
void subview< eT >::zeros | ( | ) | [inline, inherited] |
Definition at line 510 of file subview_meat.hpp.
References field< oT >::col(), subview< eT >::colptr(), subview< eT >::n_cols, subview< eT >::n_rows, and field< oT >::row().
00511 { 00512 arma_extra_debug_sigprint(); 00513 00514 subview<eT>& t = *this; 00515 00516 for(u32 col = 0; col<t.n_cols; ++col) 00517 { 00518 eT* t_coldata = t.colptr(col); 00519 00520 for(u32 row = 0; row<t.n_rows; ++row) 00521 { 00522 t_coldata[row] = eT(0); 00523 } 00524 00525 } 00526 00527 }
arma_inline eT & subview< eT >::operator[] | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 534 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().
00535 { 00536 arma_check( (m_ptr == 0), "subview::operator[]: matrix is read-only"); 00537 00538 const u32 in_col = i / n_rows; 00539 const u32 in_row = i % n_rows; 00540 00541 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00542 return access::rw( (*m_ptr).mem[index] ); 00543 }
arma_inline eT subview< eT >::operator[] | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 550 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, subview< eT >::m, and subview< eT >::n_rows.
00551 { 00552 const u32 in_col = i / n_rows; 00553 const u32 in_row = i % n_rows; 00554 00555 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00556 return m.mem[index]; 00557 }
arma_inline eT & subview< eT >::operator() | ( | const u32 | i | ) | [inline, inherited] |
Definition at line 564 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().
00565 { 00566 arma_check( (m_ptr == 0), "subview::operator(): matrix is read-only"); 00567 arma_debug_check( (i >= n_elem), "subview::operator(): index out of bounds"); 00568 00569 const u32 in_col = i / n_rows; 00570 const u32 in_row = i % n_rows; 00571 00572 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00573 return access::rw( (*m_ptr).mem[index] ); 00574 }
arma_inline eT subview< eT >::operator() | ( | const u32 | i | ) | const [inline, inherited] |
Definition at line 581 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.
00582 { 00583 arma_debug_check( (i >= n_elem), "subview::operator(): index out of bounds"); 00584 00585 const u32 in_col = i / n_rows; 00586 const u32 in_row = i % n_rows; 00587 00588 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00589 return m.mem[index]; 00590 }
arma_inline eT & subview< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | [inline, inherited] |
Definition at line 597 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().
00598 { 00599 arma_check( (m_ptr == 0), "subview::operator(): matrix is read-only"); 00600 arma_debug_check( ( (n_elem == 0) || (in_row >= n_rows) || (in_col >= n_cols)), "subview::operator(): index out of bounds"); 00601 00602 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00603 return access::rw( (*m_ptr).mem[index] ); 00604 }
arma_inline eT subview< eT >::operator() | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | const [inline, inherited] |
Definition at line 611 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.
00612 { 00613 arma_debug_check( ( (n_elem == 0) || (in_row >= n_rows) || (in_col >= n_cols)), "subview::operator(): index out of bounds"); 00614 00615 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00616 return m.mem[index]; 00617 }
arma_inline eT & subview< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | [inline, inherited] |
Definition at line 624 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().
00625 { 00626 arma_check( (m_ptr == 0), "subview::at(): matrix is read-only"); 00627 00628 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00629 return access::rw( (*m_ptr).mem[index] ); 00630 }
arma_inline eT subview< eT >::at | ( | const u32 | in_row, | |
const u32 | in_col | |||
) | const [inline, inherited] |
Definition at line 637 of file subview_meat.hpp.
References subview< eT >::aux_col1, subview< eT >::aux_row1, and subview< eT >::m.
00638 { 00639 const u32 index = (in_col + aux_col1)*m.n_rows + aux_row1 + in_row; 00640 return m.mem[index]; 00641 }
arma_inline eT * subview< eT >::colptr | ( | const u32 | in_col | ) | [inline, inherited] |
Definition at line 648 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(), subview< eT >::schur_inplace(), and subview< eT >::zeros().
00649 { 00650 arma_check( (m_ptr == 0), "subview::colptr(): matrix is read-only"); 00651 00652 return & access::rw((*m_ptr).mem[ (in_col + aux_col1)*m.n_rows + aux_row1 ]); 00653 }
arma_inline const eT * subview< eT >::colptr | ( | const u32 | in_col | ) | const [inline, inherited] |
Definition at line 660 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 670 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=().
00671 { 00672 const subview<eT>& t = *this; 00673 00674 if(&t.m != &x.m) 00675 { 00676 return false; 00677 } 00678 else 00679 { 00680 const bool row_overlap = 00681 ( 00682 ( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) 00683 || 00684 ( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) 00685 ); 00686 00687 const bool col_overlap = 00688 ( 00689 ( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) 00690 || 00691 ( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) ) 00692 ); 00693 00694 00695 return (row_overlap & col_overlap); 00696 } 00697 }
void subview< eT >::extract | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X = Y.submat(...).
Definition at line 705 of file subview_meat.hpp.
References subview< eT >::aux_row1, field< oT >::col(), Mat< eT >::colptr(), subview< 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 >::set_size().
00706 { 00707 arma_extra_debug_sigprint(); 00708 00709 // 00710 const bool alias = (&actual_out == &in.m); 00711 00712 Mat<eT>* tmp = (alias) ? new Mat<eT> : 0; 00713 Mat<eT>& out = (alias) ? (*tmp) : actual_out; 00714 00715 // 00716 00717 const u32 n_rows = in.n_rows; 00718 const u32 n_cols = in.n_cols; 00719 00720 out.set_size(n_rows, n_cols); 00721 00722 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 ); 00723 00724 00725 if((n_rows == 1) && (n_cols != 1)) 00726 { 00727 arma_extra_debug_print("subview::apply(): copying row (going across columns)"); 00728 00729 for(u32 col = 0; col<n_cols; ++col) 00730 { 00731 out[col] = in.m.at(in.aux_row1, col); 00732 } 00733 } 00734 else 00735 if((n_rows != 1) && (n_cols == 1)) 00736 { 00737 arma_extra_debug_print("subview::apply(): copying col (going across n_rows)"); 00738 00739 const eT* in_coldata = in.colptr(0); 00740 00741 for(u32 row = 0; row<n_rows; ++row) 00742 { 00743 out[row] = in_coldata[row]; 00744 } 00745 00746 } 00747 else 00748 for(u32 col = 0; col<n_cols; ++col) 00749 { 00750 eT* out_coldata = out.colptr(col); 00751 const eT* in_coldata = in.colptr(col); 00752 00753 for(u32 row = 0; row<n_rows; ++row) 00754 { 00755 out_coldata[row] = in_coldata[row]; 00756 } 00757 00758 } 00759 00760 00761 if(alias) 00762 { 00763 actual_out = out; 00764 delete tmp; 00765 } 00766 00767 }
void subview< eT >::plus_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X += Y.submat(...).
Definition at line 775 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().
00776 { 00777 arma_extra_debug_sigprint(); 00778 00779 arma_debug_assert_same_size(out, in, "matrix addition"); 00780 00781 if(&out != &in.m) 00782 { 00783 const u32 n_rows = out.n_rows; 00784 const u32 n_cols = out.n_cols; 00785 00786 for(u32 col = 0; col<n_cols; ++col) 00787 { 00788 eT* out_coldata = out.colptr(col); 00789 const eT* in_coldata = in.colptr(col); 00790 00791 for(u32 row = 0; row<n_rows; ++row) 00792 { 00793 out_coldata[row] += in_coldata[row]; 00794 } 00795 } 00796 } 00797 else 00798 { 00799 // X += X.submat(...) 00800 // this only makes sense if X and X.submat(...) are the same size 00801 00802 eT* out_mem = out.memptr(); 00803 00804 for(u32 i=0; i<out.n_elem; ++i) 00805 { 00806 out_mem[i] *= eT(2); 00807 } 00808 } 00809 00810 }
void subview< eT >::minus_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X -= Y.submat(...).
Definition at line 818 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().
00819 { 00820 arma_extra_debug_sigprint(); 00821 00822 arma_debug_assert_same_size(out, in, "matrix subtraction"); 00823 00824 if(&out != &in.m) 00825 { 00826 const u32 n_rows = out.n_rows; 00827 const u32 n_cols = out.n_cols; 00828 00829 for(u32 col = 0; col<n_cols; ++col) 00830 { 00831 eT* out_coldata = out.colptr(col); 00832 const eT* in_coldata = in.colptr(col); 00833 00834 for(u32 row = 0; row<n_rows; ++row) 00835 { 00836 out_coldata[row] -= in_coldata[row]; 00837 } 00838 } 00839 } 00840 else 00841 { 00842 out.zeros(); 00843 } 00844 00845 }
void subview< eT >::times_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X *= Y.submat(...).
Definition at line 853 of file subview_meat.hpp.
References glue_times::apply_inplace(), and subview< eT >::m.
00854 { 00855 arma_extra_debug_sigprint(); 00856 00857 arma_debug_assert_mul_size(out, in, "matrix multiply"); 00858 00859 if(&out != &in.m) 00860 { 00861 glue_times::apply_inplace(out, Mat<eT>(in)); 00862 } 00863 else 00864 { 00865 glue_times::apply_inplace(out, out); 00866 } 00867 00868 }
void subview< eT >::schur_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X = Y.submat(...).
Definition at line 876 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().
00877 { 00878 arma_extra_debug_sigprint(); 00879 00880 arma_debug_assert_same_size(out, in, "matrix schur product"); 00881 00882 if(&out != &in.m) 00883 { 00884 const u32 n_rows = out.n_rows; 00885 const u32 n_cols = out.n_cols; 00886 00887 for(u32 col = 0; col<n_cols; ++col) 00888 { 00889 eT* out_coldata = out.colptr(col); 00890 const eT* in_coldata = in.colptr(col); 00891 00892 for(u32 row = 0; row<n_rows; ++row) 00893 { 00894 out_coldata[row] *= in_coldata[row]; 00895 } 00896 } 00897 } 00898 else 00899 { 00900 eT* out_mem = out.memptr(); 00901 00902 for(u32 i=0; i<out.n_elem; ++i) 00903 { 00904 const eT tmp = out_mem[i]; 00905 out_mem[i] = tmp*tmp; 00906 } 00907 } 00908 00909 }
void subview< eT >::div_inplace | ( | Mat< eT > & | out, | |
const subview< eT > & | in | |||
) | [inline, static, inherited] |
X /= Y.submat(...).
Definition at line 917 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().
00918 { 00919 arma_extra_debug_sigprint(); 00920 00921 arma_debug_assert_same_size(out, in, "element-wise matrix division"); 00922 00923 if(&out != &in.m) 00924 { 00925 const u32 n_rows = out.n_rows; 00926 const u32 n_cols = out.n_cols; 00927 00928 for(u32 col = 0; col<n_cols; ++col) 00929 { 00930 eT* out_coldata = out.colptr(col); 00931 const eT* in_coldata = in.colptr(col); 00932 00933 for(u32 row = 0; row<n_rows; ++row) 00934 { 00935 out_coldata[row] /= in_coldata[row]; 00936 } 00937 } 00938 } 00939 else 00940 { 00941 eT* out_mem = out.memptr(); 00942 00943 for(u32 i=0; i<out.n_elem; ++i) 00944 { 00945 const eT tmp = out_mem[i]; 00946 out_mem[i] = tmp*tmp; 00947 } 00948 } 00949 00950 }
arma_inline subview_col< eT >::subview_col | ( | const Mat< eT > & | in_m, | |
const u32 | in_col | |||
) | [inline, protected, inherited] |
Definition at line 962 of file subview_meat.hpp.
00963 : subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) 00964 { 00965 arma_extra_debug_sigprint(); 00966 }
arma_inline subview_col< eT >::subview_col | ( | Mat< eT > & | in_m, | |
const u32 | in_col | |||
) | [inline, protected, inherited] |
Definition at line 972 of file subview_meat.hpp.
00973 : subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) 00974 { 00975 arma_extra_debug_sigprint(); 00976 }
void subview_col< eT >::operator= | ( | const subview< eT > & | x | ) | [inline, inherited] |
x.submat(...) = y.submat(...)
Reimplemented from subview< eT >.
Definition at line 983 of file subview_meat.hpp.
Referenced by subview_col< eT >::operator=().
00984 { 00985 arma_extra_debug_sigprint(); 00986 00987 subview<eT>::operator=(X); 00988 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 00989 }
void subview_col< eT >::operator= | ( | const subview_col< eT > & | x | ) | [inline, inherited] |
Definition at line 996 of file subview_meat.hpp.
References subview_col< eT >::operator=().
00997 { 00998 arma_extra_debug_sigprint(); 00999 01000 subview<eT>::operator=(X); // interprets 'subview_col' as 'subview' 01001 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 01002 }
void subview_col< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Reimplemented from subview< eT >.
Definition at line 1010 of file subview_meat.hpp.
References subview_col< eT >::operator=().
01011 { 01012 arma_extra_debug_sigprint(); 01013 01014 subview<eT>::operator=(X); 01015 arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); 01016 }
arma_inline subview_row< eT >::subview_row | ( | const Mat< eT > & | in_m, | |
const u32 | in_row | |||
) | [inline, protected, inherited] |
Definition at line 1029 of file subview_meat.hpp.
01030 : subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) 01031 { 01032 arma_extra_debug_sigprint(); 01033 }
arma_inline subview_row< eT >::subview_row | ( | Mat< eT > & | in_m, | |
const u32 | in_row | |||
) | [inline, protected, inherited] |
Definition at line 1039 of file subview_meat.hpp.
01040 : subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) 01041 { 01042 arma_extra_debug_sigprint(); 01043 }
void subview_row< eT >::operator= | ( | const subview< eT > & | x | ) | [inline, inherited] |
x.submat(...) = y.submat(...)
Reimplemented from subview< eT >.
Definition at line 1050 of file subview_meat.hpp.
Referenced by subview_row< eT >::operator=().
01051 { 01052 arma_extra_debug_sigprint(); 01053 01054 subview<eT>::operator=(X); 01055 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01056 }
void subview_row< eT >::operator= | ( | const subview_row< eT > & | x | ) | [inline, inherited] |
Definition at line 1063 of file subview_meat.hpp.
References subview_row< eT >::operator=().
01064 { 01065 arma_extra_debug_sigprint(); 01066 01067 subview<eT>::operator=(X); // interprets 'subview_row' as 'subview' 01068 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01069 }
void subview_row< eT >::operator= | ( | const Base< eT, T1 > & | x | ) | [inline, inherited] |
Reimplemented from subview< eT >.
Definition at line 1077 of file subview_meat.hpp.
References subview_row< eT >::operator=().
01078 { 01079 arma_extra_debug_sigprint(); 01080 01081 subview<eT>::operator=(X); 01082 arma_debug_check( (subview<eT>::n_rows > 1), "subview_row(): incompatible dimensions" ); 01083 }