| subview_cube_meat.hpp | | subview_cube_meat.hpp | |
| | | | |
| skipping to change at line 502 | | skipping to change at line 502 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "copy into subcube"); | | arma_debug_assert_same_size(t, x, "copy into subcube"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| const u32 t_aux_slice1 = t.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| syslib::copy_elem( t.slice_colptr(t_aux_slice1, col), x.colptr(col), t_
n_rows ); | | syslib::copy_elem( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator+= (const Base<eT,T1>& in) | | subview_cube<eT>::operator+= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube addition"); | | arma_debug_assert_same_size(t, x, "cube addition"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| const u32 t_aux_slice1 = t.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_plus( t.slice_colptr(t_aux_slice1, col), x.colptr(col
), t_n_rows ); | | arrayops::inplace_plus( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator-= (const Base<eT,T1>& in) | | subview_cube<eT>::operator-= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube subtraction"); | | arma_debug_assert_same_size(t, x, "cube subtraction"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| const u32 t_aux_slice1 = t.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_minus( t.slice_colptr(t_aux_slice1, col), x.colptr(co
l), t_n_rows ); | | arrayops::inplace_minus( t.slice_colptr(0, col), x.colptr(col), t_n_row
s ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator%= (const Base<eT,T1>& in) | | subview_cube<eT>::operator%= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "cube schur product"); | | arma_debug_assert_same_size(t, x, "cube schur product"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| const u32 t_aux_slice1 = t.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_mul( t.slice_colptr(t_aux_slice1, col), x.colptr(col)
, t_n_rows ); | | arrayops::inplace_mul( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::operator/= (const Base<eT,T1>& in) | | subview_cube<eT>::operator/= (const Base<eT,T1>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const unwrap<T1> tmp(in.get_ref()); | | const unwrap<T1> tmp(in.get_ref()); | |
| | | | |
| const Mat<eT>& x = tmp.M; | | const Mat<eT>& x = tmp.M; | |
| subview_cube<eT>& t = *this; | | subview_cube<eT>& t = *this; | |
| | | | |
| arma_debug_assert_same_size(t, x, "element-wise cube division"); | | arma_debug_assert_same_size(t, x, "element-wise cube division"); | |
| | | | |
|
| const u32 t_n_rows = t.n_rows; | | const u32 t_n_rows = t.n_rows; | |
| const u32 t_n_cols = t.n_cols; | | const u32 t_n_cols = t.n_cols; | |
| const u32 t_aux_slice1 = t.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < t_n_cols; ++col) | | for(u32 col = 0; col < t_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_div( t.slice_colptr(t_aux_slice1, col), x.colptr(col)
, t_n_rows ); | | arrayops::inplace_div( t.slice_colptr(0, col), x.colptr(col), t_n_rows
); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::fill(const eT val) | | subview_cube<eT>::fill(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| | | | |
| skipping to change at line 887 | | skipping to change at line 882 | |
| //! mat X = Y.subcube(...) | | //! mat X = Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub
cube doesn't have exactly one slice" ); | | arma_debug_check( (in.n_slices != 1), "subview_cube::extract(): given sub
cube doesn't have exactly one slice" ); | |
| | | | |
|
| const u32 n_rows = in.n_rows; | | const u32 n_rows = in.n_rows; | |
| const u32 n_cols = in.n_cols; | | const u32 n_cols = in.n_cols; | |
| const u32 aux_slice1 = in.aux_slice1; | | | |
| | | | |
| out.set_size(n_rows, n_cols); | | out.set_size(n_rows, n_cols); | |
| | | | |
| for(u32 col = 0; col < n_cols; ++col) | | for(u32 col = 0; col < n_cols; ++col) | |
| { | | { | |
|
| syslib::copy_elem( out.colptr(col), in.slice_colptr(aux_slice1, col), n
_rows ); | | syslib::copy_elem( out.colptr(col), in.slice_colptr(0, col), n_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! cube X += Y.subcube(...) | | //! cube X += Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::plus_inplace(Cube<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 1001 | | skipping to change at line 995 | |
| //! mat X += Y.subcube(...) | | //! mat X += Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::plus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix addition"); | | arma_debug_assert_same_size(out, in, "matrix addition"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| const u32 in_aux_slice1 = in.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_plus( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | | arrayops::inplace_plus( out.colptr(col), in.slice_colptr(0, col), in_n_
rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X -= Y.subcube(...) | | //! mat X -= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::minus_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix subtraction"); | | arma_debug_assert_same_size(out, in, "matrix subtraction"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| const u32 in_aux_slice1 = in.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_minus( out.colptr(col), in.slice_colptr(in_aux_slice1
, col), in_n_rows ); | | arrayops::inplace_minus( out.colptr(col), in.slice_colptr(0, col), in_n
_rows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X %= Y.subcube(...) | | //! mat X %= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::schur_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix schur product"); | | arma_debug_assert_same_size(out, in, "matrix schur product"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| const u32 in_aux_slice1 = in.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_mul( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | | arrayops::inplace_mul( out.colptr(col), in.slice_colptr(0, col), in_n_r
ows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! mat X /= Y.subcube(...) | | //! mat X /= Y.subcube(...) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in) | | subview_cube<eT>::div_inplace(Mat<eT>& out, const subview_cube<eT>& in) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_assert_same_size(out, in, "matrix element-wise division"); | | arma_debug_assert_same_size(out, in, "matrix element-wise division"); | |
| | | | |
|
| const u32 in_n_rows = in.n_rows; | | const u32 in_n_rows = in.n_rows; | |
| const u32 in_n_cols = in.n_cols; | | const u32 in_n_cols = in.n_cols; | |
| const u32 in_aux_slice1 = in.aux_slice1; | | | |
| | | | |
| for(u32 col = 0; col < in_n_cols; ++col) | | for(u32 col = 0; col < in_n_cols; ++col) | |
| { | | { | |
|
| arrayops::inplace_div( out.colptr(col), in.slice_colptr(in_aux_slice1,
col), in_n_rows ); | | arrayops::inplace_div( out.colptr(col), in.slice_colptr(0, col), in_n_r
ows ); | |
| } | | } | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 20 change blocks. |
| 40 lines changed or deleted | | 30 lines changed or added | |
|