Col_meat.hpp   Col_meat.hpp 
skipping to change at line 194 skipping to change at line 194
const Base<typename Col<eT>::pod_type, T2>& B const Base<typename Col<eT>::pod_type, T2>& B
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::init(A,B); Mat<eT>::init(A,B);
} }
//! construct a column vector from given a subcube; the subcube must have e template<typename eT>
xactly one column template<typename T1>
inline
Col<eT>::Col(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X);
}
template<typename eT>
template<typename T1>
inline
const Col<eT>&
Col<eT>::operator=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>::operator=(X);
return *this;
}
template<typename eT> template<typename eT>
inline inline
Col<eT>::Col(const subview_cube<eT>& X) Col<eT>::Col(const subview_cube<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 1; access::rw(Mat<eT>::vec_state) = 1;
Mat<eT>::operator=(X); Mat<eT>::operator=(X);
} }
//! construct a column vector from given a subcube; the subcube must have e xactly one column
template<typename eT> template<typename eT>
inline inline
const Col<eT>& const Col<eT>&
Col<eT>::operator=(const subview_cube<eT>& X) Col<eT>::operator=(const subview_cube<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
Mat<eT>::operator=(X); Mat<eT>::operator=(X);
return *this; return *this;
skipping to change at line 240 skipping to change at line 263
Col<eT>::row(const u32 row_num) Col<eT>::row(const u32 row_num)
{ {
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bound s" ); arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bound s" );
return access::rw(Mat<eT>::mem[row_num]); return access::rw(Mat<eT>::mem[row_num]);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
Col<eT>::row(const u32 row_num) Col<eT>::row(const u32 row_num) const
const
{ {
arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bound s" ); arma_debug_check( (row_num >= Mat<eT>::n_rows), "Col::row(): out of bound s" );
return Mat<eT>::mem[row_num]; return Mat<eT>::mem[row_num];
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT> subview_col<eT>
Col<eT>::rows(const u32 in_row1, const u32 in_row2) Col<eT>::rows(const u32 in_row1, const u32 in_row2)
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used");
return subview_col<eT>(*this, 0, in_row1, in_row2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_col<eT> const subview_col<eT>
Col<eT>::rows(const u32 in_row1, const u32 in_row2) Col<eT>::rows(const u32 in_row1, const u32 in_row2) const
const
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::rows(): indices out of bounds or incorrectly used");
return subview_col<eT>(*this, 0, in_row1, in_row2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT> subview_col<eT>
Col<eT>::subvec(const u32 in_row1, const u32 in_row2) Col<eT>::subvec(const u32 in_row1, const u32 in_row2)
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used");
return subview_col<eT>(*this, 0, in_row1, in_row2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_col<eT> const subview_col<eT>
Col<eT>::subvec(const u32 in_row1, const u32 in_row2) Col<eT>::subvec(const u32 in_row1, const u32 in_row2) const
const
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= Mat<eT>::n_rows) ) , "Col::subvec(): indices out of bounds or incorrectly used");
return subview_col<eT>(*this, 0, in_row1, in_row2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
return subview_col<eT>(*this, 0, in_row1, subview_n_rows);
} }
//! remove specified row //! remove specified row
template<typename eT> template<typename eT>
inline inline
void void
Col<eT>::shed_row(const u32 row_num) Col<eT>::shed_row(const u32 row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 13 change blocks. 
13 lines changed or deleted 48 lines changed or added


 Col_proto.hpp   Col_proto.hpp 
skipping to change at line 46 skipping to change at line 46
template<typename T1> inline Col(const Base<eT,T1>& X); template<typename T1> inline Col(const Base<eT,T1>& X);
template<typename T1> inline const Col& operator=(const Base<eT,T1>& X); template<typename T1> inline const Col& operator=(const Base<eT,T1>& X);
inline Col( eT* aux_mem, const u32 aux_length, const bool copy_aux_m em = true, const bool strict = true); inline Col( eT* aux_mem, const u32 aux_length, const bool copy_aux_m em = true, const bool strict = true);
inline Col(const eT* aux_mem, const u32 aux_length); inline Col(const eT* aux_mem, const u32 aux_length);
template<typename T1, typename T2> template<typename T1, typename T2>
inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
template<typename T1> inline Col(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Col& operator=(const BaseCube<eT,T1>&
X);
inline Col(const subview_cube<eT>& X); inline Col(const subview_cube<eT>& X);
inline const Col& operator=(const subview_cube<eT>& X); inline const Col& operator=(const subview_cube<eT>& X);
inline mat_injector<Col> operator<<(const eT val); inline mat_injector<Col> operator<<(const eT val);
arma_inline eT& row(const u32 row_num); arma_inline eT& row(const u32 row_num);
arma_inline eT row(const u32 row_num) const; arma_inline eT row(const u32 row_num) const;
arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2); arma_inline subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2);
arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2) const; arma_inline const subview_col<eT> rows(const u32 in_row1, const u32 in_ro w2) const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 Cube_meat.hpp   Cube_meat.hpp 
skipping to change at line 688 skipping to change at line 688
Cube<eT>::slices(const u32 in_slice1, const u32 in_slice2) Cube<eT>::slices(const u32 in_slice1, const u32 in_slice2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_slice1 > in_slice2) || (in_slice2 >= n_slices), (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
"Cube::slices(): indices out of bounds or incorrectly used" "Cube::slices(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, 0, 0, in_slice1, ( (n_rows>0) ? n_rows-1 : const u32 subcube_n_slices = in_slice2 - in_slice1 + 1;
0 ), ( (n_cols>0) ? n_cols-1 : 0 ), in_slice2);
return subview_cube<eT>(*this, 0, 0, in_slice1, n_rows, n_cols, subcube_n
_slices);
} }
//! creation of subview_cube (subcube comprised of specified slices) //! creation of subview_cube (subcube comprised of specified slices)
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_cube<eT> const subview_cube<eT>
Cube<eT>::slices(const u32 in_slice1, const u32 in_slice2) const Cube<eT>::slices(const u32 in_slice1, const u32 in_slice2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_slice1 > in_slice2) || (in_slice2 >= n_slices), (in_slice1 > in_slice2) || (in_slice2 >= n_slices),
"Cube::rows(): indices out of bounds or incorrectly used" "Cube::rows(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, 0, 0, in_slice1, ( (n_rows>0) ? n_rows-1 : const u32 subcube_n_slices = in_slice2 - in_slice1 + 1;
0 ), ( (n_cols>0) ? n_cols-1 : 0 ), in_slice2);
return subview_cube<eT>(*this, 0, 0, in_slice1, n_rows, n_cols, subcube_n
_slices);
} }
//! creation of subview_cube (generic subcube) //! creation of subview_cube (generic subcube)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_cube<eT> subview_cube<eT>
Cube<eT>::subcube(const u32 in_row1, const u32 in_col1, const u32 in_slice1 , const u32 in_row2, const u32 in_col2, const u32 in_slice2) Cube<eT>::subcube(const u32 in_row1, const u32 in_col1, const u32 in_slice1 , const u32 in_row2, const u32 in_col2, const u32 in_slice2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) || (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) ||
(in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) , (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) ,
"Cube::subcube(): indices out of bounds or incorrectly used" "Cube::subcube(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c const u32 subcube_n_rows = in_row2 - in_row1 + 1;
ol2, in_slice2); const u32 subcube_n_cols = in_col2 - in_col1 + 1;
const u32 subcube_n_slices = in_slice2 - in_slice1 + 1;
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, subcube_n_row
s, subcube_n_cols, subcube_n_slices);
} }
//! creation of subview_cube (generic subcube) //! creation of subview_cube (generic subcube)
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_cube<eT> const subview_cube<eT>
Cube<eT>::subcube(const u32 in_row1, const u32 in_col1, const u32 in_slice1 , const u32 in_row2, const u32 in_col2, const u32 in_slice2) const Cube<eT>::subcube(const u32 in_row1, const u32 in_col1, const u32 in_slice1 , const u32 in_row2, const u32 in_col2, const u32 in_slice2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) || (in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ) ||
(in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) , (in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) ,
"Cube::subcube(): indices out of bounds or incorrectly used" "Cube::subcube(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c const u32 subcube_n_rows = in_row2 - in_row1 + 1;
ol2, in_slice2); const u32 subcube_n_cols = in_col2 - in_col1 + 1;
const u32 subcube_n_slices = in_slice2 - in_slice1 + 1;
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, subcube_n_row
s, subcube_n_cols, subcube_n_slices);
} }
//! creation of subview_cube (generic subcube) //! creation of subview_cube (generic subcube)
template<typename eT> template<typename eT>
arma_inline inline
subview_cube<eT> subview_cube<eT>
Cube<eT>::subcube(const span& row_span, const span& col_span, const span& s lice_span) Cube<eT>::subcube(const span& row_span, const span& col_span, const span& s lice_span)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; const bool row_all = row_span.whole;
const u32 in_row2 = row_span.b; const bool col_all = col_span.whole;
const bool slice_all = slice_span.whole;
const u32 in_col1 = col_span.a;
const u32 in_col2 = col_span.b; const u32 local_n_rows = n_rows;
const u32 local_n_cols = n_cols;
const u32 in_slice1 = slice_span.a; const u32 local_n_slices = n_slices;
const u32 in_slice2 = slice_span.b;
const u32 in_row1 = row_all ? 0 : row_span.a;
const u32 in_row2 = row_span.b;
const u32 subcube_n_rows = row_all ? local_n_rows : in_row2 - in_ro
w1 + 1;
const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 in_col2 = col_span.b;
const u32 subcube_n_cols = col_all ? local_n_cols : in_col2 - in_co
l1 + 1;
const u32 in_slice1 = slice_all ? 0 : slice_span.a;
const u32 in_slice2 = slice_span.b;
const u32 subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_
slice1 + 1;
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_
) || n_rows)) )
(in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) ||
, ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_
n_cols)) )
||
( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_
n_slices)) )
,
"Cube::subcube(): indices out of bounds or incorrectly used" "Cube::subcube(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c ol2, in_slice2); return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, subcube_n_row s, subcube_n_cols, subcube_n_slices);
} }
//! creation of subview_cube (generic subcube) //! creation of subview_cube (generic subcube)
template<typename eT> template<typename eT>
arma_inline inline
const subview_cube<eT> const subview_cube<eT>
Cube<eT>::subcube(const span& row_span, const span& col_span, const span& s lice_span) const Cube<eT>::subcube(const span& row_span, const span& col_span, const span& s lice_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; const bool row_all = row_span.whole;
const u32 in_row2 = row_span.b; const bool col_all = col_span.whole;
const bool slice_all = slice_span.whole;
const u32 in_col1 = col_span.a;
const u32 in_col2 = col_span.b; const u32 local_n_rows = n_rows;
const u32 local_n_cols = n_cols;
const u32 in_slice1 = slice_span.a; const u32 local_n_slices = n_slices;
const u32 in_slice2 = slice_span.b;
const u32 in_row1 = row_all ? 0 : row_span.a;
const u32 in_row2 = row_span.b;
const u32 subcube_n_rows = row_all ? local_n_rows : in_row2 - in_ro
w1 + 1;
const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 in_col2 = col_span.b;
const u32 subcube_n_cols = col_all ? local_n_cols : in_col2 - in_co
l1 + 1;
const u32 in_slice1 = slice_all ? 0 : slice_span.a;
const u32 in_slice2 = slice_span.b;
const u32 subcube_n_slices = slice_all ? local_n_slices : in_slice2 - in_
slice1 + 1;
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_slice1 > in_slice2 ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_
) || n_rows)) )
(in_row2 >= n_rows) || (in_col2 >= n_cols) || (in_slice2 >= n_slices) ||
, ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_
n_cols)) )
||
( slice_all ? false : ((in_slice1 > in_slice2) || (in_slice2 >= local_
n_slices)) )
,
"Cube::subcube(): indices out of bounds or incorrectly used" "Cube::subcube(): indices out of bounds or incorrectly used"
); );
return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, in_row2, in_c return subview_cube<eT>(*this, in_row1, in_col1, in_slice1, subcube_n_row
ol2, in_slice2); s, subcube_n_cols, subcube_n_slices);
}
template<typename eT>
inline
subview_cube<eT>
Cube<eT>::operator()(const span& row_span, const span& col_span, const span
& slice_span)
{
arma_extra_debug_sigprint();
return (*this).subcube(row_span, col_span, slice_span);
}
template<typename eT>
inline
const subview_cube<eT>
Cube<eT>::operator()(const span& row_span, const span& col_span, const span
& slice_span) const
{
arma_extra_debug_sigprint();
return (*this).subcube(row_span, col_span, slice_span);
} }
//! remove specified slice //! remove specified slice
template<typename eT> template<typename eT>
inline inline
void void
Cube<eT>::shed_slice(const u32 slice_num) Cube<eT>::shed_slice(const u32 slice_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 12 change blocks. 
37 lines changed or deleted 109 lines changed or added


 Cube_proto.hpp   Cube_proto.hpp 
skipping to change at line 93 skipping to change at line 93
arma_inline Mat<eT>& slice(const u32 in_slice); arma_inline Mat<eT>& slice(const u32 in_slice);
arma_inline const Mat<eT>& slice(const u32 in_slice) const; arma_inline const Mat<eT>& slice(const u32 in_slice) const;
arma_inline subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2); arma_inline subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2);
arma_inline const subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2) const; arma_inline const subview_cube<eT> slices(const u32 in_slice1, const u32 in_slice2) const;
arma_inline subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2); arma_inline subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2);
arma_inline const subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2) const; arma_inline const subview_cube<eT> subcube(const u32 in_row1, const u32 i n_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, const u3 2 in_slice2) const;
arma_inline subview_cube<eT> subcube(const span& row_span, const sp inline subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span); an& col_span, const span& slice_span);
arma_inline const subview_cube<eT> subcube(const span& row_span, const sp inline const subview_cube<eT> subcube(const span& row_span, const sp
an& col_span, const span& slice_span) const; an& col_span, const span& slice_span) const;
inline subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span);
inline const subview_cube<eT> operator()(const span& row_span, const
span& col_span, const span& slice_span) const;
inline void shed_slice(const u32 slice_num); inline void shed_slice(const u32 slice_num);
inline void shed_slices(const u32 in_slice1, const u32 in_slice2); inline void shed_slices(const u32 in_slice1, const u32 in_slice2);
inline void insert_slices(const u32 slice_num, const u32 N, const bool se t_to_zero = true); inline void insert_slices(const u32 slice_num, const u32 N, const bool se t_to_zero = true);
template<typename T1> template<typename T1>
inline void insert_slices(const u32 row_num, const BaseCube<eT,T1>& X); inline void insert_slices(const u32 row_num, const BaseCube<eT,T1>& X);
 End of changes. 1 change blocks. 
4 lines changed or deleted 9 lines changed or added


 Mat_meat.hpp   Mat_meat.hpp 
skipping to change at line 593 skipping to change at line 593
} }
//! in-place matrix addition //! in-place matrix addition
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator+=(const Mat<eT>& m) Mat<eT>::operator+=(const Mat<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "matrix addition"); arma_debug_assert_same_size(*this, m, "addition");
arrayops::inplace_plus( memptr(), m.memptr(), n_elem ); arrayops::inplace_plus( memptr(), m.memptr(), n_elem );
return *this; return *this;
} }
//! in-place matrix subtraction //! in-place matrix subtraction
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator-=(const Mat<eT>& m) Mat<eT>::operator-=(const Mat<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "matrix subtraction"); arma_debug_assert_same_size(*this, m, "subtraction");
arrayops::inplace_minus( memptr(), m.memptr(), n_elem ); arrayops::inplace_minus( memptr(), m.memptr(), n_elem );
return *this; return *this;
} }
//! in-place matrix multiplication //! in-place matrix multiplication
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
skipping to change at line 636 skipping to change at line 636
} }
//! in-place element-wise matrix multiplication //! in-place element-wise matrix multiplication
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator%=(const Mat<eT>& m) Mat<eT>::operator%=(const Mat<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise matrix multplication" ); arma_debug_assert_same_size(*this, m, "element-wise multiplication");
arrayops::inplace_mul( memptr(), m.memptr(), n_elem ); arrayops::inplace_mul( memptr(), m.memptr(), n_elem );
return *this; return *this;
} }
//! in-place element-wise matrix division //! in-place element-wise matrix division
template<typename eT> template<typename eT>
inline inline
const Mat<eT>& const Mat<eT>&
Mat<eT>::operator/=(const Mat<eT>& m) Mat<eT>::operator/=(const Mat<eT>& m)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_assert_same_size(*this, m, "element-wise matrix division"); arma_debug_assert_same_size(*this, m, "element-wise division");
arrayops::inplace_div( memptr(), m.memptr(), n_elem ); arrayops::inplace_div( memptr(), m.memptr(), n_elem );
return *this; return *this;
} }
template<typename eT>
template<typename T1>
inline
Mat<eT>::Mat(const BaseCube<eT,T1>& X)
: n_rows(0)
, n_cols(0)
, n_elem(0)
, vec_state(0)
, mem_state(0)
, mem(mem) //, mem(0)
{
arma_extra_debug_sigprint_this(this);
(*this).operator=(X);
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>& out = *this;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& in = tmp.M;
arma_debug_assert_cube_as_mat(out, in, "copy into matrix", false);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
out.set_size(in_n_rows, in_n_cols);
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::copy( out.colptr(col), in.slice_colptr(0, col), in_n_rows )
;
}
}
else
{
if(out_vec_state == 0)
{
if(in_n_cols == 1)
{
out.set_size(in_n_rows, in_n_slices);
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows )
;
}
}
else
if(in_n_rows == 1)
{
out.set_size(in_n_slices, in_n_cols);
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] = in.at(0, col, i);
}
}
}
}
else
{
out.set_size(in_n_slices);
eT* out_mem = out.memptr();
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] = in.at(0, 0, i);
}
}
}
return *this;
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator+=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>& out = *this;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& in = tmp.M;
arma_debug_assert_cube_as_mat(out, in, "addition", true);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::inplace_plus( out.colptr(col), in.slice_colptr(0, col), in_
n_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_
n_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] += in.at(0, col, i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] += in.at(0, 0, i);
}
}
}
return *this;
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator-=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>& out = *this;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& in = tmp.M;
arma_debug_assert_cube_as_mat(out, in, "subtraction", true);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::inplace_minus( out.colptr(col), in.slice_colptr(0, col), in
_n_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in
_n_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] -= in.at(0, col, i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] -= in.at(0, 0, i);
}
}
}
return *this;
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator*=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
const Mat<eT> B(X);
(*this).operator*=(B);
return *this;
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator%=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>& out = *this;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& in = tmp.M;
arma_debug_assert_cube_as_mat(out, in, "element-wise multiplication", tru
e);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::inplace_mul( out.colptr(col), in.slice_colptr(0, col), in_n
_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] *= in.at(0, col, i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] *= in.at(0, 0, i);
}
}
}
return *this;
}
template<typename eT>
template<typename T1>
inline
const Mat<eT>&
Mat<eT>::operator/=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>& out = *this;
const unwrap_cube<T1> tmp(X.get_ref());
const Cube<eT>& in = tmp.M;
arma_debug_assert_cube_as_mat(out, in, "element-wise division", true);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::inplace_div( out.colptr(col), in.slice_colptr(0, col), in_n
_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] /= in.at(0, col, i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] /= in.at(0, 0, i);
}
}
}
return *this;
}
//! for constructing a complex matrix out of two non-complex matrices //! for constructing a complex matrix out of two non-complex matrices
template<typename eT> template<typename eT>
template<typename T1, typename T2> template<typename T1, typename T2>
inline inline
Mat<eT>::Mat Mat<eT>::Mat
( (
const Base<typename Mat<eT>::pod_type,T1>& A, const Base<typename Mat<eT>::pod_type,T1>& A,
const Base<typename Mat<eT>::pod_type,T2>& B const Base<typename Mat<eT>::pod_type,T2>& B
) )
: n_rows(0) : n_rows(0)
skipping to change at line 1072 skipping to change at line 1454
inline inline
mat_injector< Mat<eT> > mat_injector< Mat<eT> >
Mat<eT>::operator<<(const eT val) Mat<eT>::operator<<(const eT val)
{ {
return mat_injector< Mat<eT> >(*this, val); return mat_injector< Mat<eT> >(*this, val);
} }
template<typename eT> template<typename eT>
inline inline
mat_injector< Mat<eT> > mat_injector< Mat<eT> >
Mat<eT>::operator<<(const injector_helper x) Mat<eT>::operator<<(const injector_end_of_row& x)
{ {
return mat_injector< Mat<eT> >(*this, x); return mat_injector< Mat<eT> >(*this, x);
} }
//! creation of subview (row vector) //! creation of subview (row vector)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT> subview_row<eT>
Mat<eT>::row(const u32 row_num) Mat<eT>::row(const u32 row_num)
{ {
skipping to change at line 1104 skipping to change at line 1486
Mat<eT>::row(const u32 row_num) const Mat<eT>::row(const u32 row_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" ); arma_debug_check( row_num >= n_rows, "Mat::row(): out of bounds" );
return subview_row<eT>(*this, row_num); return subview_row<eT>(*this, row_num);
} }
template<typename eT> template<typename eT>
arma_inline inline
subview_row<eT> subview_row<eT>
Mat<eT>::operator()(const u32 row_num, const span_helper) Mat<eT>::operator()(const u32 row_num, const span& col_span)
{
arma_extra_debug_sigprint();
arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bound
s" );
return subview_row<eT>(*this, row_num);
}
template<typename eT>
arma_inline
const subview_row<eT>
Mat<eT>::operator()(const u32 row_num, const span_helper) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= n_rows), "Mat::operator(): row out of bound const bool col_all = col_span.whole;
s" );
return subview_row<eT>(*this, row_num);
}
template<typename eT> const u32 local_n_cols = n_cols;
arma_inline
subview_row<eT>
Mat<eT>::operator()(const u32 row_num, const span& col_span)
{
arma_extra_debug_sigprint();
const u32 a = col_span.a; const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 b = col_span.b; const u32 in_col2 = col_span.b;
const u32 submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
arma_debug_check arma_debug_check
( (
(row_num >= n_rows) || (a > b) || (b >= n_cols), (row_num >= n_rows)
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"Mat::operator(): indices out of bounds or incorrectly used" "Mat::operator(): indices out of bounds or incorrectly used"
); );
return subview_row<eT>(*this, row_num, a, b); return subview_row<eT>(*this, row_num, in_col1, submat_n_cols);
} }
template<typename eT> template<typename eT>
arma_inline inline
const subview_row<eT> const subview_row<eT>
Mat<eT>::operator()(const u32 row_num, const span& col_span) const Mat<eT>::operator()(const u32 row_num, const span& col_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 a = col_span.a; const bool col_all = col_span.whole;
const u32 b = col_span.b;
const u32 local_n_cols = n_cols;
const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 in_col2 = col_span.b;
const u32 submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
arma_debug_check arma_debug_check
( (
(row_num >= n_rows) || (a > b) || (b >= n_cols), (row_num >= n_rows)
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"Mat::operator(): indices out of bounds or incorrectly used" "Mat::operator(): indices out of bounds or incorrectly used"
); );
return subview_row<eT>(*this, row_num, a, b); return subview_row<eT>(*this, row_num, in_col1, submat_n_cols);
} }
//! 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 u32 col_num) Mat<eT>::col(const u32 col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1192 skipping to change at line 1566
Mat<eT>::col(const u32 col_num) const Mat<eT>::col(const u32 col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds"); arma_debug_check( col_num >= n_cols, "Mat::col(): out of bounds");
return subview_col<eT>(*this, col_num); return subview_col<eT>(*this, col_num);
} }
template<typename eT> template<typename eT>
arma_inline inline
subview_col<eT> subview_col<eT>
Mat<eT>::operator()(const span_helper, const u32 col_num) Mat<eT>::operator()(const span& row_span, const u32 col_num)
{
arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of boun
ds");
return subview_col<eT>(*this, col_num);
}
template<typename eT>
arma_inline
const subview_col<eT>
Mat<eT>::operator()(const span_helper, const u32 col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( col_num >= n_cols, "Mat::operator(): column out of boun ds"); const bool row_all = row_span.whole;
return subview_col<eT>(*this, col_num); const u32 local_n_rows = n_rows;
}
template<typename eT> const u32 in_row1 = row_all ? 0 : row_span.a;
arma_inline const u32 in_row2 = row_span.b;
subview_col<eT> const u32 submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
Mat<eT>::operator()(const span& row_span, const u32 col_num)
{
arma_extra_debug_sigprint();
const u32 a = row_span.a;
const u32 b = row_span.b;
arma_debug_check arma_debug_check
( (
(col_num >= n_cols) || (a > b) || (b >= n_rows), (col_num >= n_cols)
||
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
)
,
"Mat::operator(): indices out of bounds or incorrectly used" "Mat::operator(): indices out of bounds or incorrectly used"
); );
return subview_col<eT>(*this, col_num, a, b); return subview_col<eT>(*this, col_num, in_row1, submat_n_rows);
} }
template<typename eT> template<typename eT>
arma_inline inline
const subview_col<eT> const subview_col<eT>
Mat<eT>::operator()(const span& row_span, const u32 col_num) const Mat<eT>::operator()(const span& row_span, const u32 col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 a = row_span.a; const bool row_all = row_span.whole;
const u32 b = row_span.b;
const u32 local_n_rows = n_rows;
const u32 in_row1 = row_all ? 0 : row_span.a;
const u32 in_row2 = row_span.b;
const u32 submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
arma_debug_check arma_debug_check
( (
(col_num >= n_cols) || (a > b) || (b >= n_rows), (col_num >= n_cols)
||
( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
)
,
"Mat::operator(): indices out of bounds or incorrectly used" "Mat::operator(): indices out of bounds or incorrectly used"
); );
return subview_col<eT>(*this, col_num, a, b); return subview_col<eT>(*this, col_num, in_row1, submat_n_rows);
} }
//! 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 d eleted. //! and does not take into account that the parent matrix object could be d eleted.
//! 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>
skipping to change at line 1301 skipping to change at line 1667
Mat<eT>::rows(const u32 in_row1, const u32 in_row2) Mat<eT>::rows(const u32 in_row1, const u32 in_row2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_row2 >= n_rows), (in_row1 > in_row2) || (in_row2 >= n_rows),
"Mat::rows(): indices out of bounds or incorrectly used" "Mat::rows(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0 const u32 subview_n_rows = in_row2 - in_row1 + 1;
) );
return subview<eT>(*this, in_row1, 0, subview_n_rows, n_cols );
} }
//! 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
const subview<eT> const subview<eT>
Mat<eT>::rows(const u32 in_row1, const u32 in_row2) const Mat<eT>::rows(const u32 in_row1, const u32 in_row2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_row2 >= n_rows), (in_row1 > in_row2) || (in_row2 >= n_rows),
"Mat::rows(): indices out of bounds or incorrectly used" "Mat::rows(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, 0, in_row2, ((n_cols>0) ? n_cols-1 : 0 const u32 subview_n_rows = in_row2 - in_row1 + 1;
) );
return subview<eT>(*this, in_row1, 0, subview_n_rows, n_cols );
} }
//! creation of subview (submatrix comprised of specified column vectors) //! creation of subview (submatrix comprised of specified column vectors)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview<eT> subview<eT>
Mat<eT>::cols(const u32 in_col1, const u32 in_col2) Mat<eT>::cols(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_col1 > in_col2) || (in_col2 >= n_cols), (in_col1 > in_col2) || (in_col2 >= n_cols),
"Mat::cols(): indices out of bounds or incorrectly used" "Mat::cols(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col const u32 subview_n_cols = in_col2 - in_col1 + 1;
2);
return subview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
} }
//! creation of subview (submatrix comprised of specified column vectors) //! creation of subview (submatrix comprised of specified column vectors)
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview<eT> const subview<eT>
Mat<eT>::cols(const u32 in_col1, const u32 in_col2) const Mat<eT>::cols(const u32 in_col1, const u32 in_col2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_col1 > in_col2) || (in_col2 >= n_cols), (in_col1 > in_col2) || (in_col2 >= n_cols),
"Mat::cols(): indices out of bounds or incorrectly used" "Mat::cols(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, 0, in_col1, ((n_rows>0) ? n_rows-1 : 0), in_col const u32 subview_n_cols = in_col2 - in_col1 + 1;
2);
return subview<eT>(*this, 0, in_col1, n_rows, subview_n_cols);
} }
//! creation of subview (submatrix) //! creation of subview (submatrix)
template<typename eT> template<typename eT>
arma_inline arma_inline
subview<eT> subview<eT>
Mat<eT>::submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, co nst u32 in_col2) Mat<eT>::submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, co nst u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( in_col2 >= n_cols), (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( in_col2 >= n_cols),
"Mat::submat(): indices out of bounds or incorrectly used" "Mat::submat(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_col
s);
} }
//! creation of subview (generic submatrix) //! creation of subview (generic submatrix)
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview<eT> const subview<eT>
Mat<eT>::submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, co nst u32 in_col2) const Mat<eT>::submat(const u32 in_row1, const u32 in_col1, const u32 in_row2, co nst u32 in_col2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( in_col2 >= n_cols), (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( in_col2 >= n_cols),
"Mat::submat(): indices out of bounds or incorrectly used" "Mat::submat(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); const u32 subview_n_rows = in_row2 - in_row1 + 1;
const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview<eT>(*this, in_row1, in_col1, subview_n_rows, subview_n_col
s);
} }
//! creation of subview (submatrix) //! creation of subview (submatrix)
template<typename eT> template<typename eT>
arma_inline inline
subview<eT> subview<eT>
Mat<eT>::submat(const span& row_span, const span& col_span) Mat<eT>::submat(const span& row_span, const span& col_span)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; const bool row_all = row_span.whole;
const u32 in_row2 = row_span.b; const bool col_all = col_span.whole;
const u32 in_col1 = col_span.a; const u32 local_n_rows = n_rows;
const u32 in_col2 = col_span.b; const u32 local_n_cols = n_cols;
const u32 in_row1 = row_all ? 0 : row_span.a;
const u32 in_row2 = row_span.b;
const u32 submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 in_col2 = col_span.b;
const u32 submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
in_col2 >= n_cols), )
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"Mat::submat(): indices out of bounds or incorrectly used" "Mat::submat(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); return subview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_cols) ;
} }
//! creation of subview (generic submatrix) //! creation of subview (generic submatrix)
template<typename eT> template<typename eT>
arma_inline inline
const subview<eT> const subview<eT>
Mat<eT>::submat(const span& row_span, const span& col_span) const Mat<eT>::submat(const span& row_span, const span& col_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; const bool row_all = row_span.whole;
const u32 in_row2 = row_span.b; const bool col_all = col_span.whole;
const u32 in_col1 = col_span.a; const u32 local_n_rows = n_rows;
const u32 in_col2 = col_span.b; const u32 local_n_cols = n_cols;
const u32 in_row1 = row_all ? 0 : row_span.a;
const u32 in_row2 = row_span.b;
const u32 submat_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1;
const u32 in_col1 = col_all ? 0 : col_span.a;
const u32 in_col2 = col_span.b;
const u32 submat_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1;
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || ( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows))
in_col2 >= n_cols), )
||
( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols))
)
,
"Mat::submat(): indices out of bounds or incorrectly used" "Mat::submat(): indices out of bounds or incorrectly used"
); );
return subview<eT>(*this, in_row1, in_col1, in_row2, in_col2); return subview<eT>(*this, in_row1, in_col1, submat_n_rows, submat_n_cols) ;
} }
template<typename eT> template<typename eT>
arma_inline inline
subview<eT> subview<eT>
Mat<eT>::operator()(const span& row_span, const span& col_span) Mat<eT>::operator()(const span& row_span, const span& col_span)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return submat(row_span, col_span); return (*this).submat(row_span, col_span);
} }
template<typename eT> template<typename eT>
arma_inline inline
const subview<eT> const subview<eT>
Mat<eT>::operator()(const span& row_span, const span& col_span) const Mat<eT>::operator()(const span& row_span, const span& col_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
return submat(row_span, col_span); return (*this).submat(row_span, col_span);
} }
template<typename eT> template<typename eT>
template<typename T1> template<typename T1>
arma_inline arma_inline
subview_elem1<eT,T1> subview_elem1<eT,T1>
Mat<eT>::elem(const Base<u32,T1>& a) Mat<eT>::elem(const Base<u32,T1>& a)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 2782 skipping to change at line 3184
//! returns true if the given start and end indices are currently in range //! returns true if the given start and end indices are currently in range
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const span& x) const Mat<eT>::in_range(const span& x) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 a = x.a; if(x.whole == true)
const u32 b = x.b; {
return true;
}
else
{
const u32 a = x.a;
const u32 b = x.b;
return ( (a <= b) && (b < n_elem) ); return ( (a <= b) && (b < n_elem) );
}
} }
//! returns true if the given location is currently in range //! returns true if the given location is currently in range
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const u32 in_row, const u32 in_col) const Mat<eT>::in_range(const u32 in_row, const u32 in_col) const
{ {
return ( (in_row < n_rows) && (in_col < n_cols) ); return ( (in_row < n_rows) && (in_col < n_cols) );
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const span& row_span, const u32 in_col) const Mat<eT>::in_range(const span& row_span, const u32 in_col) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; if(row_span.whole == true)
const u32 in_row2 = row_span.b; {
return (in_col < n_cols);
return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols) }
); else
} {
const u32 in_row1 = row_span.a;
template<typename eT> const u32 in_row2 = row_span.b;
arma_inline
arma_warn_unused
bool
Mat<eT>::in_range(const span& row_span, const span_helper) const
{
arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a;
const u32 in_row2 = row_span.b;
return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (n_cols > 0) ); return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols
) );
}
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const u32 in_row, const span& col_span) const Mat<eT>::in_range(const u32 in_row, const span& col_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_col1 = col_span.a; if(col_span.whole == true)
const u32 in_col2 = col_span.b; {
return (in_row < n_rows);
return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols) }
); else
} {
const u32 in_col1 = col_span.a;
template<typename eT> const u32 in_col2 = col_span.b;
arma_inline
arma_warn_unused
bool
Mat<eT>::in_range(const span_helper, const span& col_span) const
{
arma_extra_debug_sigprint();
const u32 in_col1 = col_span.a;
const u32 in_col2 = col_span.b;
return ( (n_rows > 0) && (in_col1 <= in_col2) && (in_col2 < n_cols) ); return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols
) );
}
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
bool bool
Mat<eT>::in_range(const span& row_span, const span& col_span) const Mat<eT>::in_range(const span& row_span, const span& col_span) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const u32 in_row1 = row_span.a; const u32 in_row1 = row_span.a;
const u32 in_row2 = row_span.b; const u32 in_row2 = row_span.b;
const u32 in_col1 = col_span.a; const u32 in_col1 = col_span.a;
const u32 in_col2 = col_span.b; const u32 in_col2 = col_span.b;
return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col1 <= in_col const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (i
2) && (in_col2 < n_cols) ); n_row2 < n_rows) );
const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (i
n_col2 < n_cols) );
return ( (rows_ok == true) && (cols_ok == true) );
} }
//! returns a pointer to array of eTs for a specified column; no bounds che ck //! returns a pointer to array of eTs for a specified column; no bounds che ck
template<typename eT> template<typename eT>
arma_inline arma_inline
arma_warn_unused arma_warn_unused
eT* eT*
Mat<eT>::colptr(const u32 in_col) Mat<eT>::colptr(const u32 in_col)
{ {
return & access::rw(mem[in_col*n_rows]); return & access::rw(mem[in_col*n_rows]);
 End of changes. 55 change blocks. 
145 lines changed or deleted 564 lines changed or added


 Mat_proto.hpp   Mat_proto.hpp 
skipping to change at line 71 skipping to change at line 71
arma_inline const Mat& operator/=(const eT val); arma_inline const Mat& operator/=(const eT val);
inline Mat(const Mat& m); inline Mat(const Mat& m);
inline const Mat& operator=(const Mat& m); inline const Mat& operator=(const Mat& m);
inline const Mat& operator+=(const Mat& m); inline const Mat& operator+=(const Mat& m);
inline const Mat& operator-=(const Mat& m); inline const Mat& operator-=(const Mat& m);
inline const Mat& operator*=(const Mat& m); inline const Mat& operator*=(const Mat& m);
inline const Mat& operator%=(const Mat& m); inline const Mat& operator%=(const Mat& m);
inline const Mat& operator/=(const Mat& m); inline const Mat& operator/=(const Mat& m);
template<typename T1> inline Mat(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator=(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator+=(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator-=(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator*=(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator%=(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Mat& operator/=(const BaseCube<eT,T1>&
X);
template<typename T1, typename T2> template<typename T1, typename T2>
inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
inline Mat(const subview<eT>& X); inline Mat(const subview<eT>& X);
inline const Mat& operator=(const subview<eT>& X); inline const Mat& operator=(const subview<eT>& X);
inline const Mat& operator+=(const subview<eT>& X); inline const Mat& operator+=(const subview<eT>& X);
inline const Mat& operator-=(const subview<eT>& X); inline const Mat& operator-=(const subview<eT>& X);
inline const Mat& operator*=(const subview<eT>& X); inline const Mat& operator*=(const subview<eT>& X);
inline const Mat& operator%=(const subview<eT>& X); inline const Mat& operator%=(const subview<eT>& X);
inline const Mat& operator/=(const subview<eT>& X); inline const Mat& operator/=(const subview<eT>& X);
skipping to change at line 109 skipping to change at line 117
template<typename T1> inline Mat(const subview_elem1<eT ,T1>& X); template<typename T1> inline Mat(const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator= (const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator= (const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator+=(const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator+=(const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator-=(const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator-=(const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator*=(const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator*=(const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator%=(const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator%=(const subview_elem1<eT ,T1>& X);
template<typename T1> inline const Mat& operator/=(const subview_elem1<eT ,T1>& X); template<typename T1> inline const Mat& operator/=(const subview_elem1<eT ,T1>& X);
inline mat_injector<Mat> operator<<(const eT val); inline mat_injector<Mat> operator<<(const eT val);
inline mat_injector<Mat> operator<<(const injector_helper x); inline mat_injector<Mat> operator<<(const injector_end_of_row& x);
arma_inline subview_row<eT> row(const u32 row_num); arma_inline subview_row<eT> row(const u32 row_num);
arma_inline const subview_row<eT> row(const u32 row_num) const; arma_inline const subview_row<eT> row(const u32 row_num) const;
arma_inline subview_row<eT> operator()(const u32 row_num, const spa inline subview_row<eT> operator()(const u32 row_num, const spa
n_helper); n& col_span);
arma_inline const subview_row<eT> operator()(const u32 row_num, const spa inline const subview_row<eT> operator()(const u32 row_num, const spa
n_helper) const; n& col_span) const;
arma_inline subview_row<eT> operator()(const u32 row_num, const spa
n& col_span);
arma_inline const subview_row<eT> operator()(const u32 row_num, const spa
n& col_span) const;
arma_inline subview_col<eT> col(const u32 col_num); arma_inline subview_col<eT> col(const u32 col_num);
arma_inline const subview_col<eT> col(const u32 col_num) const; arma_inline const subview_col<eT> col(const u32 col_num) const;
arma_inline subview_col<eT> operator()(const span_helper, const inline subview_col<eT> operator()(const span& row_span, const
u32 col_num); u32 col_num);
arma_inline const subview_col<eT> operator()(const span_helper, const inline const subview_col<eT> operator()(const span& row_span, const
u32 col_num) const; u32 col_num) const;
arma_inline subview_col<eT> operator()(const span& row_span, const
u32 col_num);
arma_inline const subview_col<eT> operator()(const span& row_span, const
u32 col_num) const;
inline Col<eT> unsafe_col(const u32 col_num); inline Col<eT> unsafe_col(const u32 col_num);
inline const Col<eT> unsafe_col(const u32 col_num) const; inline const Col<eT> unsafe_col(const u32 col_num) const;
arma_inline subview<eT> rows(const u32 in_row1, const u32 in_row2); arma_inline subview<eT> rows(const u32 in_row1, const u32 in_row2);
arma_inline const subview<eT> rows(const u32 in_row1, const u32 in_row2) const; arma_inline const subview<eT> rows(const u32 in_row1, const u32 in_row2) const;
arma_inline subview<eT> cols(const u32 in_col1, const u32 in_col2); arma_inline subview<eT> cols(const u32 in_col1, const u32 in_col2);
arma_inline const subview<eT> cols(const u32 in_col1, const u32 in_col2) const; arma_inline const subview<eT> cols(const u32 in_col1, const u32 in_col2) const;
arma_inline subview<eT> submat(const u32 in_row1, const u32 in_col1 , const u32 in_row2, const u32 in_col2); arma_inline subview<eT> submat(const u32 in_row1, const u32 in_col1 , const u32 in_row2, const u32 in_col2);
arma_inline const subview<eT> submat(const u32 in_row1, const u32 in_col1 , const u32 in_row2, const u32 in_col2) const; arma_inline const subview<eT> submat(const u32 in_row1, const u32 in_col1 , const u32 in_row2, const u32 in_col2) const;
arma_inline subview<eT> submat (const span& row_span, const span inline subview<eT> submat (const span& row_span, const span
& col_span); & col_span);
arma_inline const subview<eT> submat (const span& row_span, const span inline const subview<eT> submat (const span& row_span, const span
& col_span) const; & col_span) const;
arma_inline subview<eT> operator()(const span& row_span, const span inline subview<eT> operator()(const span& row_span, const span
& col_span); & col_span);
arma_inline const subview<eT> operator()(const span& row_span, const span inline const subview<eT> operator()(const span& row_span, const span
& col_span) const; & col_span) const;
template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B ase<u32,T1>& a); template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B ase<u32,T1>& a);
template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B ase<u32,T1>& a) const; template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B ase<u32,T1>& a) const;
// template<typename T1, typename T2> arma_inline subview_elem2<eT, T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b); // template<typename T1, typename T2> arma_inline subview_elem2<eT, T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b);
// template<typename T1, typename T2> arma_inline const subview_elem2<eT, T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b) const; // template<typename T1, typename T2> arma_inline const subview_elem2<eT, T1,T2> submat(const Base<u32,T1>& a, const Base<u32,T2>& b) const;
arma_inline diagview<eT> diag(const s32 in_id = 0); arma_inline diagview<eT> diag(const s32 in_id = 0);
arma_inline const diagview<eT> diag(const s32 in_id = 0) const; arma_inline const diagview<eT> diag(const s32 in_id = 0) const;
skipping to change at line 251 skipping to change at line 253
arma_inline arma_warn_unused bool is_vec() const; arma_inline arma_warn_unused bool is_vec() const;
arma_inline arma_warn_unused bool is_square() const; arma_inline arma_warn_unused bool is_square() const;
inline arma_warn_unused bool is_finite() const; inline arma_warn_unused bool is_finite() const;
// TODO: test and add expanded .in_range() to user documentation // TODO: test and add expanded .in_range() to user documentation
arma_inline arma_warn_unused bool in_range(const u32 i) const; arma_inline arma_warn_unused bool in_range(const u32 i) const;
arma_inline arma_warn_unused bool in_range(const span& x) const; arma_inline arma_warn_unused bool in_range(const span& x) const;
arma_inline arma_warn_unused bool in_range(const u32 in_row, co nst u32 in_col ) const; arma_inline arma_warn_unused bool in_range(const u32 in_row, co nst u32 in_col ) const;
arma_inline arma_warn_unused bool in_range(const span& row_span, co nst u32 in_col ) const; arma_inline arma_warn_unused bool in_range(const span& row_span, co nst u32 in_col ) const;
arma_inline arma_warn_unused bool in_range(const span& row_span, co nst span_helper junk ) const;
arma_inline arma_warn_unused bool in_range(const u32 in_row, co nst span& col_span) const; arma_inline arma_warn_unused bool in_range(const u32 in_row, co nst span& col_span) const;
arma_inline arma_warn_unused bool in_range(const span_helper junk, co nst span& col_span) const;
arma_inline arma_warn_unused bool in_range(const span& row_span, co nst span& col_span) const; arma_inline arma_warn_unused bool in_range(const span& row_span, co nst span& col_span) const;
arma_inline arma_warn_unused eT* colptr(const u32 in_col); arma_inline arma_warn_unused eT* colptr(const u32 in_col);
arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const;
arma_inline arma_warn_unused eT* memptr(); arma_inline arma_warn_unused eT* memptr();
arma_inline arma_warn_unused const eT* memptr() const; arma_inline arma_warn_unused const eT* memptr() const;
inline void print(const std::string extra_text = "") const; inline void print(const std::string extra_text = "") const;
inline void print(std::ostream& user_stream, const std::string extra_text = "") const; inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
 End of changes. 8 change blocks. 
29 lines changed or deleted 32 lines changed or added


 Row_meat.hpp   Row_meat.hpp 
skipping to change at line 169 skipping to change at line 169
) )
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::init(A,B); Mat<eT>::init(A,B);
} }
template<typename eT> template<typename eT>
template<typename T1>
inline
Row<eT>::Row(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X);
}
template<typename eT>
template<typename T1>
inline
const Row<eT>&
Row<eT>::operator=(const BaseCube<eT,T1>& X)
{
arma_extra_debug_sigprint();
Mat<eT>::operator=(X);
return *this;
}
template<typename eT>
inline inline
Row<eT>::Row(const subview_cube<eT>& X) Row<eT>::Row(const subview_cube<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
access::rw(Mat<eT>::vec_state) = 2; access::rw(Mat<eT>::vec_state) = 2;
Mat<eT>::operator=(X); Mat<eT>::operator=(X);
} }
skipping to change at line 212 skipping to change at line 237
Row<eT>::col(const u32 col_num) Row<eT>::col(const u32 col_num)
{ {
arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bound s" ); arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bound s" );
return access::rw(Mat<eT>::mem[col_num]); return access::rw(Mat<eT>::mem[col_num]);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
eT eT
Row<eT>::col(const u32 col_num) Row<eT>::col(const u32 col_num) const
const
{ {
arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bound s" ); arma_debug_check( (col_num >= Mat<eT>::n_cols), "Row::col(): out of bound s" );
return Mat<eT>::mem[col_num]; return Mat<eT>::mem[col_num];
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT> subview_row<eT>
Row<eT>::cols(const u32 in_col1, const u32 in_col2) Row<eT>::cols(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used");
return subview_row<eT>(*this, 0, in_col1, in_col2); const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview_row<eT>(*this, 0, in_col1, subview_n_cols);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_row<eT> const subview_row<eT>
Row<eT>::cols(const u32 in_col1, const u32 in_col2) Row<eT>::cols(const u32 in_col1, const u32 in_col2) const
const
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::cols(): indices out of bounds or incorrectly used");
return subview_row<eT>(*this, 0, in_col1, in_col2); const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview_row<eT>(*this, 0, in_col1, subview_n_cols);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT> subview_row<eT>
Row<eT>::subvec(const u32 in_col1, const u32 in_col2) Row<eT>::subvec(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used");
return subview_row<eT>(*this, 0, in_col1, in_col2); const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview_row<eT>(*this, 0, in_col1, subview_n_cols);
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
const subview_row<eT> const subview_row<eT>
Row<eT>::subvec(const u32 in_col1, const u32 in_col2) Row<eT>::subvec(const u32 in_col1, const u32 in_col2) const
const
{ {
arma_extra_debug_sigprint();
arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used"); arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) , "Row::subvec(): indices out of bounds or incorrectly used");
return subview_row<eT>(*this, 0, in_col1, in_col2); const u32 subview_n_cols = in_col2 - in_col1 + 1;
return subview_row<eT>(*this, 0, in_col1, subview_n_cols);
} }
//! remove specified columns //! remove specified columns
template<typename eT> template<typename eT>
inline inline
void void
Row<eT>::shed_col(const u32 col_num) Row<eT>::shed_col(const u32 col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 12 change blocks. 
10 lines changed or deleted 48 lines changed or added


 Row_proto.hpp   Row_proto.hpp 
skipping to change at line 46 skipping to change at line 46
template<typename T1> inline Row(const Base<eT,T1>& X); template<typename T1> inline Row(const Base<eT,T1>& X);
template<typename T1> inline const Row& operator=(const Base<eT,T1>& X); template<typename T1> inline const Row& operator=(const Base<eT,T1>& X);
inline Row( eT* aux_mem, const u32 aux_length, const bool copy_aux_m em = true, const bool strict = true); inline Row( eT* aux_mem, const u32 aux_length, const bool copy_aux_m em = true, const bool strict = true);
inline Row(const eT* aux_mem, const u32 aux_length); inline Row(const eT* aux_mem, const u32 aux_length);
template<typename T1, typename T2> template<typename T1, typename T2>
inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); inline explicit Row(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
template<typename T1> inline Row(const BaseCube<eT,T1>&
X);
template<typename T1> inline const Row& operator=(const BaseCube<eT,T1>&
X);
inline Row(const subview_cube<eT>& X); inline Row(const subview_cube<eT>& X);
inline const Row& operator=(const subview_cube<eT>& X); inline const Row& operator=(const subview_cube<eT>& X);
inline mat_injector<Row> operator<<(const eT val); inline mat_injector<Row> operator<<(const eT val);
arma_inline eT& col(const u32 col_num); arma_inline eT& col(const u32 col_num);
arma_inline eT col(const u32 col_num) const; arma_inline eT col(const u32 col_num) const;
arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co l2); arma_inline subview_row<eT> cols(const u32 in_col1, const u32 in_co l2);
arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co l2) const; arma_inline const subview_row<eT> cols(const u32 in_col1, const u32 in_co l2) const;
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 arma_version.hpp   arma_version.hpp 
skipping to change at line 18 skipping to change at line 18
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup arma_version //! \addtogroup arma_version
//! @{ //! @{
#define ARMA_VERSION_MAJOR 1 #define ARMA_VERSION_MAJOR 1
#define ARMA_VERSION_MINOR 1 #define ARMA_VERSION_MINOR 1
#define ARMA_VERSION_PATCH 2 #define ARMA_VERSION_PATCH 4
#define ARMA_VERSION_NAME "Flood Kayak" #define ARMA_VERSION_NAME "Manta Lodge"
struct arma_version struct arma_version
{ {
static const unsigned int major = ARMA_VERSION_MAJOR; static const unsigned int major = ARMA_VERSION_MAJOR;
static const unsigned int minor = ARMA_VERSION_MINOR; static const unsigned int minor = ARMA_VERSION_MINOR;
static const unsigned int patch = ARMA_VERSION_PATCH; static const unsigned int patch = ARMA_VERSION_PATCH;
static static
inline inline
std::string std::string
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 arrayops_meat.hpp   arrayops_meat.hpp 
skipping to change at line 30 skipping to change at line 30
arrayops::copy(eT* dest, const eT* src, const u32 n_elem) arrayops::copy(eT* dest, const eT* src, const u32 n_elem)
{ {
#if !defined(__OPTIMIZE__) #if !defined(__OPTIMIZE__)
{ {
std::memcpy(dest, src, n_elem*sizeof(eT)); std::memcpy(dest, src, n_elem*sizeof(eT));
} }
#else #else
{ {
switch(n_elem) switch(n_elem)
{ {
case 0: default:
break; std::memcpy(dest, src, n_elem*sizeof(eT));
break;
case 1: case 16:
*dest = *src; dest[15] = src[15];
break; case 15:
dest[14] = src[14];
case 2: case 14:
dest[0] = src[0]; dest[13] = src[13];
dest[1] = src[1]; case 13:
break; dest[12] = src[12];
case 12:
dest[11] = src[11];
case 11:
dest[10] = src[10];
case 10:
dest[9] = src[9];
case 9:
dest[8] = src[8];
case 8:
dest[7] = src[7];
case 7:
dest[6] = src[6];
case 6:
dest[5] = src[5];
case 5:
dest[4] = src[4];
case 4:
dest[3] = src[3];
case 3: case 3:
dest[0] = src[0];
dest[1] = src[1];
dest[2] = src[2]; dest[2] = src[2];
break; case 2:
case 4:
dest[0] = src[0];
dest[1] = src[1]; dest[1] = src[1];
dest[2] = src[2]; case 1:
dest[3] = src[3]; dest[0] = src[0];
break; case 0:
;
default:
if( n_elem <= (128/sizeof(eT)) )
{
u32 i,j;
for(i=0, j=1; j<n_elem; i+=2, j+=2)
{
dest[i] = src[i];
dest[j] = src[j];
}
if(i < n_elem)
{
dest[i] = src[i];
}
}
else
{
std::memcpy(dest, src, n_elem*sizeof(eT));
}
} }
} }
#endif #endif
} }
template<typename out_eT, typename in_eT> template<typename out_eT, typename in_eT>
arma_hot arma_hot
arma_inline arma_inline
void void
arrayops::convert_cx_scalar arrayops::convert_cx_scalar
 End of changes. 4 change blocks. 
42 lines changed or deleted 34 lines changed or added


 debug.hpp   debug.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 31 skipping to change at line 31
static std::ostream* log_stream = &(std::cout); static std::ostream* log_stream = &(std::cout);
if(user_stream != NULL) if(user_stream != NULL)
{ {
log_stream = user_stream; log_stream = user_stream;
} }
return *log_stream; return *log_stream;
} }
// TODO: add to user documentation
inline inline
void void
set_log_stream(std::ostream& user_stream) set_log_stream(std::ostream& user_stream)
{ {
arma_log_stream<char>(&user_stream); arma_log_stream<char>(&user_stream);
} }
// TODO: add to user documentation
inline inline
std::ostream& std::ostream&
get_log_stream() get_log_stream()
{ {
return arma_log_stream<char>(NULL); return arma_log_stream<char>(NULL);
} }
// //
// arma_stop // arma_stop
//! print a message to get_log_stream() and/or throw a run-time error excep tion //! print a message to get_log_stream() and/or throw a run-time error excep tion
template<typename T1> template<typename T1>
inline inline
void void
arma_cold arma_cold
arma_stop(const T1& x) arma_stop(const T1& x)
{ {
get_log_stream().flush(); std::ostream& log_stream = get_log_stream();
get_log_stream() << '\n'; log_stream.flush();
get_log_stream() << "run-time error: " << x << '\n';
get_log_stream() << '\n'; log_stream << '\n';
get_log_stream().flush(); log_stream << "run-time error: " << x << '\n';
log_stream << '\n';
log_stream.flush();
throw std::runtime_error(""); throw std::runtime_error("");
} }
// //
// arma_print // arma_print
inline inline
void void
arma_cold arma_cold
skipping to change at line 212 skipping to change at line 212
arma_hot arma_hot
arma_check(const bool state, const T1& x, const T2& y) arma_check(const bool state, const T1& x, const T2& y)
{ {
if(state==true) if(state==true)
{ {
arma_stop( std::string(x) + std::string(y) ); arma_stop( std::string(x) + std::string(y) );
} }
} }
// //
// functions for checking whether two matrices have the same dimensions // functions for generating strings indicating size errors
inline inline
std::string std::string
arma_cold arma_cold
arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n_rows, const u32 B_n_cols, const char* x) arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n_rows, const u32 B_n_cols, const char* x)
{ {
std::stringstream tmp; std::stringstream tmp;
tmp << x << ": incompatible matrix dimensions: (" << A_n_rows << ',' << A tmp << x << ": incompatible matrix dimensions: " << A_n_rows << 'x' << A_
_n_cols << ") and (" << B_n_rows << ',' << B_n_cols << ')'; n_cols << " and " << B_n_rows << 'x' << B_n_cols;
return tmp.str();
}
inline
arma_cold
std::string
arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32
A_n_slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices,
const char* x)
{
std::stringstream tmp;
tmp << x << ": incompatible cube dimensions: " << A_n_rows << 'x' << A_n_
cols << 'x' << A_n_slices << " and " << B_n_rows << 'x' << B_n_cols << 'x'
<< B_n_slices;
return tmp.str();
}
template<typename eT>
inline
arma_cold
std::string
arma_incompat_size_string(const subview_cube<eT>& Q, const Mat<eT>& A, cons
t char* x)
{
std::stringstream tmp;
tmp << x
<< ": interpreting matrix as cube with dimenensions: "
<< A.n_rows << 'x' << A.n_cols << 'x' << 1
<< " or "
<< A.n_rows << 'x' << 1 << 'x' << A.n_cols
<< " or "
<< 1 << 'x' << A.n_cols << 'x' << A.n_rows
<< " is incompatible with cube dimensions: "
<< Q.n_rows << 'x' << Q.n_cols << 'x' << Q.n_slices;
return tmp.str(); return tmp.str();
} }
//
// functions for checking whether two matrices have the same dimensions
inline inline
void void
arma_hot arma_hot
arma_assert_same_size(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n _rows, const u32 B_n_cols, const char* x) arma_assert_same_size(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n _rows, const u32 B_n_cols, const char* x)
{ {
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
skipping to change at line 405 skipping to change at line 441
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) ) if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) )
{ {
arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, B_n_rows, B_n_ cols, x) );
} }
} }
// //
// functions for checking whether two cubes have the same dimensions // functions for checking whether two cubes have the same dimensions
inline inline
arma_cold
std::string
arma_incompat_size_string(const u32 A_n_rows, const u32 A_n_cols, const u32
A_n_slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices,
const char* x)
{
std::stringstream tmp;
tmp << x << ": incompatible cube dimensions: (" << A_n_rows << ',' << A_n
_cols << ',' << A_n_slices << ") and (" << B_n_rows << ',' << B_n_cols << '
,' << B_n_slices << ')';
return tmp.str();
}
inline
void void
arma_hot arma_hot
arma_assert_same_size(const u32 A_n_rows, const u32 A_n_cols, const u32 A_n _slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices, cons t char* x) arma_assert_same_size(const u32 A_n_rows, const u32 A_n_cols, const u32 A_n _slices, const u32 B_n_rows, const u32 B_n_cols, const u32 B_n_slices, cons t char* x)
{ {
if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_ n_slices) ) if( (A_n_rows != B_n_rows) || (A_n_cols != B_n_cols) || (A_n_slices != B_ n_slices) )
{ {
arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_ n_rows, B_n_cols, B_n_slices, x) ); arma_stop( arma_incompat_size_string(A_n_rows, A_n_cols, A_n_slices, B_ n_rows, B_n_cols, B_n_slices, x) );
} }
} }
skipping to change at line 548 skipping to change at line 572
void void
arma_hot arma_hot
arma_assert_same_size(const Mat<eT1>& A, const subview_cube<eT2>& B, const char* x) arma_assert_same_size(const Mat<eT1>& A, const subview_cube<eT2>& B, const char* x)
{ {
if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (1 != B.n_slices) ) if( (A.n_rows != B.n_rows) || (A.n_cols != B.n_cols) || (1 != B.n_slices) )
{ {
arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, 1, B.n_rows, B .n_cols, B.n_slices, x) ); arma_stop( arma_incompat_size_string(A.n_rows, A.n_cols, 1, B.n_rows, B .n_cols, B.n_slices, x) );
} }
} }
template<typename eT, typename T1>
inline
void
arma_assert_cube_as_mat(const Mat<eT>& M, const T1& Q, const char* x, const
bool check_compat_size)
{
const u32 Q_n_rows = Q.n_rows;
const u32 Q_n_cols = Q.n_cols;
const u32 Q_n_slices = Q.n_slices;
const u32 M_vec_state = M.vec_state;
if(M_vec_state == 0)
{
if( ( (Q_n_rows == 1) || (Q_n_cols == 1) || (Q_n_slices == 1) ) == fals
e )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a matrix; one of the dimensions must be 1";
arma_stop( tmp.str() );
}
}
else
{
if(Q_n_slices == 1)
{
if( (M_vec_state == 1) && (Q_n_cols != 1) )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a column vector";
arma_stop( tmp.str() );
}
if( (M_vec_state == 2) && (Q_n_rows != 1) )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a row vector";
arma_stop( tmp.str() );
}
}
else
{
if( (Q_n_cols != 1) && (Q_n_rows != 1) )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a vector";
arma_stop( tmp.str() );
}
}
}
if(check_compat_size == true)
{
const u32 M_n_rows = M.n_rows;
const u32 M_n_cols = M.n_cols;
if(M_vec_state == 0)
{
if(
(
( (Q_n_rows == M_n_rows) && (Q_n_cols == M_n_cols) )
||
( (Q_n_rows == M_n_rows) && (Q_n_slices == M_n_cols) )
||
( (Q_n_cols == M_n_cols) && (Q_n_slices == M_n_rows) )
)
== false
)
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimenensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a matrix with dimensions "
<< M_n_rows << 'x' << M_n_cols;
arma_stop( tmp.str() );
}
}
else
{
if(Q_n_slices == 1)
{
if( (M_vec_state == 1) && (Q_n_rows != M_n_rows) )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a column vector with dimensions "
<< M_n_rows << 'x' << M_n_cols;
arma_stop( tmp.str() );
}
if( (M_vec_state == 2) && (Q_n_cols != M_n_cols) )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a row vector with dimensions "
<< M_n_rows << 'x' << M_n_cols;
arma_stop( tmp.str() );
}
}
else
{
if( ( (M_n_cols == Q_n_slices) || (M_n_rows == Q_n_slices) ) == fal
se )
{
std::stringstream tmp;
tmp << x
<< ": can't interpret cube with dimensions "
<< Q_n_rows << 'x' << Q_n_cols << 'x' << Q_n_slices
<< " as a vector with dimensions "
<< M_n_rows << 'x' << M_n_cols;
arma_stop( tmp.str() );
}
}
}
}
}
// //
// functions for checking whether two matrices have dimensions that are com patible with the matrix multiply operation // functions for checking whether two matrices have dimensions that are com patible with the matrix multiply operation
inline inline
void void
arma_hot arma_hot
arma_assert_mul_size(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n_ rows, const u32 B_n_cols, const char* x) arma_assert_mul_size(const u32 A_n_rows, const u32 A_n_cols, const u32 B_n_ rows, const u32 B_n_cols, const char* x)
{ {
if(A_n_cols != B_n_rows) if(A_n_cols != B_n_rows)
{ {
skipping to change at line 652 skipping to change at line 823
#elif defined (_MSC_VER) #elif defined (_MSC_VER)
#define ARMA_FNSIG __FUNCSIG__ #define ARMA_FNSIG __FUNCSIG__
#elif defined (ARMA_USE_BOOST) #elif defined (ARMA_USE_BOOST)
#define ARMA_FNSIG BOOST_CURRENT_FUNCTION #define ARMA_FNSIG BOOST_CURRENT_FUNCTION
#else #else
#define ARMA_FNSIG "(unknown)" #define ARMA_FNSIG "(unknown)"
#endif #endif
#if !defined(ARMA_NO_DEBUG) && !defined(NDEBUG) #if !defined(ARMA_NO_DEBUG) && !defined(NDEBUG)
#define arma_debug_print arma_print #define arma_debug_print arma_print
#define arma_debug_warn arma_warn #define arma_debug_warn arma_warn
#define arma_debug_check arma_check #define arma_debug_check arma_check
#define arma_debug_assert_same_size arma_assert_same_size #define arma_debug_assert_same_size arma_assert_same_size
#define arma_debug_assert_mul_size arma_assert_mul_size #define arma_debug_assert_mul_size arma_assert_mul_size
#define arma_debug_assert_cube_as_mat arma_assert_cube_as_mat
#else #else
#undef ARMA_EXTRA_DEBUG #undef ARMA_EXTRA_DEBUG
#define arma_debug_print true ? (void)0 : arma_print #define arma_debug_print true ? (void)0 : arma_print
#define arma_debug_warn true ? (void)0 : arma_warn #define arma_debug_warn true ? (void)0 : arma_warn
#define arma_debug_check true ? (void)0 : arma_check #define arma_debug_check true ? (void)0 : arma_check
#define arma_debug_assert_same_size true ? (void)0 : arma_assert_same_siz #define arma_debug_assert_same_size true ? (void)0 : arma_assert_same_s
e ize
#define arma_debug_assert_mul_size true ? (void)0 : arma_assert_mul_size #define arma_debug_assert_mul_size true ? (void)0 : arma_assert_mul_si
ze
#define arma_debug_assert_cube_as_mat true ? (void)0 : arma_debug_assert_
cube_as_mat
#endif #endif
#if defined(ARMA_EXTRA_DEBUG) #if defined(ARMA_EXTRA_DEBUG)
#define arma_extra_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_b ktprint #define arma_extra_debug_sigprint arma_sigprint(ARMA_FNSIG); arma_b ktprint
#define arma_extra_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_t hisprint #define arma_extra_debug_sigprint_this arma_sigprint(ARMA_FNSIG); arma_t hisprint
#define arma_extra_debug_print arma_print #define arma_extra_debug_print arma_print
#define arma_extra_debug_warn arma_warn #define arma_extra_debug_warn arma_warn
#define arma_extra_debug_check arma_check #define arma_extra_debug_check arma_check
 End of changes. 12 change blocks. 
40 lines changed or deleted 218 lines changed or added


 field_meat.hpp   field_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// Copyright (C) 2009-2010 Ian Cullinan // Copyright (C) 2009-2010 Ian Cullinan
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 272 skipping to change at line 272
inline inline
field_injector< field<oT> > field_injector< field<oT> >
field<oT>::operator<<(const oT& val) field<oT>::operator<<(const oT& val)
{ {
return field_injector< field<oT> >(*this, val); return field_injector< field<oT> >(*this, val);
} }
template<typename oT> template<typename oT>
inline inline
field_injector< field<oT> > field_injector< field<oT> >
field<oT>::operator<<(const injector_helper x) field<oT>::operator<<(const injector_end_of_row& x)
{ {
return field_injector< field<oT> >(*this, x); return field_injector< field<oT> >(*this, x);
} }
//! creation of subview_field (row of a field) //! creation of subview_field (row of a field)
template<typename oT> template<typename oT>
inline inline
subview_field<oT> subview_field<oT>
field<oT>::row(const u32 row_num) field<oT>::row(const u32 row_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" ); arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" );
return subview_field<oT>(*this, row_num, 0, row_num, n_cols-1);
return subview_field<oT>(*this, row_num, 0, 1, n_cols);
} }
//! creation of subview_field (row of a field) //! creation of subview_field (row of a field)
template<typename oT> template<typename oT>
inline inline
const subview_field<oT> const subview_field<oT>
field<oT>::row(const u32 row_num) const field<oT>::row(const u32 row_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" ); arma_debug_check( (row_num >= n_rows), "field::row(): row out of bounds" );
return subview_field<oT>(*this, row_num, 0, row_num, n_cols-1);
return subview_field<oT>(*this, row_num, 0, 1, n_cols);
} }
//! creation of subview_field (column of a field) //! creation of subview_field (column of a field)
template<typename oT> template<typename oT>
inline inline
subview_field<oT> subview_field<oT>
field<oT>::col(const u32 col_num) field<oT>::col(const u32 col_num)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds"); arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds");
return subview_field<oT>(*this, 0, col_num, n_rows-1, col_num);
return subview_field<oT>(*this, 0, col_num, n_rows, 1);
} }
//! creation of subview_field (column of a field) //! creation of subview_field (column of a field)
template<typename oT> template<typename oT>
inline inline
const subview_field<oT> const subview_field<oT>
field<oT>::col(const u32 col_num) const field<oT>::col(const u32 col_num) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds"); arma_debug_check( (col_num >= n_cols), "field::col(): out of bounds");
return subview_field<oT>(*this, 0, col_num, n_rows-1, col_num);
return subview_field<oT>(*this, 0, col_num, n_rows, 1);
} }
//! creation of subview_field (subfield comprised of specified rows) //! creation of subview_field (subfield comprised of specified rows)
template<typename oT> template<typename oT>
inline inline
subview_field<oT> subview_field<oT>
field<oT>::rows(const u32 in_row1, const u32 in_row2) field<oT>::rows(const u32 in_row1, const u32 in_row2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
( (in_row1 > in_row2) || (in_row2 >= n_rows) ), ( (in_row1 > in_row2) || (in_row2 >= n_rows) ),
"field::rows(): indicies out of bounds or incorrectly used" "field::rows(): indicies out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, in_row1, 0, in_row2, n_cols-1); const u32 subfield_n_rows = in_row2 - in_row1 + 1;
return subview_field<oT>(*this, in_row1, 0, subfield_n_rows, n_cols);
} }
//! creation of subview_field (subfield comprised of specified rows) //! creation of subview_field (subfield comprised of specified rows)
template<typename oT> template<typename oT>
inline inline
const subview_field<oT> const subview_field<oT>
field<oT>::rows(const u32 in_row1, const u32 in_row2) const field<oT>::rows(const u32 in_row1, const u32 in_row2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
( (in_row1 > in_row2) || (in_row2 >= n_rows) ), ( (in_row1 > in_row2) || (in_row2 >= n_rows) ),
"field::rows(): indicies out of bounds or incorrectly used" "field::rows(): indicies out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, in_row1, 0, in_row2, n_cols-1); const u32 subfield_n_rows = in_row2 - in_row1 + 1;
return subview_field<oT>(*this, in_row1, 0, subfield_n_rows, n_cols);
} }
//! creation of subview_field (subfield comprised of specified columns) //! creation of subview_field (subfield comprised of specified columns)
template<typename oT> template<typename oT>
inline inline
subview_field<oT> subview_field<oT>
field<oT>::cols(const u32 in_col1, const u32 in_col2) field<oT>::cols(const u32 in_col1, const u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
( (in_col1 > in_col2) || (in_col2 >= n_cols) ), ( (in_col1 > in_col2) || (in_col2 >= n_cols) ),
"field::cols(): indicies out of bounds or incorrectly used" "field::cols(): indicies out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, 0, in_col1, n_rows-1, in_col2); const u32 subfield_n_cols = in_col2 - in_col1 + 1;
return subview_field<oT>(*this, 0, in_col1, n_rows, subfield_n_cols);
} }
//! creation of subview_field (subfield comprised of specified columns) //! creation of subview_field (subfield comprised of specified columns)
template<typename oT> template<typename oT>
inline inline
const subview_field<oT> const subview_field<oT>
field<oT>::cols(const u32 in_col1, const u32 in_col2) const field<oT>::cols(const u32 in_col1, const u32 in_col2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
( (in_col1 > in_col2) || (in_col2 >= n_cols) ), ( (in_col1 > in_col2) || (in_col2 >= n_cols) ),
"field::cols(): indicies out of bounds or incorrectly used" "field::cols(): indicies out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, 0, in_col1, n_rows-1, in_col2); const u32 subfield_n_cols = in_col2 - in_col1 + 1;
return subview_field<oT>(*this, 0, in_col1, n_rows, subfield_n_cols);
} }
//! creation of subview_field (subfield with arbitrary dimensions) //! creation of subview_field (subfield with arbitrary dimensions)
template<typename oT> template<typename oT>
inline inline
subview_field<oT> subview_field<oT>
field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2 , const u32 in_col2) field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2 , const u32 in_col2)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i n_col2 >= n_cols), (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i n_col2 >= n_cols),
"field::subfield(): indices out of bounds or incorrectly used" "field::subfield(): indices out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, in_row1, in_col1, in_row2, in_col2); const u32 subfield_n_rows = in_row2 - in_row1 + 1;
const u32 subfield_n_cols = in_col2 - in_col1 + 1;
return subview_field<oT>(*this, in_row1, in_col1, subfield_n_rows, subfie
ld_n_cols);
} }
//! creation of subview_field (generic submatrix) //! creation of subview_field (generic submatrix)
template<typename oT> template<typename oT>
inline inline
const subview_field<oT> const subview_field<oT>
field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2 , const u32 in_col2) const field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2 , const u32 in_col2) const
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check arma_debug_check
( (
(in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i n_col2 >= n_cols), (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i n_col2 >= n_cols),
"field::subfield(): indices out of bounds or incorrectly used" "field::subfield(): indices out of bounds or incorrectly used"
); );
return subview_field<oT>(*this, in_row1, in_col1, in_row2, in_col2); const u32 subfield_n_rows = in_row2 - in_row1 + 1;
const u32 subfield_n_cols = in_col2 - in_col1 + 1;
return subview_field<oT>(*this, in_row1, in_col1, subfield_n_rows, subfie
ld_n_cols);
} }
//! print contents of the field (to the cout stream), //! print contents of the field (to the cout stream),
//! optionally preceding with a user specified line of text. //! optionally preceding with a user specified line of text.
//! the field class preserves the stream's flags //! the field class preserves the stream's flags
//! but the associated operator<< function for type oT //! but the associated operator<< function for type oT
//! may still modify the stream's parameters. //! may still modify the stream's parameters.
//! NOTE: this function assumes that type oT can be printed, //! NOTE: this function assumes that type oT can be printed,
//! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)" //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)"
//! has been defined. //! has been defined.
 End of changes. 12 change blocks. 
13 lines changed or deleted 33 lines changed or added


 field_proto.hpp   field_proto.hpp 
skipping to change at line 78 skipping to change at line 78
arma_inline oT& operator()(const u32 i); arma_inline oT& operator()(const u32 i);
arma_inline const oT& operator()(const u32 i) const; arma_inline const oT& operator()(const u32 i) const;
arma_inline oT& at(const u32 row, const u32 col); arma_inline oT& at(const u32 row, const u32 col);
arma_inline const oT& at(const u32 row, const u32 col) const; arma_inline const oT& at(const u32 row, const u32 col) const;
arma_inline oT& operator()(const u32 row, const u32 col); arma_inline oT& operator()(const u32 row, const u32 col);
arma_inline const oT& operator()(const u32 row, const u32 col) const; arma_inline const oT& operator()(const u32 row, const u32 col) const;
inline field_injector<field> operator<<(const oT& val); inline field_injector<field> operator<<(const oT& val);
inline field_injector<field> operator<<(const injector_helper x); inline field_injector<field> operator<<(const injector_end_of_row& x);
inline subview_field<oT> row(const u32 row_num); inline subview_field<oT> row(const u32 row_num);
inline const subview_field<oT> row(const u32 row_num) const; inline const subview_field<oT> row(const u32 row_num) const;
inline subview_field<oT> col(const u32 col_num); inline subview_field<oT> col(const u32 col_num);
inline const subview_field<oT> col(const u32 col_num) const; inline const subview_field<oT> col(const u32 col_num) const;
inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2) ; inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2) ;
inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2) const; inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2) const;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 fn_accu.hpp   fn_accu.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 173 skipping to change at line 173
arma_pure arma_pure
arma_warn_unused arma_warn_unused
inline inline
eT eT
accu(const subview_row<eT>& S) accu(const subview_row<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const Mat<eT>& X = S.m; const Mat<eT>& X = S.m;
const u32 row = S.aux_row1; const u32 row = S.aux_row1;
const u32 start_col = S.aux_col1; const u32 start_col = S.aux_col1;
const u32 end_col = S.aux_col2; const u32 end_col_plus_1 = start_col + S.n_cols;
// in future versions, S.n_cols might be equal to zero,
// hence the loop below has a "less than" condition
eT val = eT(0); eT val = eT(0);
for(u32 col=start_col; col<=end_col; ++col) for(u32 col=start_col; col<end_col_plus_1; ++col)
{ {
val += X.at(row,col); val += X.at(row,col);
} }
return val; return val;
} }
//! accumulate the elements of a subview_col //! accumulate the elements of a subview_col
template<typename eT> template<typename eT>
arma_pure arma_pure
 End of changes. 3 change blocks. 
6 lines changed or deleted 9 lines changed or added


 fn_prod.hpp   fn_prod.hpp 
skipping to change at line 116 skipping to change at line 116
inline inline
eT eT
prod(const subview_row<eT>& S) prod(const subview_row<eT>& S)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_debug_check( (S.n_elem < 1), "prod(): given object has no elements" ); arma_debug_check( (S.n_elem < 1), "prod(): given object has no elements" );
const Mat<eT>& X = S.m; const Mat<eT>& X = S.m;
const u32 row = S.aux_row1; const u32 row = S.aux_row1;
const u32 start_col = S.aux_col1; const u32 start_col = S.aux_col1;
const u32 end_col = S.aux_col2; const u32 end_col_plus_1 = start_col + S.n_cols;
eT val = X.at(row,start_col); eT val = eT(1);
for(u32 col=start_col+1; col<=end_col; ++col) for(u32 col=start_col; col<end_col_plus_1; ++col)
{ {
val *= X.at(row,col); val *= X.at(row,col);
} }
return val; return val;
} }
//! product of all values of a subview_col //! product of all values of a subview_col
template<typename eT> template<typename eT>
inline inline
 End of changes. 3 change blocks. 
5 lines changed or deleted 5 lines changed or added


 forward_proto.hpp   forward_proto.hpp 
skipping to change at line 95 skipping to change at line 95
template< typename T1, typename T2, typename glue_type> cl ass GlueCube; template< typename T1, typename T2, typename glue_type> cl ass GlueCube;
template< typename T1, typename T2, typename eglue_type> cl ass eGlueCube; template< typename T1, typename T2, typename eglue_type> cl ass eGlueCube;
template<typename out_eT, typename T1, typename T2, typename glue_type> cl ass mtGlueCube; template<typename out_eT, typename T1, typename T2, typename glue_type> cl ass mtGlueCube;
template<typename T1> class Proxy; template<typename T1> class Proxy;
template<typename T1> class ProxyCube; template<typename T1> class ProxyCube;
//! \addtogroup injector //! \addtogroup injector
//! @{ //! @{
enum injector_helper struct injector_end_of_row {};
{
endr //!< indicate "end of row", similar conceptual meaning to std::endl static const injector_end_of_row endr = injector_end_of_row();
}; //!< endr indicates "end of row" when using the << operator;
//!< similar conceptual meaning to std::endl
//! @} //! @}
//! \addtogroup diskio //! \addtogroup diskio
//! @{ //! @{
//! file types supported by Armadillo //! file types supported by Armadillo
enum file_type enum file_type
{ {
auto_detect, //!< Automatically detect the file type (file must be one o f the following types) auto_detect, //!< Automatically detect the file type (file must be one o f the following types)
 End of changes. 1 change blocks. 
4 lines changed or deleted 5 lines changed or added


 injector_meat.hpp   injector_meat.hpp 
skipping to change at line 83 skipping to change at line 83
for(u32 row=0; row<n_rows; ++row) for(u32 row=0; row<n_rows; ++row)
{ {
A[row] = new mat_injector_row<eT>; A[row] = new mat_injector_row<eT>;
} }
(*(A[0])).insert(val); (*(A[0])).insert(val);
} }
template<typename T1> template<typename T1>
inline inline
mat_injector<T1>::mat_injector(T1& in_X, const injector_helper x) mat_injector<T1>::mat_injector(T1& in_X, const injector_end_of_row& x)
: X(in_X) : X(in_X)
, n_rows(1) , n_rows(1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(x);
typedef typename mat_injector<T1>::elem_type eT; typedef typename mat_injector<T1>::elem_type eT;
AA = new podarray< mat_injector_row<eT>* >; AA = new podarray< mat_injector_row<eT>* >;
BB = new podarray< mat_injector_row<eT>* >; BB = new podarray< mat_injector_row<eT>* >;
podarray< mat_injector_row<eT>* >& A = *AA; podarray< mat_injector_row<eT>* >& A = *AA;
A.set_size(n_rows); A.set_size(n_rows);
for(u32 row=0; row<n_rows; ++row) for(u32 row=0; row<n_rows; ++row)
{ {
A[row] = new mat_injector_row<eT>; A[row] = new mat_injector_row<eT>;
} }
if(x == endr) (*this).end_of_row();
{
(*this).end_of_row();
}
} }
template<typename T1> template<typename T1>
inline inline
mat_injector<T1>::~mat_injector() mat_injector<T1>::~mat_injector()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename mat_injector<T1>::elem_type eT; typedef typename mat_injector<T1>::elem_type eT;
skipping to change at line 157 skipping to change at line 155
for(u32 col=n_cols; col<max_n_cols; ++col) for(u32 col=n_cols; col<max_n_cols; ++col)
{ {
X.at(row,col) = eT(0); X.at(row,col) = eT(0);
} }
} }
} }
else else
if(is_Row<T1>::value == true) if(is_Row<T1>::value == true)
{ {
arma_debug_check( (max_n_rows > 1), "operator<<: incompatible dimensi ons" ); arma_debug_check( (max_n_rows > 1), "matrix initialisation: incompati ble dimensions" );
const u32 n_cols = (*(A[0])).n_cols; const u32 n_cols = (*(A[0])).n_cols;
X.set_size(1, n_cols); X.set_size(1, n_cols);
arrayops::copy( X.memptr(), (*(A[0])).A.memptr(), n_cols ); arrayops::copy( X.memptr(), (*(A[0])).A.memptr(), n_cols );
} }
else else
if(is_Col<T1>::value == true) if(is_Col<T1>::value == true)
{ {
const bool is_vec = ( (max_n_rows == 1) || (max_n_cols == 1) ); const bool is_vec = ( (max_n_rows == 1) || (max_n_cols == 1) );
arma_debug_check( (is_vec == false), "operator<<: incompatible dimens ions" ); arma_debug_check( (is_vec == false), "matrix initialisation: incompat ible dimensions" );
const u32 n_elem = (std::max)(max_n_rows, max_n_cols); const u32 n_elem = (std::max)(max_n_rows, max_n_cols);
X.set_size(n_elem, 1); X.set_size(n_elem, 1);
u32 i = 0; u32 i = 0;
for(u32 row=0; row<max_n_rows; ++row) for(u32 row=0; row<max_n_rows; ++row)
{ {
const u32 n_cols = (*(A[0])).n_cols; const u32 n_cols = (*(A[0])).n_cols;
skipping to change at line 260 skipping to change at line 258
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
ref.insert(val); ref.insert(val);
return ref; return ref;
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const mat_injector<T1>& const mat_injector<T1>&
operator<<(const mat_injector<T1>& ref, const injector_helper x) operator<<(const mat_injector<T1>& ref, const injector_end_of_row& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(x);
if(x == endr) ref.end_of_row();
{
ref.end_of_row();
}
return ref; return ref;
} }
//// using a mixture of operator << and , doesn't work yet
//// e.g. A << 1, 2, 3 << endr
//// in the above "3 << endr" requires special handling.
//// similarly, special handling is necessary for "endr << 3"
////
// template<typename T1>
// arma_inline
// const mat_injector<T1>&
// operator,(const mat_injector<T1>& ref, const typename mat_injector<T1>::
elem_type val)
// {
// arma_extra_debug_sigprint();
//
// ref.insert(val);
//
// return ref;
// }
// template<typename T1>
// arma_inline
// const mat_injector<T1>&
// operator,(const mat_injector<T1>& ref, const injector_end_of_row& x)
// {
// arma_extra_debug_sigprint();
// arma_ignore(x);
//
// ref.end_of_row();
//
// return ref;
// }
// //
// //
// //
template<typename oT> template<typename oT>
inline inline
field_injector_row<oT>::field_injector_row() field_injector_row<oT>::field_injector_row()
: n_cols(0) : n_cols(0)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 363 skipping to change at line 389
for(u32 row=0; row<n_rows; ++row) for(u32 row=0; row<n_rows; ++row)
{ {
A[row] = new field_injector_row<oT>; A[row] = new field_injector_row<oT>;
} }
(*(A[0])).insert(val); (*(A[0])).insert(val);
} }
template<typename T1> template<typename T1>
inline inline
field_injector<T1>::field_injector(T1& in_X, const injector_helper x) field_injector<T1>::field_injector(T1& in_X, const injector_end_of_row& x)
: X(in_X) : X(in_X)
, n_rows(1) , n_rows(1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(x);
typedef typename field_injector<T1>::object_type oT; typedef typename field_injector<T1>::object_type oT;
AA = new podarray< field_injector_row<oT>* >; AA = new podarray< field_injector_row<oT>* >;
BB = new podarray< field_injector_row<oT>* >; BB = new podarray< field_injector_row<oT>* >;
podarray< field_injector_row<oT>* >& A = *AA; podarray< field_injector_row<oT>* >& A = *AA;
A.set_size(n_rows); A.set_size(n_rows);
for(u32 row=0; row<n_rows; ++row) for(u32 row=0; row<n_rows; ++row)
{ {
A[row] = new field_injector_row<oT>; A[row] = new field_injector_row<oT>;
} }
if(x == endr) (*this).end_of_row();
{
(*this).end_of_row();
}
} }
template<typename T1> template<typename T1>
inline inline
field_injector<T1>::~field_injector() field_injector<T1>::~field_injector()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename field_injector<T1>::object_type oT; typedef typename field_injector<T1>::object_type oT;
skipping to change at line 501 skipping to change at line 525
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
ref.insert(val); ref.insert(val);
return ref; return ref;
} }
template<typename T1> template<typename T1>
arma_inline arma_inline
const field_injector<T1>& const field_injector<T1>&
operator<<(const field_injector<T1>& ref, const injector_helper x) operator<<(const field_injector<T1>& ref, const injector_end_of_row& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
arma_ignore(x);
if(x == endr) ref.end_of_row();
{
ref.end_of_row();
}
return ref; return ref;
} }
//! @} //! @}
 End of changes. 15 change blocks. 
22 lines changed or deleted 45 lines changed or added


 injector_proto.hpp   injector_proto.hpp 
skipping to change at line 44 skipping to change at line 44
typedef typename T1::elem_type elem_type; typedef typename T1::elem_type elem_type;
inline void insert(const elem_type val) const; inline void insert(const elem_type val) const;
inline void end_of_row() const; inline void end_of_row() const;
inline ~mat_injector(); inline ~mat_injector();
private: private:
inline mat_injector(T1& in_X, const elem_type val); inline mat_injector(T1& in_X, const elem_type val);
inline mat_injector(T1& in_X, const injector_helper x); inline mat_injector(T1& in_X, const injector_end_of_row& x);
T1& X; T1& X;
mutable u32 n_rows; mutable u32 n_rows;
mutable podarray< mat_injector_row<elem_type>* >* AA; mutable podarray< mat_injector_row<elem_type>* >* AA;
mutable podarray< mat_injector_row<elem_type>* >* BB; mutable podarray< mat_injector_row<elem_type>* >* BB;
friend class Mat<elem_type>; friend class Mat<elem_type>;
friend class Row<elem_type>; friend class Row<elem_type>;
friend class Col<elem_type>; friend class Col<elem_type>;
skipping to change at line 88 skipping to change at line 88
typedef typename T1::object_type object_type; typedef typename T1::object_type object_type;
inline void insert(const object_type& val) const; inline void insert(const object_type& val) const;
inline void end_of_row() const; inline void end_of_row() const;
inline ~field_injector(); inline ~field_injector();
private: private:
inline field_injector(T1& in_X, const object_type& val); inline field_injector(T1& in_X, const object_type& val);
inline field_injector(T1& in_X, const injector_helper x); inline field_injector(T1& in_X, const injector_end_of_row& x);
T1& X; T1& X;
mutable u32 n_rows; mutable u32 n_rows;
mutable podarray< field_injector_row<object_type>* >* AA; mutable podarray< field_injector_row<object_type>* >* AA;
mutable podarray< field_injector_row<object_type>* >* BB; mutable podarray< field_injector_row<object_type>* >* BB;
friend class field<object_type>; friend class field<object_type>;
}; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 op_sort_meat.hpp   op_sort_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup op_sort //! \addtogroup op_sort
//! @{ //! @{
// using qsort() rather than std::sort() for now.
// std::sort() will be used when a Random Access Iterator wrapper for plain
arrays is ready,
// otherwise using std::sort() would currently entail copying elements to/f
rom std::vector
template<typename eT> template<typename eT>
class arma_qsort_helper class arma_ascend_sort_helper
{ {
public: public:
static arma_inline
int bool
ascend_compare(const void* A_orig, const void* B_orig) operator() (eT a, eT b) const
{ {
const eT& A = *(static_cast<const eT*>(A_orig)); return (a < b);
const eT& B = *(static_cast<const eT*>(B_orig));
if(A < B)
{
return -1;
}
else
if(A > B)
{
return +1;
}
else
{
return 0;
}
} }
};
static template<typename eT>
int class arma_descend_sort_helper
descend_compare(const void* A_orig, const void* B_orig) {
{ public:
const eT& A = *(static_cast<const eT*>(A_orig));
const eT& B = *(static_cast<const eT*>(B_orig));
if(A < B) arma_inline
{ bool
return +1; operator() (eT a, eT b) const
} {
else return (a > b);
if(A > B)
{
return -1;
}
else
{
return 0;
}
} }
}; };
//template<>
template<typename T> template<typename T>
class arma_qsort_helper< std::complex<T> > class arma_ascend_sort_helper< std::complex<T> >
{ {
public: public:
typedef typename std::complex<T> eT; typedef typename std::complex<T> eT;
static inline
int bool
ascend_compare(const void* A_orig, const void* B_orig) operator() (const eT& a, const eT& b) const
{ {
const eT& A = *(static_cast<const eT*>(A_orig)); return (std::abs(a) < std::abs(b));
const eT& B = *(static_cast<const eT*>(B_orig));
const T abs_A = std::abs(A);
const T abs_B = std::abs(B);
if(abs_A < abs_B)
{
return -1;
}
else
if(abs_A > abs_B)
{
return +1;
}
else
{
return 0;
}
} }
};
static template<typename T>
int class arma_descend_sort_helper< std::complex<T> >
descend_compare(const void* A_orig, const void* B_orig) {
{ public:
const eT& A = *(static_cast<const eT*>(A_orig));
const eT& B = *(static_cast<const eT*>(B_orig));
const T abs_A = std::abs(A); typedef typename std::complex<T> eT;
const T abs_B = std::abs(B);
if(abs_A < abs_B) inline
{ bool
return +1; operator() (const eT& a, const eT& b) const
} {
else return (std::abs(a) > std::abs(b));
if(abs_A > abs_B)
{
return -1;
}
else
{
return 0;
}
} }
}; };
template<typename eT> template<typename eT>
inline inline
void void
op_sort::direct_sort(eT* X, const u32 n_elem, const u32 sort_type) op_sort::direct_sort(eT* X, const u32 n_elem, const u32 sort_type)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
if(sort_type == 0) if(sort_type == 0)
{ {
std::qsort(X, n_elem, sizeof(eT), arma_qsort_helper<eT>::ascend_compare arma_ascend_sort_helper<eT> comparator;
);
std::sort(&X[0], &X[n_elem], comparator);
} }
else else
{ {
std::qsort(X, n_elem, sizeof(eT), arma_qsort_helper<eT>::descend_compar arma_descend_sort_helper<eT> comparator;
e);
std::sort(&X[0], &X[n_elem], comparator);
}
}
template<typename eT>
inline
void
op_sort::copy_row(eT* X, const Mat<eT>& A, const u32 row)
{
const u32 N = A.n_cols;
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
X[i] = A.at(row,i);
X[j] = A.at(row,j);
}
if(i < N)
{
X[i] = A.at(row,i);
}
}
template<typename eT>
inline
void
op_sort::copy_row(Mat<eT>& A, const eT* X, const u32 row)
{
const u32 N = A.n_cols;
u32 i,j;
for(i=0, j=1; j<N; i+=2, j+=2)
{
A.at(row,i) = X[i];
A.at(row,j) = X[j];
}
if(i < N)
{
A.at(row,i) = X[i];
} }
} }
template<typename T1> template<typename T1>
inline inline
void void
op_sort::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_sort>& in) op_sort::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_sort>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
typedef typename T1::elem_type eT; typedef typename T1::elem_type eT;
const unwrap<T1> tmp(in.m); const unwrap<T1> tmp(in.m);
const Mat<eT>& X = tmp.M; const Mat<eT>& X = tmp.M;
const u32 sort_type = in.aux_u32_a; const u32 sort_type = in.aux_u32_a;
const u32 dim = in.aux_u32_b; const u32 dim = in.aux_u32_b;
arma_debug_check( (X.is_finite() == false), "sort(): given object has non -finite elements" );
arma_debug_check( (sort_type > 1), "sort(): incorrect usage. sor t_type must be 0 or 1"); arma_debug_check( (sort_type > 1), "sort(): incorrect usage. sor t_type must be 0 or 1");
arma_debug_check( (dim > 1), "sort(): incorrect usage. dim must be 0 or 1" ); arma_debug_check( (dim > 1), "sort(): incorrect usage. dim must be 0 or 1" );
arma_debug_check( (X.is_finite() == false), "sort(): given object has non -finite elements" );
if(dim == 0) // column-wise if( (X.n_rows * X.n_cols) <= 1 )
{
out = X;
return;
}
if(dim == 0) // sort the contents of each column
{ {
arma_extra_debug_print("op_sort::apply(), dim = 0"); arma_extra_debug_print("op_sort::apply(), dim = 0");
out = X; out = X;
for(u32 col=0; col<out.n_cols; ++col) const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols;
for(u32 col=0; col < n_cols; ++col)
{ {
op_sort::direct_sort( out.colptr(col), out.n_rows, sort_type ); op_sort::direct_sort( out.colptr(col), n_rows, sort_type );
} }
} }
else else
if(dim == 1) // row-wise if(dim == 1) // sort the contents of each row
{ {
if(X.n_rows != 1) // not a row vector if(X.n_rows == 1) // a row vector
{
arma_extra_debug_print("op_sort::apply(), dim = 1, vector specific");
out = X;
op_sort::direct_sort(out.memptr(), out.n_elem, sort_type);
}
else // not a row vector
{ {
arma_extra_debug_print("op_sort::apply(), dim = 1, generic"); arma_extra_debug_print("op_sort::apply(), dim = 1, generic");
//out.set_size(X.n_rows, X.n_cols);
out.copy_size(X); out.copy_size(X);
podarray<eT> tmp_array(X.n_cols); const u32 n_rows = out.n_rows;
const u32 n_cols = out.n_cols;
podarray<eT> tmp_array(n_cols);
for(u32 row=0; row<out.n_rows; ++row) for(u32 row=0; row < n_rows; ++row)
{ {
op_sort::copy_row(tmp_array.memptr(), X, row);
for(u32 col=0; col<out.n_cols; ++col) op_sort::direct_sort( tmp_array.memptr(), n_cols, sort_type );
{
tmp_array[col] = X.at(row,col);
}
op_sort::direct_sort( tmp_array.memptr(), out.n_cols, sort_type );
for(u32 col=0; col<out.n_cols; ++col)
{
out.at(row,col) = tmp_array[col];
}
op_sort::copy_row(out, tmp_array.memptr(), row);
} }
} }
else // a row vector
{
arma_extra_debug_print("op_sort::apply(), dim = 1, vector specific");
out = X;
op_sort::direct_sort(out.memptr(), out.n_elem, sort_type);
}
} }
} }
//! @} //! @}
 End of changes. 34 change blocks. 
125 lines changed or deleted 111 lines changed or added


 op_sort_proto.hpp   op_sort_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup op_sort //! \addtogroup op_sort
//! @{ //! @{
class op_sort class op_sort
{ {
public: public:
template<typename eT> template<typename eT>
inline static void copy_row(eT* X, const Mat<eT>& A, const u32 row);
template<typename eT>
inline static void copy_row(Mat<eT>& A, const eT* X, const u32 row);
template<typename eT>
inline static void direct_sort(eT* X, const u32 N, const u32 sort_type = 0); inline static void direct_sort(eT* X, const u32 N, const u32 sort_type = 0);
template<typename T1> template<typename T1>
inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _sort>& in); inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op _sort>& in);
}; };
//! @} //! @}
 End of changes. 3 change blocks. 
3 lines changed or deleted 8 lines changed or added


 span.hpp   span.hpp 
// Copyright (C) 2010 NICTA (www.nicta.com.au) // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2010 Conrad Sanderson // Copyright (C) 2010-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
//! \addtogroup span //! \addtogroup span
//! @{ //! @{
enum span_helper // an "anonymous" namespace is used to avoid possible multiple definitions
of span::all
// clashing with each other during linking
namespace
{ {
span_whole_vector
};
class span class span
{ {
public: public:
static const span_helper all = span_whole_vector; const u32 a;
const u32 b;
const bool whole;
static const span all;
inline
span()
: a(a)
, b(b)
, whole(true)
{
}
// TODO:
// if the "explicit" keyword is removed or commented out,
// the compiler will be able to automatically convert integers to an in
stance of the span class.
// this is useful for Cube::operator()(span&, span&, span&),
// but it might have unintended consequences or interactions elsewhere.
// as such, removal of "explicit" needs thorough testing.
inline
explicit
span(const u32 in_a)
: a(in_a)
, b(in_a)
, whole(false)
{
}
inline
span(const u32 in_a, const u32 in_b)
: a(in_a)
, b(in_b)
, whole(false)
{
}
inline };
span(const u32 in_a, const u32 in_b)
: a(in_a)
, b(in_b)
{
}
const u32 a; const span span::all = span();
const u32 b; }
};
//! @} //! @}
 End of changes. 7 change blocks. 
18 lines changed or deleted 49 lines changed or added


 subview_cube_meat.hpp   subview_cube_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 31 skipping to change at line 31
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_cube<eT>::subview_cube subview_cube<eT>::subview_cube
( (
const Cube<eT>& in_m, const Cube<eT>& in_m,
const u32 in_row1, const u32 in_row1,
const u32 in_col1, const u32 in_col1,
const u32 in_slice1, const u32 in_slice1,
const u32 in_row2, const u32 in_n_rows,
const u32 in_col2, const u32 in_n_cols,
const u32 in_slice2 const u32 in_n_slices
) )
: m (in_m) : m (in_m)
, m_ptr (0) , m_ptr (0)
, aux_row1 (in_row1) , aux_row1 (in_row1)
, aux_col1 (in_col1) , aux_col1 (in_col1)
, aux_slice1 (in_slice1) , aux_slice1 (in_slice1)
, aux_row2 (in_row2) , n_rows (in_n_rows)
, aux_col2 (in_col2) , n_cols (in_n_cols)
, aux_slice2 (in_slice2) , n_elem_slice(in_n_rows * in_n_cols)
, n_rows (1 + in_row2 - in_row1) , n_slices (in_n_slices)
, n_cols (1 + in_col2 - in_col1) , n_elem (n_elem_slice * in_n_slices)
, n_elem_slice(n_rows * n_cols)
, n_slices (1 + in_slice2 - in_slice1)
, n_elem (n_elem_slice * n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_cube<eT>::subview_cube subview_cube<eT>::subview_cube
( (
Cube<eT>& in_m, Cube<eT>& in_m,
const u32 in_row1, const u32 in_row1,
const u32 in_col1, const u32 in_col1,
const u32 in_slice1, const u32 in_slice1,
const u32 in_row2, const u32 in_n_rows,
const u32 in_col2, const u32 in_n_cols,
const u32 in_slice2 const u32 in_n_slices
) )
: m (in_m) : m (in_m)
, m_ptr (&in_m) , m_ptr (&in_m)
, aux_row1 (in_row1) , aux_row1 (in_row1)
, aux_col1 (in_col1) , aux_col1 (in_col1)
, aux_slice1 (in_slice1) , aux_slice1 (in_slice1)
, aux_row2 (in_row2) , n_rows (in_n_rows)
, aux_col2 (in_col2) , n_cols (in_n_cols)
, aux_slice2 (in_slice2) , n_elem_slice(in_n_rows * in_n_cols)
, n_rows (1 + in_row2 - in_row1) , n_slices (in_n_slices)
, n_cols (1 + in_col2 - in_col1) , n_elem (n_elem_slice * in_n_slices)
, n_elem_slice(n_rows * n_cols)
, n_slices (1 + in_slice2 - in_slice1)
, n_elem (n_elem_slice * n_slices)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator+= (const eT val) subview_cube<eT>::operator+= (const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 312 skipping to change at line 306
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator= (const subview_cube<eT>& x_in) subview_cube<eT>::operator= (const subview_cube<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.n_rows, x_i n.n_cols, x_in.n_slices) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
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_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
skipping to change at line 349 skipping to change at line 343
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator+= (const subview_cube<eT>& x_in) subview_cube<eT>::operator+= (const subview_cube<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.n_rows, x_i n.n_cols, x_in.n_slices) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "addition"); arma_debug_assert_same_size(t, x, "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_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
skipping to change at line 386 skipping to change at line 380
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator-= (const subview_cube<eT>& x_in) subview_cube<eT>::operator-= (const subview_cube<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.n_rows, x_i n.n_cols, x_in.n_slices) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "subtraction"); arma_debug_assert_same_size(t, x, "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_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
skipping to change at line 423 skipping to change at line 417
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator%= (const subview_cube<eT>& x_in) subview_cube<eT>::operator%= (const subview_cube<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.n_rows, x_i n.n_cols, x_in.n_slices) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise multiplication"); arma_debug_assert_same_size(t, x, "element-wise multiplication");
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_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
skipping to change at line 460 skipping to change at line 454
template<typename eT> template<typename eT>
inline inline
void void
subview_cube<eT>::operator/= (const subview_cube<eT>& x_in) subview_cube<eT>::operator/= (const subview_cube<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0; Cube<eT>* tmp_cube = overlap ? new Cube<eT>(x_in.m) : 0;
const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.aux_row2, x _in.aux_col2, x_in.aux_slice2) : 0; const subview_cube<eT>* tmp_subview_cube = overlap ? new subview_cube<eT> (*tmp_cube, x_in.aux_row1, x_in.aux_col1, x_in.aux_slice1, x_in.n_rows, x_i n.n_cols, x_in.n_slices) : 0;
const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in; const subview_cube<eT>& x = overlap ? (*tmp_subview_cube) : x_in;
subview_cube<eT>& t = *this; subview_cube<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise division"); arma_debug_assert_same_size(t, x, "element-wise 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_n_slices = t.n_slices; const u32 t_n_slices = t.n_slices;
skipping to change at line 500 skipping to change at line 494
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, "copy into subcube"); const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices;
const u32 t_n_rows = t.n_rows; const u32 x_n_rows = x.n_rows;
const u32 t_n_cols = t.n_cols; const u32 x_n_cols = x.n_cols;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1)
)
{
// interpret the matrix as a cube with one slice
for(u32 col = 0; col < t_n_cols; ++col)
{
arrayops::copy( t.slice_colptr(0, col), x.colptr(col), t_n_rows );
}
}
else
if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
)
{ {
arrayops::copy( t.slice_colptr(t_aux_slice1, col), x.colptr(col), t_n_r // interpret the matrix as a cube with one column
ows ); // and with the number of slices equal to the number of columns in the
matrix
for(u32 i=0; i < t_n_slices; ++i)
{
arrayops::copy( t.slice_colptr(i, 0), x.colptr(i), t_n_rows );
}
}
else
if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
)
{
// interpret the matrix as a cube with one row
// and with the number of slices equal to the number of rows in the mat
rix
Cube<eT>& Q = *(t.m_ptr);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col=0; col < t_n_cols; ++col)
{
const eT* x_colptr = x.colptr(col);
for(u32 i=0; i < t_n_slices; ++i)
{
Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) = x_colptr[i];
}
}
}
else
{
if(arma_config::debug == true)
{
arma_stop( arma_incompat_size_string(t, x, "copy into subcube") );
}
} }
} }
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, "addition"); const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices;
const u32 t_n_rows = t.n_rows; const u32 x_n_rows = x.n_rows;
const u32 t_n_cols = t.n_cols; const u32 x_n_cols = x.n_cols;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1)
)
{
for(u32 col = 0; col < t_n_cols; ++col)
{
arrayops::inplace_plus( t.slice_colptr(0, col), x.colptr(col), t_n_ro
ws );
}
}
else
if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
)
{ {
arrayops::inplace_plus( t.slice_colptr(t_aux_slice1, col), x.colptr(col for(u32 i=0; i < t_n_slices; ++i)
), t_n_rows ); {
arrayops::inplace_plus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows )
;
}
}
else
if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
)
{
Cube<eT>& Q = *(t.m_ptr);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col=0; col < t_n_cols; ++col)
{
const eT* x_colptr = x.colptr(col);
for(u32 i=0; i < t_n_slices; ++i)
{
Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) += x_colptr[i]
;
}
}
}
else
{
if(arma_config::debug == true)
{
arma_stop( arma_incompat_size_string(t, x, "addition") );
}
} }
} }
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, "subtraction"); const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices;
const u32 t_n_rows = t.n_rows; const u32 x_n_rows = x.n_rows;
const u32 t_n_cols = t.n_cols; const u32 x_n_cols = x.n_cols;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1)
)
{
for(u32 col = 0; col < t_n_cols; ++col)
{
arrayops::inplace_minus( t.slice_colptr(0, col), x.colptr(col), t_n_r
ows );
}
}
else
if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
)
{ {
arrayops::inplace_minus( t.slice_colptr(t_aux_slice1, col), x.colptr(co for(u32 i=0; i < t_n_slices; ++i)
l), t_n_rows ); {
arrayops::inplace_minus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows
);
}
}
else
if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
)
{
Cube<eT>& Q = *(t.m_ptr);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col=0; col < t_n_cols; ++col)
{
const eT* x_colptr = x.colptr(col);
for(u32 i=0; i < t_n_slices; ++i)
{
Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) -= x_colptr[i]
;
}
}
}
else
{
if(arma_config::debug == true)
{
arma_stop( arma_incompat_size_string(t, x, "subtraction") );
}
} }
} }
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 multiplication"); const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices;
const u32 t_n_rows = t.n_rows; const u32 x_n_rows = x.n_rows;
const u32 t_n_cols = t.n_cols; const u32 x_n_cols = x.n_cols;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1)
)
{
for(u32 col = 0; col < t_n_cols; ++col)
{
arrayops::inplace_mul( t.slice_colptr(0, col), x.colptr(col), t_n_row
s );
}
}
else
if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
)
{ {
arrayops::inplace_mul( t.slice_colptr(t_aux_slice1, col), x.colptr(col) for(u32 i=0; i < t_n_slices; ++i)
, t_n_rows ); {
arrayops::inplace_mul( t.slice_colptr(i, 0), x.colptr(i), t_n_rows );
}
}
else
if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
)
{
Cube<eT>& Q = *(t.m_ptr);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col=0; col < t_n_cols; ++col)
{
const eT* x_colptr = x.colptr(col);
for(u32 i=0; i < t_n_slices; ++i)
{
Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) *= x_colptr[i]
;
}
}
}
else
{
if(arma_config::debug == true)
{
arma_stop( arma_incompat_size_string(t, x, "element-wise multiplicati
on") );
}
} }
} }
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 division"); const u32 t_n_rows = t.n_rows;
const u32 t_n_cols = t.n_cols;
const u32 t_n_slices = t.n_slices;
const u32 t_n_rows = t.n_rows; const u32 x_n_rows = x.n_rows;
const u32 t_n_cols = t.n_cols; const u32 x_n_cols = x.n_cols;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col = 0; col < t_n_cols; ++col) if( (t_n_rows == x_n_rows) && (t_n_cols == x_n_cols) && (t_n_slices == 1) )
{ {
arrayops::inplace_div( t.slice_colptr(t_aux_slice1, col), x.colptr(col) for(u32 col = 0; col < t_n_cols; ++col)
, t_n_rows ); {
arrayops::inplace_div( t.slice_colptr(0, col), x.colptr(col), t_n_row
s );
}
}
else
if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
)
{
for(u32 i=0; i < t_n_slices; ++i)
{
arrayops::inplace_div( t.slice_colptr(i, 0), x.colptr(i), t_n_rows );
}
}
else
if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
)
{
Cube<eT>& Q = *(t.m_ptr);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_slice1 = t.aux_slice1;
for(u32 col=0; col < t_n_cols; ++col)
{
const eT* x_colptr = x.colptr(col);
for(u32 i=0; i < t_n_slices; ++i)
{
Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) /= x_colptr[i]
;
}
}
}
else
{
if(arma_config::debug == true)
{
arma_stop( arma_incompat_size_string(t, x, "element-wise division") )
;
}
} }
} }
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 790 skipping to change at line 982
subview_cube<eT>::check_overlap(const subview_cube<eT>& x) const subview_cube<eT>::check_overlap(const subview_cube<eT>& x) const
{ {
const subview_cube<eT>& t = *this; const subview_cube<eT>& t = *this;
if(&t.m != &x.m) if(&t.m != &x.m)
{ {
return false; return false;
} }
else else
{ {
const bool row_overlap = if( (t.n_elem == 0) || (x.n_elem == 0) )
( {
( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) return false;
|| }
( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) else
); {
const u32 t_aux_row1 = t.aux_row1;
const bool col_overlap = const u32 t_aux_row2 = t_aux_row1 + t.n_rows - 1;
(
( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) const u32 t_aux_col1 = t.aux_col1;
|| const u32 t_aux_col2 = t_aux_col1 + t.n_cols - 1;
( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) )
); const u32 t_aux_slice1 = t.aux_slice1;
const u32 t_aux_slice2 = t_aux_slice1 + t.n_slices - 1;
const bool slice_overlap =
( const u32 x_aux_row1 = x.aux_row1;
( (x.aux_slice1 >= t.aux_slice1) && (x.aux_slice1 <= t.aux_slice2) ) const u32 x_aux_row2 = x_aux_row1 + x.n_rows - 1;
||
( (x.aux_slice2 >= t.aux_slice1) && (x.aux_slice2 <= t.aux_slice2) ) const u32 x_aux_col1 = x.aux_col1;
); const u32 x_aux_col2 = x_aux_col1 + x.n_cols - 1;
const bool overlap = ( (row_overlap == true) && (col_overlap == true) & const u32 x_aux_slice1 = x.aux_slice1;
& (slice_overlap == true) ); const u32 x_aux_slice2 = x_aux_slice1 + x.n_slices - 1;
return overlap; const bool row_overlap =
(
( (x_aux_row1 >= t_aux_row1) && (x_aux_row1 <= t_aux_row2) )
||
( (x_aux_row2 >= t_aux_row1) && (x_aux_row2 <= t_aux_row2) )
);
const bool col_overlap =
(
( (x_aux_col1 >= t_aux_col1) && (x_aux_col1 <= t_aux_col2) )
||
( (x_aux_col2 >= t_aux_col1) && (x_aux_col2 <= t_aux_col2) )
);
const bool slice_overlap =
(
( (x_aux_slice1 >= t_aux_slice1) && (x_aux_slice1 <= t_aux_slice2)
)
||
( (x_aux_slice2 >= t_aux_slice1) && (x_aux_slice2 <= t_aux_slice2)
)
);
const bool overlap = ( (row_overlap == true) && (col_overlap == true)
&& (slice_overlap == true) );
return overlap;
}
} }
} }
template<typename eT> template<typename eT>
inline inline
bool bool
subview_cube<eT>::check_overlap(const Mat<eT>& x) const subview_cube<eT>::check_overlap(const Mat<eT>& x) const
{ {
const subview_cube<eT>& t = *this; const subview_cube<eT>& t = *this;
for(u32 slice = t.aux_slice1; slice <= t.aux_slice2; ++slice) const u32 t_aux_slice1 = t.aux_slice1;
const u32 t_aux_slice2_plus_1 = t_aux_slice1 + t.n_slices;
for(u32 slice = t_aux_slice1; slice < t_aux_slice2_plus_1; ++slice)
{ {
const Mat<eT>& y = *(t.m.mat_ptrs[slice]); const Mat<eT>& y = *(t.m.mat_ptrs[slice]);
if( x.memptr() == y.memptr() ) if( x.memptr() == y.memptr() )
{ {
return true; return true;
} }
} }
return false; return false;
skipping to change at line 877 skipping to change at line 1097
} }
if(alias) if(alias)
{ {
actual_out = out; actual_out = out;
delete tmp; delete tmp;
} }
} }
//! mat X = Y.subcube(...)
template<typename eT>
inline
void
subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in)
{
arma_extra_debug_sigprint();
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_cols = in.n_cols;
const u32 aux_slice1 = in.aux_slice1;
out.set_size(n_rows, n_cols);
for(u32 col = 0; col < n_cols; ++col)
{
arrayops::copy( out.colptr(col), in.slice_colptr(aux_slice1, col), n_ro
ws );
}
}
//! 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();
arma_debug_assert_same_size(out, in, "addition"); arma_debug_assert_same_size(out, in, "addition");
skipping to change at line 991 skipping to change at line 1189
for(u32 slice = 0; slice<n_slices; ++slice) for(u32 slice = 0; slice<n_slices; ++slice)
{ {
for(u32 col = 0; col<n_cols; ++col) for(u32 col = 0; col<n_cols; ++col)
{ {
arrayops::inplace_div( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows ); arrayops::inplace_div( out.slice_colptr(slice,col), in.slice_colptr(s lice,col), n_rows );
} }
} }
} }
//! mat X = Y.subcube(...)
template<typename eT>
inline
void
subview_cube<eT>::extract(Mat<eT>& out, const subview_cube<eT>& in)
{
arma_extra_debug_sigprint();
arma_debug_assert_cube_as_mat(out, in, "copy into matrix", false);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{
out.set_size(in_n_rows, in_n_cols);
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::copy( out.colptr(col), in.slice_colptr(0, col), in_n_rows )
;
}
}
else
{
if(out_vec_state == 0)
{
if(in_n_cols == 1)
{
out.set_size(in_n_rows, in_n_slices);
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows )
;
}
}
else
if(in_n_rows == 1)
{
out.set_size(in_n_slices, in_n_cols);
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] = Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sli
ce1 + i);
}
}
}
}
else
{
out.set_size(in_n_slices);
eT* out_mem = out.memptr();
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] = Q.at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
}
}
}
}
//! 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, "addition"); arma_debug_assert_cube_as_mat(out, in, "addition", true);
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; const u32 in_n_slices = in.n_slices;
for(u32 col = 0; col < in_n_cols; ++col) const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{ {
arrayops::inplace_plus( out.colptr(col), in.slice_colptr(in_aux_slice1, for(u32 col=0; col < in_n_cols; ++col)
col), in_n_rows ); {
arrayops::inplace_plus( out.colptr(col), in.slice_colptr(0, col), in_
n_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_
n_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] += Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl
ice1 + i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] += Q.at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
}
}
} }
} }
//! 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, "subtraction"); arma_debug_assert_cube_as_mat(out, in, "subtraction", true);
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; const u32 in_n_slices = in.n_slices;
for(u32 col = 0; col < in_n_cols; ++col) const u32 out_n_rows = out.n_rows;
const u32 out_n_cols = out.n_cols;
const u32 out_vec_state = out.vec_state;
if(in_n_slices == 1)
{ {
arrayops::inplace_minus( out.colptr(col), in.slice_colptr(in_aux_slice1 for(u32 col=0; col < in_n_cols; ++col)
, col), in_n_rows ); {
arrayops::inplace_minus( out.colptr(col), in.slice_colptr(0, col), in
_n_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in
_n_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] -= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl
ice1 + i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] -= Q.at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
}
}
} }
} }
//! 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, "element-wise multiplication"); arma_debug_assert_cube_as_mat(out, in, "element-wise multiplication", tru
e);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 in_n_rows = in.n_rows; const u32 out_n_rows = out.n_rows;
const u32 in_n_cols = in.n_cols; const u32 out_n_cols = out.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 out_vec_state = out.vec_state;
for(u32 col = 0; col < in_n_cols; ++col) if(in_n_slices == 1)
{
for(u32 col=0; col < in_n_cols; ++col)
{
arrayops::inplace_mul( out.colptr(col), in.slice_colptr(0, col), in_n
_rows );
}
}
else
{ {
arrayops::inplace_mul( out.colptr(col), in.slice_colptr(in_aux_slice1, if(out_vec_state == 0)
col), in_n_rows ); {
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] *= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl
ice1 + i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] *= Q.at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
}
}
} }
} }
//! 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, "element-wise division"); arma_debug_assert_cube_as_mat(out, in, "element-wise division", true);
const u32 in_n_rows = in.n_rows;
const u32 in_n_cols = in.n_cols;
const u32 in_n_slices = in.n_slices;
const u32 in_n_rows = in.n_rows; const u32 out_n_rows = out.n_rows;
const u32 in_n_cols = in.n_cols; const u32 out_n_cols = out.n_cols;
const u32 in_aux_slice1 = in.aux_slice1; const u32 out_vec_state = out.vec_state;
for(u32 col = 0; col < in_n_cols; ++col) if(in_n_slices == 1)
{ {
arrayops::inplace_div( out.colptr(col), in.slice_colptr(in_aux_slice1, for(u32 col=0; col < in_n_cols; ++col)
col), in_n_rows ); {
arrayops::inplace_div( out.colptr(col), in.slice_colptr(0, col), in_n
_rows );
}
}
else
{
if(out_vec_state == 0)
{
if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) )
{
for(u32 i=0; i < in_n_slices; ++i)
{
arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows );
}
}
else
if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) )
{
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 col=0; col < in_n_cols; ++col)
{
eT* out_colptr = out.colptr(col);
for(u32 i=0; i < in_n_slices; ++i)
{
out_colptr[i] /= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl
ice1 + i);
}
}
}
}
else
{
eT* out_mem = out.memptr();
const Cube<eT>& Q = in.m;
const u32 in_aux_row1 = in.aux_row1;
const u32 in_aux_col1 = in.aux_col1;
const u32 in_aux_slice1 = in.aux_slice1;
for(u32 i=0; i<in_n_slices; ++i)
{
out_mem[i] /= Q.at(in_aux_row1, in_aux_col1, in_aux_slice1 + i);
}
}
} }
} }
//! @} //! @}
 End of changes. 52 change blocks. 
140 lines changed or deleted 677 lines changed or added


 subview_cube_proto.hpp   subview_cube_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 33 skipping to change at line 33
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
const u32 aux_row1; const u32 aux_row1;
const u32 aux_col1; const u32 aux_col1;
const u32 aux_slice1; const u32 aux_slice1;
const u32 aux_row2;
const u32 aux_col2;
const u32 aux_slice2;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem_slice; const u32 n_elem_slice;
const u32 n_slices; const u32 n_slices;
const u32 n_elem; const u32 n_elem;
protected: protected:
arma_inline subview_cube(const Cube<eT>& in_m, const u32 in_row1, const u arma_inline subview_cube(const Cube<eT>& in_m, const u32 in_row1, const u
32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, cons 32 in_col1, const u32 in_slice1, const u32 in_n_rows, const u32 in_n_cols,
t u32 in_slice2); const u32 in_n_slices);
arma_inline subview_cube( Cube<eT>& in_m, const u32 in_row1, const u arma_inline subview_cube( Cube<eT>& in_m, const u32 in_row1, const u
32 in_col1, const u32 in_slice1, const u32 in_row2, const u32 in_col2, cons 32 in_col1, const u32 in_slice1, const u32 in_n_rows, const u32 in_n_cols,
t u32 in_slice2); const u32 in_n_slices);
public: public:
inline ~subview_cube(); inline ~subview_cube();
inline void operator+= (const eT val); inline void operator+= (const eT val);
inline void operator-= (const eT val); inline void operator-= (const eT val);
inline void operator*= (const eT val); inline void operator*= (const eT val);
inline void operator/= (const eT val); inline void operator/= (const eT val);
skipping to change at line 76 skipping to change at line 72
inline void operator-= (const subview_cube& x); inline void operator-= (const subview_cube& x);
inline void operator%= (const subview_cube& x); inline void operator%= (const subview_cube& x);
inline void operator/= (const subview_cube& x); inline void operator/= (const subview_cube& x);
template<typename T1> inline void operator= (const Base<eT,T1>& x); template<typename T1> inline void operator= (const Base<eT,T1>& x);
template<typename T1> inline void operator+= (const Base<eT,T1>& x); template<typename T1> inline void operator+= (const Base<eT,T1>& x);
template<typename T1> inline void operator-= (const Base<eT,T1>& x); template<typename T1> inline void operator-= (const Base<eT,T1>& x);
template<typename T1> inline void operator%= (const Base<eT,T1>& x); template<typename T1> inline void operator%= (const Base<eT,T1>& x);
template<typename T1> inline void operator/= (const Base<eT,T1>& x); template<typename T1> inline void operator/= (const Base<eT,T1>& x);
inline static void extract(Cube<eT>& out, const subview_cube& in); inline static void extract(Cube<eT>& out, const subview_cube& in);
inline static void extract(Mat<eT>& out, const subview_cube& in);
inline static void plus_inplace(Cube<eT>& out, const subview_cube& in); inline static void plus_inplace(Cube<eT>& out, const subview_cube& in);
inline static void minus_inplace(Cube<eT>& out, const subview_cube& in); inline static void minus_inplace(Cube<eT>& out, const subview_cube& in);
inline static void schur_inplace(Cube<eT>& out, const subview_cube& in); inline static void schur_inplace(Cube<eT>& out, const subview_cube& in);
inline static void div_inplace(Cube<eT>& out, const subview_cube& in); inline static void div_inplace(Cube<eT>& out, const subview_cube& in);
inline static void extract(Mat<eT>& out, const subview_cube& in);
inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); inline static void plus_inplace(Mat<eT>& out, const subview_cube& in);
inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); inline static void minus_inplace(Mat<eT>& out, const subview_cube& in);
inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); inline static void schur_inplace(Mat<eT>& out, const subview_cube& in);
inline static void div_inplace(Mat<eT>& out, const subview_cube& in); inline static void div_inplace(Mat<eT>& out, const subview_cube& in);
inline void fill(const eT val); inline void fill(const eT val);
inline void zeros(); inline void zeros();
inline void ones(); inline void ones();
arma_inline eT& operator[](const u32 i); arma_inline eT& operator[](const u32 i);
 End of changes. 5 change blocks. 
15 lines changed or deleted 10 lines changed or added


 subview_field_meat.hpp   subview_field_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 30 skipping to change at line 30
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename oT> template<typename oT>
arma_inline arma_inline
subview_field<oT>::subview_field subview_field<oT>::subview_field
( (
const field<oT>& in_f, const field<oT>& in_f,
const u32 in_row1, const u32 in_row1,
const u32 in_col1, const u32 in_col1,
const u32 in_row2, const u32 in_n_rows,
const u32 in_col2 const u32 in_n_cols
) )
: f(in_f) : f(in_f)
, f_ptr(0) , f_ptr(0)
, aux_row1(in_row1) , aux_row1(in_row1)
, aux_col1(in_col1) , aux_col1(in_col1)
, aux_row2(in_row2) , n_rows(in_n_rows)
, aux_col2(in_col2) , n_cols(in_n_cols)
, n_rows(1 + in_row2 - in_row1) , n_elem(in_n_rows*in_n_cols)
, n_cols(1 + in_col2 - in_col1)
, n_elem(n_rows*n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename oT> template<typename oT>
arma_inline arma_inline
subview_field<oT>::subview_field subview_field<oT>::subview_field
( (
field<oT>& in_f, field<oT>& in_f,
const u32 in_row1, const u32 in_row1,
const u32 in_col1, const u32 in_col1,
const u32 in_row2, const u32 in_n_rows,
const u32 in_col2 const u32 in_n_cols
) )
: f(in_f) : f(in_f)
, f_ptr(&in_f) , f_ptr(&in_f)
, aux_row1(in_row1) , aux_row1(in_row1)
, aux_col1(in_col1) , aux_col1(in_col1)
, aux_row2(in_row2) , n_rows(in_n_rows)
, aux_col2(in_col2) , n_cols(in_n_cols)
, n_rows(1 + in_row2 - in_row1) , n_elem(in_n_rows*in_n_cols)
, n_cols(1 + in_col2 - in_col1)
, n_elem(n_rows*n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename oT> template<typename oT>
inline inline
void void
subview_field<oT>::operator= (const field<oT>& x) subview_field<oT>::operator= (const field<oT>& x)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 100 skipping to change at line 96
template<typename oT> template<typename oT>
inline inline
void void
subview_field<oT>::operator= (const subview_field<oT>& x_in) subview_field<oT>::operator= (const subview_field<oT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
field<oT>* tmp_field = overlap ? new field<oT>(x_in.f) : 0; field<oT>* tmp_field = overlap ? new field<oT>(x_in.f) : 0;
const subview_field<oT>* tmp_subview = overlap ? new subview_field<oT>(*t mp_field, x_in.aux_row1, x_in.aux_col1, x_in.aux_row2, x_in.aux_col2) : 0; const subview_field<oT>* tmp_subview = overlap ? new subview_field<oT>(*t mp_field, x_in.aux_row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview_field<oT>& x = overlap ? (*tmp_subview) : x_in; const subview_field<oT>& x = overlap ? (*tmp_subview) : x_in;
subview_field<oT>& t = *this; subview_field<oT>& t = *this;
arma_debug_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols), "inco mpatible field dimensions"); arma_debug_check( (t.n_rows != x.n_rows) || (t.n_cols != x.n_cols), "inco mpatible field dimensions");
for(u32 col=0; col<t.n_cols; ++col) for(u32 col=0; col<t.n_cols; ++col)
{ {
for(u32 row=0; row<t.n_rows; ++row) for(u32 row=0; row<t.n_rows; ++row)
{ {
skipping to change at line 245 skipping to change at line 241
subview_field<oT>::check_overlap(const subview_field<oT>& x) const subview_field<oT>::check_overlap(const subview_field<oT>& x) const
{ {
const subview_field<oT>& t = *this; const subview_field<oT>& t = *this;
if(&t.f != &x.f) if(&t.f != &x.f)
{ {
return false; return false;
} }
else else
{ {
const bool row_overlap = if( (t.n_elem == 0) || (x.n_elem == 0) )
( {
( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) return false;
|| }
( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) else
); {
const u32 t_aux_row1 = t.aux_row1;
const bool col_overlap = const u32 t_aux_row2 = t_aux_row1 + t.n_rows - 1;
(
( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) const u32 t_aux_col1 = t.aux_col1;
|| const u32 t_aux_col2 = t_aux_col1 + t.n_cols - 1;
( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) )
);
const bool overlap = ( (row_overlap == true) && (col_overlap == true) ) const u32 x_aux_row1 = x.aux_row1;
; const u32 x_aux_row2 = x_aux_row1 + x.n_rows - 1;
return overlap; const u32 x_aux_col1 = x.aux_col1;
const u32 x_aux_col2 = x_aux_col1 + x.n_cols - 1;
const bool row_overlap =
(
( (x_aux_row1 >= t_aux_row1) && (x_aux_row1 <= t_aux_row2) )
||
( (x_aux_row2 >= t_aux_row1) && (x_aux_row2 <= t_aux_row2) )
);
const bool col_overlap =
(
( (x_aux_col1 >= t_aux_col1) && (x_aux_col1 <= t_aux_col2) )
||
( (x_aux_col2 >= t_aux_col1) && (x_aux_col2 <= t_aux_col2) )
);
const bool overlap = ( (row_overlap == true) && (col_overlap == true)
);
return overlap;
}
} }
} }
//! X = Y.subfield(...) //! X = Y.subfield(...)
template<typename oT> template<typename oT>
inline inline
void void
subview_field<oT>::extract(field<oT>& actual_out, const subview_field<oT>& in) subview_field<oT>::extract(field<oT>& actual_out, const subview_field<oT>& in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 9 change blocks. 
33 lines changed or deleted 48 lines changed or added


 subview_field_proto.hpp   subview_field_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 31 skipping to change at line 31
public: const field<oT>& f; public: const field<oT>& f;
protected: field<oT>* f_ptr; protected: field<oT>* f_ptr;
public: public:
typedef oT object_type; typedef oT object_type;
const u32 aux_row1; const u32 aux_row1;
const u32 aux_col1; const u32 aux_col1;
const u32 aux_row2;
const u32 aux_col2;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem; const u32 n_elem;
protected: protected:
arma_inline subview_field(const field<oT>& in_f, const u32 in_row1, const arma_inline subview_field(const field<oT>& in_f, const u32 in_row1, const
u32 in_col1, const u32 in_row2, const u32 in_col2); u32 in_col1, const u32 in_n_rows, const u32 in_n_cols);
arma_inline subview_field( field<oT>& in_f, const u32 in_row1, const arma_inline subview_field( field<oT>& in_f, const u32 in_row1, const
u32 in_col1, const u32 in_row2, const u32 in_col2); u32 in_col1, const u32 in_n_rows, const u32 in_n_cols);
public: public:
inline ~subview_field(); inline ~subview_field();
inline void operator= (const field<oT>& x); inline void operator= (const field<oT>& x);
inline void operator= (const subview_field& x); inline void operator= (const subview_field& x);
arma_inline oT& operator[](const u32 i); arma_inline oT& operator[](const u32 i);
arma_inline const oT& operator[](const u32 i) const; arma_inline const oT& operator[](const u32 i) const;
 End of changes. 3 change blocks. 
9 lines changed or deleted 6 lines changed or added


 subview_meat.hpp   subview_meat.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 25 skipping to change at line 25
template<typename eT> template<typename eT>
inline inline
subview<eT>::~subview() subview<eT>::~subview()
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview<eT>::subview(const Mat<eT>& in_m, const u32 in_row1, const u32 in_c ol1, const u32 in_row2, const u32 in_col2) subview<eT>::subview(const Mat<eT>& in_m, const u32 in_row1, const u32 in_c ol1, const u32 in_n_rows, const u32 in_n_cols)
: m(in_m) : m(in_m)
, m_ptr(0) , m_ptr(0)
, aux_row1(in_row1) , aux_row1(in_row1)
, aux_col1(in_col1) , aux_col1(in_col1)
, aux_row2(in_row2) , n_rows(in_n_rows)
, aux_col2(in_col2) , n_cols(in_n_cols)
, n_rows(1 + in_row2 - in_row1) , n_elem(in_n_rows*in_n_cols)
, n_cols(1 + in_col2 - in_col1)
, n_elem(n_rows*n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview<eT>::subview(Mat<eT>& in_m, const u32 in_row1, const u32 in_col1, c onst u32 in_row2, const u32 in_col2) subview<eT>::subview(Mat<eT>& in_m, const u32 in_row1, const u32 in_col1, c onst u32 in_n_rows, const u32 in_n_cols)
: m(in_m) : m(in_m)
, m_ptr(&in_m) , m_ptr(&in_m)
, aux_row1(in_row1) , aux_row1(in_row1)
, aux_col1(in_col1) , aux_col1(in_col1)
, aux_row2(in_row2) , n_rows(in_n_rows)
, aux_col2(in_col2) , n_cols(in_n_cols)
, n_rows(1 + in_row2 - in_row1) , n_elem(in_n_rows*in_n_cols)
, n_cols(1 + in_col2 - in_col1)
, n_elem(n_rows*n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator+= (const eT val) subview<eT>::operator+= (const eT val)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 553 skipping to change at line 549
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator= (const subview<eT>& x_in) subview<eT>::operator= (const subview<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0;
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; const subview<eT>* tmp_subview = overlap ? new subview<eT>(*tmp_mat, x_in .aux_row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview<eT>& x = overlap ? (*tmp_subview) : x_in; const subview<eT>& x = overlap ? (*tmp_subview) : x_in;
subview<eT>& t = *this; subview<eT>& t = *this;
arma_debug_assert_same_size(t, x, "insert into submatrix"); arma_debug_assert_same_size(t, x, "insert into submatrix");
const u32 t_n_cols = t.n_cols; const u32 t_n_cols = t.n_cols;
const u32 t_n_rows = t.n_rows; const u32 t_n_rows = t.n_rows;
if(t_n_rows == 1) if(t_n_rows == 1)
skipping to change at line 595 skipping to change at line 591
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator+= (const subview<eT>& x_in) subview<eT>::operator+= (const subview<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0;
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; const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux _row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview<eT>& x = overlap ? (*tmp_subview) : x_in; const subview<eT>& x = overlap ? (*tmp_subview) : x_in;
subview<eT>& t = *this; subview<eT>& t = *this;
arma_debug_assert_same_size(t, x, "addition"); arma_debug_assert_same_size(t, x, "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;
if(t_n_rows == 1) if(t_n_rows == 1)
skipping to change at line 637 skipping to change at line 633
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator-= (const subview<eT>& x_in) subview<eT>::operator-= (const subview<eT>& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0;
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; const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux _row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview<eT>& x = overlap ? (*tmp_subview) : x_in; const subview<eT>& x = overlap ? (*tmp_subview) : x_in;
subview<eT>& t = *this; subview<eT>& t = *this;
arma_debug_assert_same_size(t, x, "subtraction"); arma_debug_assert_same_size(t, x, "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;
if(t_n_rows == 1) if(t_n_rows == 1)
skipping to change at line 680 skipping to change at line 676
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator%= (const subview& x_in) subview<eT>::operator%= (const subview& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0;
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; const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux _row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview<eT>& x = overlap ? (*tmp_subview) : x_in; const subview<eT>& x = overlap ? (*tmp_subview) : x_in;
subview<eT>& t = *this; subview<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise multiplication"); arma_debug_assert_same_size(t, x, "element-wise multiplication");
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;
if(t_n_rows == 1) if(t_n_rows == 1)
skipping to change at line 723 skipping to change at line 719
template<typename eT> template<typename eT>
inline inline
void void
subview<eT>::operator/= (const subview& x_in) subview<eT>::operator/= (const subview& x_in)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
const bool overlap = check_overlap(x_in); const bool overlap = check_overlap(x_in);
Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0; Mat<eT>* tmp_mat = overlap ? new Mat<eT>(x_in.m) : 0;
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; const subview<eT>* tmp_subview = overlap ? new subview(*tmp_mat, x_in.aux _row1, x_in.aux_col1, x_in.n_rows, x_in.n_cols) : 0;
const subview<eT>& x = overlap ? (*tmp_subview) : x_in; const subview<eT>& x = overlap ? (*tmp_subview) : x_in;
subview<eT>& t = *this; subview<eT>& t = *this;
arma_debug_assert_same_size(t, x, "element-wise division"); arma_debug_assert_same_size(t, x, "element-wise 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;
if(t_n_rows == 1) if(t_n_rows == 1)
skipping to change at line 913 skipping to change at line 909
subview<eT>::check_overlap(const subview<eT>& x) const subview<eT>::check_overlap(const subview<eT>& x) const
{ {
const subview<eT>& t = *this; const subview<eT>& t = *this;
if(&t.m != &x.m) if(&t.m != &x.m)
{ {
return false; return false;
} }
else else
{ {
const bool row_overlap = if( (t.n_elem == 0) || (x.n_elem == 0) )
( {
( (x.aux_row1 >= t.aux_row1) && (x.aux_row1 <= t.aux_row2) ) // if t.n_elem is 0, t.n_rows or t.n_cols is 0
|| // if x.n_elem is 0, x.n_rows or x.n_cols is 0
( (x.aux_row2 >= t.aux_row1) && (x.aux_row2 <= t.aux_row2) ) return false;
); }
else
const bool col_overlap = {
( // at this stage we have a guarantee that:
( (x.aux_col1 >= t.aux_col1) && (x.aux_col1 <= t.aux_col2) ) // t.n_rows > 0, t.n_cols > 0
|| // and
( (x.aux_col2 >= t.aux_col1) && (x.aux_col2 <= t.aux_col2) ) // x.n_rows > 0, x.n_cols > 0
);
const u32 t_aux_row1 = t.aux_row1;
const u32 t_aux_row2 = t_aux_row1 + t.n_rows - 1;
const u32 t_aux_col1 = t.aux_col1;
const u32 t_aux_col2 = t_aux_col1 + t.n_cols - 1;
const u32 x_aux_row1 = x.aux_row1;
const u32 x_aux_row2 = x_aux_row1 + x.n_rows - 1;
const u32 x_aux_col1 = x.aux_col1;
const u32 x_aux_col2 = x_aux_col1 + x.n_cols - 1;
const bool row_overlap =
(
( (x_aux_row1 >= t_aux_row1) && (x_aux_row1 <= t_aux_row2) )
||
( (x_aux_row2 >= t_aux_row1) && (x_aux_row2 <= t_aux_row2) )
);
const bool col_overlap =
(
( (x_aux_col1 >= t_aux_col1) && (x_aux_col1 <= t_aux_col2) )
||
( (x_aux_col2 >= t_aux_col1) && (x_aux_col2 <= t_aux_col2) )
);
const bool overlap = ( (row_overlap == true) && (col_overlap == true) ) ; const bool overlap = ( (row_overlap == true) && (col_overlap == true) );
return overlap; return overlap;
}
} }
} }
template<typename eT> template<typename eT>
inline inline
bool bool
subview<eT>::is_vec() const subview<eT>::is_vec() const
{ {
return ( (n_rows == 1) || (n_cols == 1) ); return ( (n_rows == 1) || (n_cols == 1) );
} }
skipping to change at line 1138 skipping to change at line 1160
} }
} }
// //
// //
// //
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT>::subview_col(const Mat<eT>& in_m, const u32 in_col) subview_col<eT>::subview_col(const Mat<eT>& in_m, const u32 in_col)
: subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) : subview<eT>(in_m, 0, in_col, in_m.n_rows, 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT>::subview_col(Mat<eT>& in_m, const u32 in_col) subview_col<eT>::subview_col(Mat<eT>& in_m, const u32 in_col)
: subview<eT>(in_m, 0, in_col, in_m.n_rows-1, in_col) : subview<eT>(in_m, 0, in_col, in_m.n_rows, 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT>::subview_col(const Mat<eT>& in_m, const u32 in_col, const u subview_col<eT>::subview_col(const Mat<eT>& in_m, const u32 in_col, const u
32 in_row1, const u32 in_row2) 32 in_row1, const u32 in_n_rows)
: subview<eT>(in_m, in_row1, in_col, in_row2, in_col) : subview<eT>(in_m, in_row1, in_col, in_n_rows, 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_col<eT>::subview_col(Mat<eT>& in_m, const u32 in_col, const u32 in_ subview_col<eT>::subview_col(Mat<eT>& in_m, const u32 in_col, const u32 in_
row1, const u32 in_row2) row1, const u32 in_n_rows)
: subview<eT>(in_m, in_row1, in_col, in_row2, in_col) : subview<eT>(in_m, in_row1, in_col, in_n_rows, 1)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
void void
subview_col<eT>::operator=(const subview<eT>& X) subview_col<eT>::operator=(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
skipping to change at line 1208 skipping to change at line 1230
arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" ); arma_debug_check( (subview<eT>::n_cols > 1), "subview_col(): incompatible dimensions" );
} }
// //
// //
// //
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT>::subview_row(const Mat<eT>& in_m, const u32 in_row) subview_row<eT>::subview_row(const Mat<eT>& in_m, const u32 in_row)
: subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) : subview<eT>(in_m, in_row, 0, 1, in_m.n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT>::subview_row(Mat<eT>& in_m, const u32 in_row) subview_row<eT>::subview_row(Mat<eT>& in_m, const u32 in_row)
: subview<eT>(in_m, in_row, 0, in_row, in_m.n_cols-1) : subview<eT>(in_m, in_row, 0, 1, in_m.n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT>::subview_row(const Mat<eT>& in_m, const u32 in_row, const u subview_row<eT>::subview_row(const Mat<eT>& in_m, const u32 in_row, const u
32 in_col1, const u32 in_col2) 32 in_col1, const u32 in_n_cols)
: subview<eT>(in_m, in_row, in_col1, in_row, in_col2) : subview<eT>(in_m, in_row, in_col1, 1, in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
arma_inline arma_inline
subview_row<eT>::subview_row(Mat<eT>& in_m, const u32 in_row, const u32 in_ subview_row<eT>::subview_row(Mat<eT>& in_m, const u32 in_row, const u32 in_
col1, const u32 in_col2) col1, const u32 in_n_cols)
: subview<eT>(in_m, in_row, in_col1, in_row, in_col2) : subview<eT>(in_m, in_row, in_col1, 1, in_n_cols)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
} }
template<typename eT> template<typename eT>
inline inline
void void
subview_row<eT>::operator=(const subview<eT>& X) subview_row<eT>::operator=(const subview<eT>& X)
{ {
arma_extra_debug_sigprint(); arma_extra_debug_sigprint();
 End of changes. 21 change blocks. 
50 lines changed or deleted 72 lines changed or added


 subview_proto.hpp   subview_proto.hpp 
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-2010 Conrad Sanderson // Copyright (C) 2008-2011 Conrad Sanderson
// //
// This file is part of the Armadillo C++ library. // This file is part of the Armadillo C++ library.
// It is provided without any warranty of fitness // It is provided without any warranty of fitness
// for any purpose. You can redistribute this file // for any purpose. You can redistribute this file
// and/or modify it under the terms of the GNU // and/or modify it under the terms of the GNU
// Lesser General Public License (LGPL) as published // Lesser General Public License (LGPL) as published
// by the Free Software Foundation, either version 3 // by the Free Software Foundation, either version 3
// of the License or (at your option) any later version. // of the License or (at your option) any later version.
// (see http://www.opensource.org/licenses for more info) // (see http://www.opensource.org/licenses for more info)
skipping to change at line 32 skipping to change at line 32
protected: arma_aligned Mat<eT>* m_ptr; protected: arma_aligned Mat<eT>* m_ptr;
public: public:
typedef eT elem_type; typedef eT elem_type;
typedef typename get_pod_type<elem_type>::result pod_type; typedef typename get_pod_type<elem_type>::result pod_type;
const u32 aux_row1; const u32 aux_row1;
const u32 aux_col1; const u32 aux_col1;
const u32 aux_row2;
const u32 aux_col2;
const u32 n_rows; const u32 n_rows;
const u32 n_cols; const u32 n_cols;
const u32 n_elem; const u32 n_elem;
protected: protected:
arma_inline subview(const Mat<eT>& in_m, const u32 in_row1, const u32 in_ arma_inline subview(const Mat<eT>& in_m, const u32 in_row1, const u32 in_
col1, const u32 in_row2, const u32 in_col2); col1, const u32 in_n_rows, const u32 in_n_cols);
arma_inline subview( Mat<eT>& in_m, const u32 in_row1, const u32 in_ arma_inline subview( Mat<eT>& in_m, const u32 in_row1, const u32 in_
col1, const u32 in_row2, const u32 in_col2); col1, const u32 in_n_rows, const u32 in_n_cols);
public: public:
inline ~subview(); inline ~subview();
inline void operator+= (const eT val); inline void operator+= (const eT val);
inline void operator-= (const eT val); inline void operator-= (const eT val);
inline void operator*= (const eT val); inline void operator*= (const eT val);
inline void operator/= (const eT val); inline void operator/= (const eT val);
skipping to change at line 120 skipping to change at line 117
inline void operator= (const subview_col& x); inline void operator= (const subview_col& x);
template<typename T1> template<typename T1>
inline void operator= (const Base<eT,T1>& x); inline void operator= (const Base<eT,T1>& x);
protected: protected:
arma_inline subview_col(const Mat<eT>& in_m, const u32 in_col); arma_inline subview_col(const Mat<eT>& in_m, const u32 in_col);
arma_inline subview_col( Mat<eT>& in_m, const u32 in_col); arma_inline subview_col( Mat<eT>& in_m, const u32 in_col);
arma_inline subview_col(const Mat<eT>& in_m, const u32 in_col, const u32 arma_inline subview_col(const Mat<eT>& in_m, const u32 in_col, const u32
in_row1, const u32 in_row2); in_row1, const u32 in_n_rows);
arma_inline subview_col( Mat<eT>& in_m, const u32 in_col, const u32 arma_inline subview_col( Mat<eT>& in_m, const u32 in_col, const u32
in_row1, const u32 in_row2); in_row1, const u32 in_n_rows);
private: private:
friend class Mat<eT>; friend class Mat<eT>;
friend class Col<eT>; friend class Col<eT>;
subview_col(); subview_col();
}; };
template<typename eT> template<typename eT>
skipping to change at line 150 skipping to change at line 147
inline void operator= (const subview_row& x); inline void operator= (const subview_row& x);
template<typename T1> template<typename T1>
inline void operator= (const Base<eT,T1>& x); inline void operator= (const Base<eT,T1>& x);
protected: protected:
arma_inline subview_row(const Mat<eT>& in_m, const u32 in_row); arma_inline subview_row(const Mat<eT>& in_m, const u32 in_row);
arma_inline subview_row( Mat<eT>& in_m, const u32 in_row); arma_inline subview_row( Mat<eT>& in_m, const u32 in_row);
arma_inline subview_row(const Mat<eT>& in_m, const u32 in_row, const u32 arma_inline subview_row(const Mat<eT>& in_m, const u32 in_row, const u32
in_col1, const u32 in_col2); in_col1, const u32 in_n_cols);
arma_inline subview_row( Mat<eT>& in_m, const u32 in_row, const u32 arma_inline subview_row( Mat<eT>& in_m, const u32 in_row, const u32
in_col1, const u32 in_col2); in_col1, const u32 in_n_cols);
private: private:
friend class Mat<eT>; friend class Mat<eT>;
friend class Row<eT>; friend class Row<eT>;
subview_row(); subview_row();
}; };
//! @} //! @}
 End of changes. 5 change blocks. 
17 lines changed or deleted 14 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/