"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/armadillo_bits/Cube_meat.hpp" between
armadillo-10.2.0.tar.xz and armadillo-10.2.1.tar.xz

About: Armadillo is a C++ linear algebra library (matrix maths) aiming towards a good balance between speed and ease of use.

Cube_meat.hpp  (armadillo-10.2.0.tar.xz):Cube_meat.hpp  (armadillo-10.2.1.tar.xz)
skipping to change at line 1751 skipping to change at line 1751
} }
//! remove specified row //! remove specified row
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::shed_row(const uword row_num) Cube<eT>::shed_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( row_num >= n_rows, "Cube::shed_row(): index out of bounds"); arma_debug_check( row_num >= n_rows, "Cube::shed_row(): index out of bounds" ) ;
shed_rows(row_num, row_num); shed_rows(row_num, row_num);
} }
//! remove specified column //! remove specified column
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::shed_col(const uword col_num) Cube<eT>::shed_col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Cube::shed_col(): index out of bounds"); arma_debug_check( col_num >= n_cols, "Cube::shed_col(): index out of bounds" ) ;
shed_cols(col_num, col_num); shed_cols(col_num, col_num);
} }
//! remove specified slice //! remove specified slice
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::shed_slice(const uword slice_num) Cube<eT>::shed_slice(const uword slice_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): index out of bou nds"); arma_debug_check( slice_num >= n_slices, "Cube::shed_slice(): index out of bou nds" );
shed_slices(slice_num, slice_num); shed_slices(slice_num, slice_num);
} }
//! remove specified rows //! remove specified rows
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::shed_rows(const uword in_row1, const uword in_row2) Cube<eT>::shed_rows(const uword in_row1, const uword in_row2)
{ {
skipping to change at line 1959 skipping to change at line 1959
Cube<eT>::insert_rows(const uword row_num, const uword N, const bool set_to_zero ) Cube<eT>::insert_rows(const uword row_num, const uword N, const bool set_to_zero )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword t_n_rows = n_rows; const uword t_n_rows = n_rows;
const uword A_n_rows = row_num; const uword A_n_rows = row_num;
const uword B_n_rows = t_n_rows - row_num; const uword B_n_rows = t_n_rows - row_num;
// insertion at row_num == n_rows is in effect an append operation // insertion at row_num == n_rows is in effect an append operation
arma_debug_check( (row_num > t_n_rows), "Cube::insert_rows(): index out of bou nds"); arma_debug_check( (row_num > t_n_rows), "Cube::insert_rows(): index out of bou nds" );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(t_n_rows + N, n_cols, n_slices); Cube<eT> out(t_n_rows + N, n_cols, n_slices);
if(A_n_rows > 0) if(A_n_rows > 0)
{ {
out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1); out.rows(0, A_n_rows-1) = rows(0, A_n_rows-1);
} }
skipping to change at line 1997 skipping to change at line 1997
Cube<eT>::insert_cols(const uword col_num, const uword N, const bool set_to_zero ) Cube<eT>::insert_cols(const uword col_num, const uword N, const bool set_to_zero )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword t_n_cols = n_cols; const uword t_n_cols = n_cols;
const uword A_n_cols = col_num; const uword A_n_cols = col_num;
const uword B_n_cols = t_n_cols - col_num; const uword B_n_cols = t_n_cols - col_num;
// insertion at col_num == n_cols is in effect an append operation // insertion at col_num == n_cols is in effect an append operation
arma_debug_check( (col_num > t_n_cols), "Cube::insert_cols(): index out of bou nds"); arma_debug_check( (col_num > t_n_cols), "Cube::insert_cols(): index out of bou nds" );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(n_rows, t_n_cols + N, n_slices); Cube<eT> out(n_rows, t_n_cols + N, n_slices);
if(A_n_cols > 0) if(A_n_cols > 0)
{ {
out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1); out.cols(0, A_n_cols-1) = cols(0, A_n_cols-1);
} }
skipping to change at line 2037 skipping to change at line 2037
Cube<eT>::insert_slices(const uword slice_num, const uword N, const bool set_to_ zero) Cube<eT>::insert_slices(const uword slice_num, const uword N, const bool set_to_ zero)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword t_n_slices = n_slices; const uword t_n_slices = n_slices;
const uword A_n_slices = slice_num; const uword A_n_slices = slice_num;
const uword B_n_slices = t_n_slices - slice_num; const uword B_n_slices = t_n_slices - slice_num;
// insertion at slice_num == n_slices is in effect an append operation // insertion at slice_num == n_slices is in effect an append operation
arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): index out of bounds"); arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): index out of bounds" );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(n_rows, n_cols, t_n_slices + N); Cube<eT> out(n_rows, n_cols, t_n_slices + N);
if(A_n_slices > 0) if(A_n_slices > 0)
{ {
out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1); out.slices(0, A_n_slices-1) = slices(0, A_n_slices-1);
} }
skipping to change at line 2086 skipping to change at line 2086
const Cube<eT>& C = tmp.M; const Cube<eT>& C = tmp.M;
const uword N = C.n_rows; const uword N = C.n_rows;
const uword t_n_rows = n_rows; const uword t_n_rows = n_rows;
const uword A_n_rows = row_num; const uword A_n_rows = row_num;
const uword B_n_rows = t_n_rows - row_num; const uword B_n_rows = t_n_rows - row_num;
// insertion at row_num == n_rows is in effect an append operation // insertion at row_num == n_rows is in effect an append operation
arma_debug_check( (row_num > t_n_rows), "Cube::insert_rows(): index out of b ounds"); arma_debug_check( (row_num > t_n_rows), "Cube::insert_rows(): index out of b ounds" );
arma_debug_check arma_debug_check
( (
( (C.n_cols != n_cols) || (C.n_slices != n_slices) ), ( (C.n_cols != n_cols) || (C.n_slices != n_slices) ),
"Cube::insert_rows(): given object has incompatible dimensions" "Cube::insert_rows(): given object has incompatible dimensions"
); );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(t_n_rows + N, n_cols, n_slices); Cube<eT> out(t_n_rows + N, n_cols, n_slices);
skipping to change at line 2133 skipping to change at line 2133
const Cube<eT>& C = tmp.M; const Cube<eT>& C = tmp.M;
const uword N = C.n_cols; const uword N = C.n_cols;
const uword t_n_cols = n_cols; const uword t_n_cols = n_cols;
const uword A_n_cols = col_num; const uword A_n_cols = col_num;
const uword B_n_cols = t_n_cols - col_num; const uword B_n_cols = t_n_cols - col_num;
// insertion at col_num == n_cols is in effect an append operation // insertion at col_num == n_cols is in effect an append operation
arma_debug_check( (col_num > t_n_cols), "Cube::insert_cols(): index out of b ounds"); arma_debug_check( (col_num > t_n_cols), "Cube::insert_cols(): index out of b ounds" );
arma_debug_check arma_debug_check
( (
( (C.n_rows != n_rows) || (C.n_slices != n_slices) ), ( (C.n_rows != n_rows) || (C.n_slices != n_slices) ),
"Cube::insert_cols(): given object has incompatible dimensions" "Cube::insert_cols(): given object has incompatible dimensions"
); );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(n_rows, t_n_cols + N, n_slices); Cube<eT> out(n_rows, t_n_cols + N, n_slices);
skipping to change at line 2182 skipping to change at line 2182
const Cube<eT>& C = tmp.M; const Cube<eT>& C = tmp.M;
const uword N = C.n_slices; const uword N = C.n_slices;
const uword t_n_slices = n_slices; const uword t_n_slices = n_slices;
const uword A_n_slices = slice_num; const uword A_n_slices = slice_num;
const uword B_n_slices = t_n_slices - slice_num; const uword B_n_slices = t_n_slices - slice_num;
// insertion at slice_num == n_slices is in effect an append operation // insertion at slice_num == n_slices is in effect an append operation
arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): index ou t of bounds"); arma_debug_check( (slice_num > t_n_slices), "Cube::insert_slices(): index ou t of bounds" );
arma_debug_check arma_debug_check
( (
( (C.n_rows != n_rows) || (C.n_cols != n_cols) ), ( (C.n_rows != n_rows) || (C.n_cols != n_cols) ),
"Cube::insert_slices(): given object has incompatible dimensions" "Cube::insert_slices(): given object has incompatible dimensions"
); );
if(N > 0) if(N > 0)
{ {
Cube<eT> out(n_rows, n_cols, t_n_slices + N); Cube<eT> out(n_rows, n_cols, t_n_slices + N);
skipping to change at line 2935 skipping to change at line 2935
return mem_aligned[i]; return mem_aligned[i];
} }
//! linear element accessor (treats the cube as a vector); bounds checking not d one when ARMA_NO_DEBUG is defined //! linear element accessor (treats the cube as a vector); bounds checking not d one when ARMA_NO_DEBUG is defined
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Cube<eT>::operator() (const uword i) Cube<eT>::operator() (const uword i)
{ {
arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds"); arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds" );
return access::rw(mem[i]); return access::rw(mem[i]);
} }
//! linear element accessor (treats the cube as a vector); bounds checking not d one when ARMA_NO_DEBUG is defined //! linear element accessor (treats the cube as a vector); bounds checking not d one when ARMA_NO_DEBUG is defined
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
const eT& const eT&
Cube<eT>::operator() (const uword i) const Cube<eT>::operator() (const uword i) const
{ {
arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds"); arma_debug_check( (i >= n_elem), "Cube::operator(): index out of bounds" );
return mem[i]; return mem[i];
} }
//! linear element accessor (treats the cube as a vector); no bounds check. //! linear element accessor (treats the cube as a vector); no bounds check.
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Cube<eT>::operator[] (const uword i) Cube<eT>::operator[] (const uword i)
skipping to change at line 4308 skipping to change at line 4308
return memptr() + n_elem; return memptr() + n_elem;
} }
template<typename eT> template<typename eT>
inline inline
typename Cube<eT>::slice_iterator typename Cube<eT>::slice_iterator
Cube<eT>::begin_slice(const uword slice_num) Cube<eT>::begin_slice(const uword slice_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds "); arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds " );
return slice_memptr(slice_num); return slice_memptr(slice_num);
} }
template<typename eT> template<typename eT>
inline inline
typename Cube<eT>::const_slice_iterator typename Cube<eT>::const_slice_iterator
Cube<eT>::begin_slice(const uword slice_num) const Cube<eT>::begin_slice(const uword slice_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds "); arma_debug_check( (slice_num >= n_slices), "begin_slice(): index out of bounds " );
return slice_memptr(slice_num); return slice_memptr(slice_num);
} }
template<typename eT> template<typename eT>
inline inline
typename Cube<eT>::slice_iterator typename Cube<eT>::slice_iterator
Cube<eT>::end_slice(const uword slice_num) Cube<eT>::end_slice(const uword slice_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds") ; arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds" );
return slice_memptr(slice_num) + n_elem_slice; return slice_memptr(slice_num) + n_elem_slice;
} }
template<typename eT> template<typename eT>
inline inline
typename Cube<eT>::const_slice_iterator typename Cube<eT>::const_slice_iterator
Cube<eT>::end_slice(const uword slice_num) const Cube<eT>::end_slice(const uword slice_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds") ; arma_debug_check( (slice_num >= n_slices), "end_slice(): index out of bounds" );
return slice_memptr(slice_num) + n_elem_slice; return slice_memptr(slice_num) + n_elem_slice;
} }
//! resets this cube to an empty matrix //! resets this cube to an empty matrix
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::clear() Cube<eT>::clear()
{ {
skipping to change at line 4712 skipping to change at line 4712
return (use_extra) ? mem_local_extra[i] : mem_local[i]; return (use_extra) ? mem_local_extra[i] : mem_local[i];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator() (const u word i) Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator() (const u word i)
{ {
arma_debug_check( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" ); arma_debug_check( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" );
return (use_extra) ? mem_local_extra[i] : mem_local[i]; return (use_extra) ? mem_local_extra[i] : mem_local[i];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
const eT& const eT&
Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator() (const u word i) const Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::operator() (const u word i) const
{ {
arma_debug_check( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" ); arma_debug_check( (i >= fixed_n_elem), "Cube::operator(): index out of bounds" );
return (use_extra) ? mem_local_extra[i] : mem_local[i]; return (use_extra) ? mem_local_extra[i] : mem_local[i];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices> template<uword fixed_n_rows, uword fixed_n_cols, uword fixed_n_slices>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::at(const uword in_r ow, const uword in_col, const uword in_slice) Cube<eT>::fixed<fixed_n_rows, fixed_n_cols, fixed_n_slices>::at(const uword in_r ow, const uword in_col, const uword in_slice)
 End of changes. 17 change blocks. 
17 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)