"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "include/armadillo_bits/Mat_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.

Mat_meat.hpp  (armadillo-10.2.0.tar.xz):Mat_meat.hpp  (armadillo-10.2.1.tar.xz)
skipping to change at line 2747 skipping to change at line 2747
} }
//! creation of subview (column vector) //! creation of subview (column vector)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT> subview_col<eT>
Mat<eT>::col(const uword col_num) Mat<eT>::col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::col(): index out of bounds"); arma_debug_check( col_num >= n_cols, "Mat::col(): index out of bounds" );
return subview_col<eT>(*this, col_num); return subview_col<eT>(*this, col_num);
} }
//! creation of subview (column vector) //! creation of subview (column vector)
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_col<eT> const subview_col<eT>
Mat<eT>::col(const uword col_num) const Mat<eT>::col(const uword col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::col(): index out of bounds"); arma_debug_check( col_num >= n_cols, "Mat::col(): index out of bounds" );
return subview_col<eT>(*this, col_num); return subview_col<eT>(*this, col_num);
} }
template<typename eT> template<typename eT>
inline inline
subview_col<eT> subview_col<eT>
Mat<eT>::operator()(const span& row_span, const uword col_num) Mat<eT>::operator()(const span& row_span, const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 2831 skipping to change at line 2831
//! and does not take into account that the parent matrix object could be delete d. //! and does not take into account that the parent matrix object could be delete d.
//! if deleted memory is accessed by the created Col object, //! if deleted memory is accessed by the created Col object,
//! it will cause memory corruption and/or a crash //! it will cause memory corruption and/or a crash
template<typename eT> template<typename eT>
inline inline
Col<eT> Col<eT>
Mat<eT>::unsafe_col(const uword col_num) Mat<eT>::unsafe_col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds") ; arma_debug_check( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds" );
return Col<eT>(colptr(col_num), n_rows, false, true); return Col<eT>(colptr(col_num), n_rows, false, true);
} }
//! create a Col object which uses memory from an existing matrix object. //! create a Col object which uses memory from an existing matrix object.
//! this approach is currently not alias safe //! this approach is currently not alias safe
//! and does not take into account that the parent matrix object could be delete d. //! and does not take into account that the parent matrix object could be delete d.
//! if deleted memory is accessed by the created Col object, //! if deleted memory is accessed by the created Col object,
//! it will cause memory corruption and/or a crash //! it will cause memory corruption and/or a crash
template<typename eT> template<typename eT>
inline inline
const Col<eT> const Col<eT>
Mat<eT>::unsafe_col(const uword col_num) const Mat<eT>::unsafe_col(const uword col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds") ; arma_debug_check( col_num >= n_cols, "Mat::unsafe_col(): index out of bounds" );
typedef const Col<eT> out_type; typedef const Col<eT> out_type;
return out_type(const_cast<eT*>(colptr(col_num)), n_rows, false, true); return out_type(const_cast<eT*>(colptr(col_num)), n_rows, false, true);
} }
//! creation of subview (submatrix comprised of specified row vectors) //! creation of subview (submatrix comprised of specified row vectors)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview<eT> subview<eT>
skipping to change at line 3236 skipping to change at line 3236
return (*this).submat(in_row1, in_col1, s); return (*this).submat(in_row1, in_col1, s);
} }
template<typename eT> template<typename eT>
inline inline
subview<eT> subview<eT>
Mat<eT>::head_rows(const uword N) Mat<eT>::head_rows(const uword N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds"); arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds" );
return subview<eT>(*this, 0, 0, N, n_cols); return subview<eT>(*this, 0, 0, N, n_cols);
} }
template<typename eT> template<typename eT>
inline inline
const subview<eT> const subview<eT>
Mat<eT>::head_rows(const uword N) const Mat<eT>::head_rows(const uword N) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds"); arma_debug_check( (N > n_rows), "Mat::head_rows(): size out of bounds" );
return subview<eT>(*this, 0, 0, N, n_cols); return subview<eT>(*this, 0, 0, N, n_cols);
} }
template<typename eT> template<typename eT>
inline inline
subview<eT> subview<eT>
Mat<eT>::tail_rows(const uword N) Mat<eT>::tail_rows(const uword N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds"); arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds" );
const uword start_row = n_rows - N; const uword start_row = n_rows - N;
return subview<eT>(*this, start_row, 0, N, n_cols); return subview<eT>(*this, start_row, 0, N, n_cols);
} }
template<typename eT> template<typename eT>
inline inline
const subview<eT> const subview<eT>
Mat<eT>::tail_rows(const uword N) const Mat<eT>::tail_rows(const uword N) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds"); arma_debug_check( (N > n_rows), "Mat::tail_rows(): size out of bounds" );
const uword start_row = n_rows - N; const uword start_row = n_rows - N;
return subview<eT>(*this, start_row, 0, N, n_cols); return subview<eT>(*this, start_row, 0, N, n_cols);
} }
template<typename eT> template<typename eT>
inline inline
subview<eT> subview<eT>
Mat<eT>::head_cols(const uword N) Mat<eT>::head_cols(const uword N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds"); arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds" );
return subview<eT>(*this, 0, 0, n_rows, N); return subview<eT>(*this, 0, 0, n_rows, N);
} }
template<typename eT> template<typename eT>
inline inline
const subview<eT> const subview<eT>
Mat<eT>::head_cols(const uword N) const Mat<eT>::head_cols(const uword N) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds"); arma_debug_check( (N > n_cols), "Mat::head_cols(): size out of bounds" );
return subview<eT>(*this, 0, 0, n_rows, N); return subview<eT>(*this, 0, 0, n_rows, N);
} }
template<typename eT> template<typename eT>
inline inline
subview<eT> subview<eT>
Mat<eT>::tail_cols(const uword N) Mat<eT>::tail_cols(const uword N)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds"); arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds" );
const uword start_col = n_cols - N; const uword start_col = n_cols - N;
return subview<eT>(*this, 0, start_col, n_rows, N); return subview<eT>(*this, 0, start_col, n_rows, N);
} }
template<typename eT> template<typename eT>
inline inline
const subview<eT> const subview<eT>
Mat<eT>::tail_cols(const uword N) const Mat<eT>::tail_cols(const uword N) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds"); arma_debug_check( (N > n_cols), "Mat::tail_cols(): size out of bounds" );
const uword start_col = n_cols - N; const uword start_col = n_cols - N;
return subview<eT>(*this, 0, start_col, n_rows, N); return subview<eT>(*this, 0, start_col, n_rows, N);
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
arma_inline arma_inline
subview_elem1<eT,T1> subview_elem1<eT,T1>
skipping to change at line 3824 skipping to change at line 3824
} }
//! remove specified row //! remove specified row
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::shed_row(const uword row_num) Mat<eT>::shed_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( row_num >= n_rows, "Mat::shed_row(): index out of bounds"); arma_debug_check( row_num >= n_rows, "Mat::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
Mat<eT>::shed_col(const uword col_num) Mat<eT>::shed_col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::shed_col(): index out of bounds"); arma_debug_check( col_num >= n_cols, "Mat::shed_col(): index out of bounds" );
shed_cols(col_num, col_num); shed_cols(col_num, col_num);
} }
//! remove specified rows //! remove specified rows
template<typename eT> template<typename eT>
inline inline
void void
Mat<eT>::shed_rows(const uword in_row1, const uword in_row2) Mat<eT>::shed_rows(const uword in_row1, const uword in_row2)
{ {
skipping to change at line 4058 skipping to change at line 4058
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword t_n_rows = n_rows; const uword t_n_rows = n_rows;
const uword t_n_cols = n_cols; const uword t_n_cols = n_cols;
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), "Mat::insert_rows(): index out of boun ds"); arma_debug_check( (row_num > t_n_rows), "Mat::insert_rows(): index out of boun ds" );
if(N > 0) if(N > 0)
{ {
Mat<eT> out(t_n_rows + N, t_n_cols); Mat<eT> out(t_n_rows + N, t_n_cols);
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 4099 skipping to change at line 4099
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const uword t_n_rows = n_rows; const uword t_n_rows = n_rows;
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), "Mat::insert_cols(): index out of boun ds"); arma_debug_check( (col_num > t_n_cols), "Mat::insert_cols(): index out of boun ds" );
if(N > 0) if(N > 0)
{ {
Mat<eT> out(t_n_rows, t_n_cols + N); Mat<eT> out(t_n_rows, t_n_cols + N);
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 5351 skipping to change at line 5351
return mem_aligned[ii]; return mem_aligned[ii];
} }
//! linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined //! linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::operator() (const uword ii) Mat<eT>::operator() (const uword ii)
{ {
arma_debug_check( (ii >= n_elem), "Mat::operator(): index out of bounds"); arma_debug_check( (ii >= n_elem), "Mat::operator(): index out of bounds" );
return access::rw(mem[ii]); return access::rw(mem[ii]);
} }
//! linear element accessor (treats the matrix as a vector); bounds checking not done when ARMA_NO_DEBUG is defined //! linear element accessor (treats the matrix as a vector); bounds checking not done 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&
Mat<eT>::operator() (const uword ii) const Mat<eT>::operator() (const uword ii) const
{ {
arma_debug_check( (ii >= n_elem), "Mat::operator(): index out of bounds"); arma_debug_check( (ii >= n_elem), "Mat::operator(): index out of bounds" );
return mem[ii]; return mem[ii];
} }
//! linear element accessor (treats the matrix as a vector); no bounds check. //! linear element accessor (treats the matrix as a vector); no bounds check.
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::operator[] (const uword ii) Mat<eT>::operator[] (const uword ii)
skipping to change at line 5415 skipping to change at line 5415
return mem[ii]; return mem[ii];
} }
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined //! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::operator() (const uword in_row, const uword in_col) Mat<eT>::operator() (const uword in_row, const uword in_col)
{ {
arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator() : index out of bounds"); arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator() : index out of bounds" );
return access::rw(mem[in_row + in_col*n_rows]); return access::rw(mem[in_row + in_col*n_rows]);
} }
//! element accessor; bounds checking not done when ARMA_NO_DEBUG is defined //! element accessor; bounds checking not done 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&
Mat<eT>::operator() (const uword in_row, const uword in_col) const Mat<eT>::operator() (const uword in_row, const uword in_col) const
{ {
arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator() : index out of bounds"); arma_debug_check( ((in_row >= n_rows) || (in_col >= n_cols)), "Mat::operator() : index out of bounds" );
return mem[in_row + in_col*n_rows]; return mem[in_row + in_col*n_rows];
} }
//! element accessor; no bounds check //! element accessor; no bounds check
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::at(const uword in_row, const uword in_col) Mat<eT>::at(const uword in_row, const uword in_col)
skipping to change at line 7921 skipping to change at line 7921
return memptr() + n_elem; return memptr() + n_elem;
} }
template<typename eT> template<typename eT>
inline inline
typename Mat<eT>::col_iterator typename Mat<eT>::col_iterator
Mat<eT>::begin_col(const uword col_num) Mat<eT>::begin_col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" ); arma_debug_check( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" );
return colptr(col_num); return colptr(col_num);
} }
template<typename eT> template<typename eT>
inline inline
typename Mat<eT>::const_col_iterator typename Mat<eT>::const_col_iterator
Mat<eT>::begin_col(const uword col_num) const Mat<eT>::begin_col(const uword col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" ); arma_debug_check( (col_num >= n_cols), "Mat::begin_col(): index out of bounds" );
return colptr(col_num); return colptr(col_num);
} }
template<typename eT> template<typename eT>
inline inline
typename Mat<eT>::col_iterator typename Mat<eT>::col_iterator
Mat<eT>::end_col(const uword col_num) Mat<eT>::end_col(const uword col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "Mat::end_col(): index out of bounds"); arma_debug_check( (col_num >= n_cols), "Mat::end_col(): index out of bounds" ) ;
return colptr(col_num) + n_rows; return colptr(col_num) + n_rows;
} }
template<typename eT> template<typename eT>
inline inline
typename Mat<eT>::const_col_iterator typename Mat<eT>::const_col_iterator
Mat<eT>::end_col(const uword col_num) const Mat<eT>::end_col(const uword col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "Mat::end_col(): index out of bounds"); arma_debug_check( (col_num >= n_cols), "Mat::end_col(): index out of bounds" ) ;
return colptr(col_num) + n_rows; return colptr(col_num) + n_rows;
} }
template<typename eT> template<typename eT>
inline inline
typename Mat<eT>::row_iterator typename Mat<eT>::row_iterator
Mat<eT>::begin_row(const uword row_num) Mat<eT>::begin_row(const uword row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 8446 skipping to change at line 8446
return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; return (use_extra) ? mem_local_extra[ii] : mem_local[ii];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword ii) Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword ii)
{ {
arma_debug_check( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" ); arma_debug_check( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" );
return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; return (use_extra) ? mem_local_extra[ii] : mem_local[ii];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
const eT& const eT&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword ii) const Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword ii) const
{ {
arma_debug_check( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" ); arma_debug_check( (ii >= fixed_n_elem), "Mat::operator(): index out of bounds" );
return (use_extra) ? mem_local_extra[ii] : mem_local[ii]; return (use_extra) ? mem_local_extra[ii] : mem_local[ii];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::at(const uword in_row, const uword i n_col) Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::at(const uword in_row, const uword i n_col)
skipping to change at line 8494 skipping to change at line 8494
return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; return (use_extra) ? mem_local_extra[iq] : mem_local[iq];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT& eT&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword in_row, cons t uword in_col) Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword in_row, cons t uword in_col)
{ {
arma_debug_check( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat ::operator(): index out of bounds"); arma_debug_check( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat ::operator(): index out of bounds" );
const uword iq = in_row + in_col*fixed_n_rows; const uword iq = in_row + in_col*fixed_n_rows;
return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; return (use_extra) ? mem_local_extra[iq] : mem_local[iq];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
const eT& const eT&
Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword in_row, cons t uword in_col) const Mat<eT>::fixed<fixed_n_rows, fixed_n_cols>::operator() (const uword in_row, cons t uword in_col) const
{ {
arma_debug_check( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat ::operator(): index out of bounds"); arma_debug_check( ((in_row >= fixed_n_rows) || (in_col >= fixed_n_cols)), "Mat ::operator(): index out of bounds" );
const uword iq = in_row + in_col*fixed_n_rows; const uword iq = in_row + in_col*fixed_n_rows;
return (use_extra) ? mem_local_extra[iq] : mem_local[iq]; return (use_extra) ? mem_local_extra[iq] : mem_local[iq];
} }
template<typename eT> template<typename eT>
template<uword fixed_n_rows, uword fixed_n_cols> template<uword fixed_n_rows, uword fixed_n_cols>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
 End of changes. 28 change blocks. 
28 lines changed or deleted 28 lines changed or added

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