| SpCol_meat.hpp | | SpCol_meat.hpp | |
| // Copyright (C) 2011-2012 Ryan Curtin | | // Copyright (C) 2011-2012 Ryan Curtin | |
|
| | | // Copyright (C) 2015 Conrad Sanderson | |
| // Copyright (C) 2011 Matthew Amidon | | // Copyright (C) 2011 Matthew Amidon | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup SpCol | | //! \addtogroup SpCol | |
| //! @{ | | //! @{ | |
| | | | |
| //! construct an empty column vector | | //! construct an empty column vector | |
| | | | |
| skipping to change at line 181 | | skipping to change at line 182 | |
| const SpBase<typename SpCol<eT>::pod_type, T2>& B | | const SpBase<typename SpCol<eT>::pod_type, T2>& B | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| access::rw(SpMat<eT>::vec_state) = 1; | | access::rw(SpMat<eT>::vec_state) = 1; | |
| | | | |
| SpMat<eT>::init(A,B); | | SpMat<eT>::init(A,B); | |
| } | | } | |
| | | | |
|
| template<typename eT> | | | |
| inline | | | |
| SpValProxy< SpMat<eT> > | | | |
| SpCol<eT>::row(const uword row_num) | | | |
| { | | | |
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b | | | |
| ounds" ); | | | |
| | | | |
| return SpMat<eT>::at(row_num, 0); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| eT | | | |
| SpCol<eT>::row(const uword row_num) const | | | |
| { | | | |
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::row(): out of b | | | |
| ounds" ); | | | |
| | | | |
| return SpMat<eT>::at(row_num, 0); | | | |
| } | | | |
| | | | |
| /* | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_col<eT> | | | |
| SpCol<eT>::rows(const uword in_row1, const uword in_row2) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows) | | | |
| ), "Col::rows(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_col<eT> | | | |
| SpCol<eT>::rows(const uword in_row1, const uword in_row2) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows) | | | |
| ), "Col::rows(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_col<eT> | | | |
| SpCol<eT>::subvec(const uword in_row1, const uword in_row2) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows) | | | |
| ), "Col::subvec(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_col<eT> | | | |
| SpCol<eT>::subvec(const uword in_row1, const uword in_row2) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_row1 > in_row2) || (in_row2 >= SpMat<eT>::n_rows) | | | |
| ), "Col::subvec(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_rows = in_row2 - in_row1 + 1; | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subview_n_rows); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_col<eT> | | | |
| SpCol<eT>::subvec(const span& row_span) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const bool row_all = row_span.whole; | | | |
| | | | |
| const uword local_n_rows = SpMat<eT>::n_rows; | | | |
| | | | |
| const uword in_row1 = row_all ? 0 : row_span.a; | | | |
| const uword in_row2 = row_span.b; | | | |
| const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + | | | |
| 1; | | | |
| | | | |
| arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= | | | |
| local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly use | | | |
| d"); | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subvec_n_rows); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_col<eT> | | | |
| SpCol<eT>::subvec(const span& row_span) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const bool row_all = row_span.whole; | | | |
| | | | |
| const uword local_n_rows = SpMat<eT>::n_rows; | | | |
| | | | |
| const uword in_row1 = row_all ? 0 : row_span.a; | | | |
| const uword in_row2 = row_span.b; | | | |
| const uword subvec_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + | | | |
| 1; | | | |
| | | | |
| arma_debug_check( ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= | | | |
| local_n_rows)) ), "Col::subvec(): indices out of bounds or incorrectly use | | | |
| d"); | | | |
| | | | |
| return subview_col<eT>(*this, 0, in_row1, subvec_n_rows); | | | |
| } | | | |
| */ | | | |
| | | | |
| //! remove specified row | | //! remove specified row | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| SpCol<eT>::shed_row(const uword row_num) | | SpCol<eT>::shed_row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out o
f bounds"); | | arma_debug_check( row_num >= SpMat<eT>::n_rows, "SpCol::shed_row(): out o
f bounds"); | |
| | | | |
| | | | |
| skipping to change at line 389 | | skipping to change at line 272 | |
| | | | |
| access::rw(SpMat<eT>::values) = new_values; | | access::rw(SpMat<eT>::values) = new_values; | |
| access::rw(SpMat<eT>::row_indices) = new_row_indices; | | access::rw(SpMat<eT>::row_indices) = new_row_indices; | |
| | | | |
| access::rw(SpMat<eT>::n_nonzero) -= elem_diff; | | access::rw(SpMat<eT>::n_nonzero) -= elem_diff; | |
| access::rw(SpMat<eT>::col_ptrs[1]) -= elem_diff; | | access::rw(SpMat<eT>::col_ptrs[1]) -= elem_diff; | |
| } | | } | |
| | | | |
| access::rw(SpMat<eT>::n_rows) -= diff; | | access::rw(SpMat<eT>::n_rows) -= diff; | |
| access::rw(SpMat<eT>::n_elem) -= diff; | | access::rw(SpMat<eT>::n_elem) -= diff; | |
|
| | | | |
| } | | } | |
| | | | |
| // //! insert N rows at the specified row position, | | // //! insert N rows at the specified row position, | |
| // //! optionally setting the elements of the inserted rows to zero | | // //! optionally setting the elements of the inserted rows to zero | |
| // template<typename eT> | | // template<typename eT> | |
| // inline | | // inline | |
| // void | | // void | |
| // SpCol<eT>::insert_rows(const uword row_num, const uword N, const bool se
t_to_zero) | | // SpCol<eT>::insert_rows(const uword row_num, const uword N, const bool se
t_to_zero) | |
| // { | | // { | |
| // arma_extra_debug_sigprint(); | | // arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 416 | | skipping to change at line 298 | |
| // { | | // { | |
| // if (SpMat<eT>::row_indices[row] >= row_num) | | // if (SpMat<eT>::row_indices[row] >= row_num) | |
| // { | | // { | |
| // access::rw(SpMat<eT>::row_indices[row]) += N; | | // access::rw(SpMat<eT>::row_indices[row]) += N; | |
| // } | | // } | |
| // } | | // } | |
| // | | // | |
| // access::rw(SpMat<eT>::n_rows) += N; | | // access::rw(SpMat<eT>::n_rows) += N; | |
| // access::rw(SpMat<eT>::n_elem) += N; | | // access::rw(SpMat<eT>::n_elem) += N; | |
| // } | | // } | |
|
| // | | | |
| // | | | |
| // | | | |
| // //! insert the given object at the specified row position; | | | |
| // //! the given object must have one column | | | |
| // template<typename eT> | | | |
| // template<typename T1> | | | |
| // inline | | | |
| // void | | | |
| // SpCol<eT>::insert_rows(const uword row_num, const Base<eT,T1>& X) | | | |
| // { | | | |
| // arma_extra_debug_sigprint(); | | | |
| // | | | |
| // SpMat<eT>::insert_rows(row_num, X); | | | |
| // } | | | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpCol<eT>::row_iterator | | typename SpCol<eT>::row_iterator | |
| SpCol<eT>::begin_row(const uword row_num) | | SpCol<eT>::begin_row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "begin_row(): index out
of bounds"); | | arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): in
dex out of bounds"); | |
| | | | |
| return row_iterator(*this, row_num, 0); | | return row_iterator(*this, row_num, 0); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpCol<eT>::const_row_iterator | | typename SpCol<eT>::const_row_iterator | |
| SpCol<eT>::begin_row(const uword row_num) const | | SpCol<eT>::begin_row(const uword row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "begin_row(): index out
of bounds"); | | arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::begin_row(): in
dex out of bounds"); | |
| | | | |
| return const_row_iterator(*this, row_num, 0); | | return const_row_iterator(*this, row_num, 0); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpCol<eT>::row_iterator | | typename SpCol<eT>::row_iterator | |
| SpCol<eT>::end_row(const uword row_num) | | SpCol<eT>::end_row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "end_row(): index out o
f bounds"); | | arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): inde
x out of bounds"); | |
| | | | |
| return row_iterator(*this, row_num + 1, 0); | | return row_iterator(*this, row_num + 1, 0); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpCol<eT>::const_row_iterator | | typename SpCol<eT>::const_row_iterator | |
| SpCol<eT>::end_row(const uword row_num) const | | SpCol<eT>::end_row(const uword row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| arma_debug_check( (row_num >= SpMat<eT>::n_rows), "end_row(): index out o
f bounds"); | | arma_debug_check( (row_num >= SpMat<eT>::n_rows), "SpCol::end_row(): inde
x out of bounds"); | |
| | | | |
| return const_row_iterator(*this, row_num + 1, 0); | | return const_row_iterator(*this, row_num + 1, 0); | |
| } | | } | |
| | | | |
| #ifdef ARMA_EXTRA_SPCOL_MEAT | | #ifdef ARMA_EXTRA_SPCOL_MEAT | |
| #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPCOL_MEAT) | | #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPCOL_MEAT) | |
| #endif | | #endif | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 8 change blocks. |
| 150 lines changed or deleted | | 5 lines changed or added | |
|
| SpRow_meat.hpp | | SpRow_meat.hpp | |
| // Copyright (C) 2011-2012 Ryan Curtin | | // Copyright (C) 2011-2012 Ryan Curtin | |
|
| | | // Copyright (C) 2015 Conrad Sanderson | |
| // Copyright (C) 2011 Matthew Amidon | | // Copyright (C) 2011 Matthew Amidon | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup SpRow | | //! \addtogroup SpRow | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 172 | |
| const SpBase<typename SpRow<eT>::pod_type, T2>& B | | const SpBase<typename SpRow<eT>::pod_type, T2>& B | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| access::rw(SpMat<eT>::vec_state) = 2; | | access::rw(SpMat<eT>::vec_state) = 2; | |
| | | | |
| SpMat<eT>::init(A,B); | | SpMat<eT>::init(A,B); | |
| } | | } | |
| | | | |
|
| template<typename eT> | | | |
| inline | | | |
| SpValProxy< SpMat<eT> > | | | |
| SpRow<eT>::col(const uword col_num) | | | |
| { | | | |
| arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b | | | |
| ounds" ); | | | |
| | | | |
| return SpMat<eT>::at(0, col_num); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| eT | | | |
| SpRow<eT>::col(const uword col_num) const | | | |
| { | | | |
| arma_debug_check( (col_num >= SpMat<eT>::n_cols), "SpRow::col(): out of b | | | |
| ounds" ); | | | |
| | | | |
| return SpMat<eT>::at(0, col_num); | | | |
| } | | | |
| | | | |
| /* | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_row<eT> | | | |
| SpRow<eT>::cols(const uword in_col1, const uword in_col2) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) | | | |
| , "SpRow::cols(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_row<eT> | | | |
| SpRow<eT>::cols(const uword in_col1, const uword in_col2) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) | | | |
| , "SpRow::cols(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_row<eT> | | | |
| SpRow<eT>::subvec(const uword in_col1, const uword in_col2) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) | | | |
| , "SpRow::subvec(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_row<eT> | | | |
| SpRow<eT>::subvec(const uword in_col1, const uword in_col2) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| arma_debug_check( ( (in_col1 > in_col2) || (in_col2 >= Mat<eT>::n_cols) ) | | | |
| , "SpRow::subvec(): indices out of bounds or incorrectly used"); | | | |
| | | | |
| const uword subview_n_cols = in_col2 - in_col1 + 1; | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subview_n_cols); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| subview_row<eT> | | | |
| SpRow<eT>::subvec(const span& col_span) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const bool col_all = col_span.whole; | | | |
| | | | |
| const uword local_n_cols = Mat<eT>::n_cols; | | | |
| | | | |
| const uword in_col1 = col_all ? 0 : col_span.a; | | | |
| const uword in_col2 = col_span.b; | | | |
| const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + | | | |
| 1; | | | |
| | | | |
| arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= | | | |
| local_n_cols)) ), "SpRow::subvec(): indices out of bounds or incorrectly u | | | |
| sed"); | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| const subview_row<eT> | | | |
| SpRow<eT>::subvec(const span& col_span) const | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| | | | |
| const bool col_all = col_span.whole; | | | |
| | | | |
| const uword local_n_cols = Mat<eT>::n_cols; | | | |
| | | | |
| const uword in_col1 = col_all ? 0 : col_span.a; | | | |
| const uword in_col2 = col_span.b; | | | |
| const uword subvec_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + | | | |
| 1; | | | |
| | | | |
| arma_debug_check( ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= | | | |
| local_n_cols)) ), "SpRow::subvec(): indices out of bounds or incorrectly u | | | |
| sed"); | | | |
| | | | |
| return subview_row<eT>(*this, 0, in_col1, subvec_n_cols); | | | |
| } | | | |
| */ | | | |
| | | | |
| // template<typename eT> | | | |
| // arma_inline | | | |
| // subview_row<eT> | | | |
| // SpRow<eT>::operator()(const span& col_span) | | | |
| // { | | | |
| // arma_extra_debug_sigprint(); | | | |
| // | | | |
| // return subvec(col_span); | | | |
| // } | | | |
| // | | | |
| // | | | |
| // | | | |
| // template<typename eT> | | | |
| // arma_inline | | | |
| // const subview_row<eT> | | | |
| // SpRow<eT>::operator()(const span& col_span) const | | | |
| // { | | | |
| // arma_extra_debug_sigprint(); | | | |
| // | | | |
| // return subvec(col_span); | | | |
| // } | | | |
| | | | |
| //! remove specified columns | | //! remove specified columns | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| SpRow<eT>::shed_col(const uword col_num) | | SpRow<eT>::shed_col(const uword col_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out o
f bounds"); | | arma_debug_check( col_num >= SpMat<eT>::n_cols, "SpRow::shed_col(): out o
f bounds"); | |
| | | | |
| | | | |
| skipping to change at line 427 | | skipping to change at line 288 | |
| // arrayops::copy(new_col_ptrs, SpMat<eT>::col_ptrs, col_num); | | // arrayops::copy(new_col_ptrs, SpMat<eT>::col_ptrs, col_num); | |
| // | | // | |
| // uword fill_value = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num -
1]; | | // uword fill_value = (col_num == 0) ? 0 : SpMat<eT>::col_ptrs[col_num -
1]; | |
| // arrayops::inplace_set(new_col_ptrs + col_num, fill_value, N); | | // arrayops::inplace_set(new_col_ptrs + col_num, fill_value, N); | |
| // | | // | |
| // arrayops::copy(new_col_ptrs + col_num + N, SpMat<eT>::col_ptrs + col_n
um, SpMat<eT>::n_cols - col_num); | | // arrayops::copy(new_col_ptrs + col_num + N, SpMat<eT>::col_ptrs + col_n
um, SpMat<eT>::n_cols - col_num); | |
| // | | // | |
| // access::rw(SpMat<eT>::n_cols) += N; | | // access::rw(SpMat<eT>::n_cols) += N; | |
| // access::rw(SpMat<eT>::n_elem) += N; | | // access::rw(SpMat<eT>::n_elem) += N; | |
| // } | | // } | |
|
| // | | | |
| // | | | |
| // | | | |
| // //! insert the given object at the specified col position; | | | |
| // //! the given object must have one row | | | |
| // template<typename eT> | | | |
| // template<typename T1> | | | |
| // inline | | | |
| // void | | | |
| // SpRow<eT>::insert_cols(const uword col_num, const Base<eT,T1>& X) | | | |
| // { | | | |
| // arma_extra_debug_sigprint(); | | | |
| // | | | |
| // SpMat<eT>::insert_cols(col_num, X); | | | |
| // } | | | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpRow<eT>::row_iterator | | typename SpRow<eT>::row_iterator | |
| SpRow<eT>::begin_row(const uword row_num) | | SpRow<eT>::begin_row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| // Since this is a row, row_num can only be 0. But the option is provide
d for | | // Since this is a row, row_num can only be 0. But the option is provide
d for | |
| // compatibility. | | // compatibility. | |
|
| arma_debug_check((row_num >= 1), "SpRow::row(): invalid row index"); | | arma_debug_check((row_num >= 1), "SpRow::begin_row(): index out of bounds
"); | |
| | | | |
| return SpMat<eT>::begin(); | | return SpMat<eT>::begin(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpRow<eT>::const_row_iterator | | typename SpRow<eT>::const_row_iterator | |
| SpRow<eT>::begin_row(const uword row_num) const | | SpRow<eT>::begin_row(const uword row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| // Since this is a row, row_num can only be 0. But the option is provide
d for | | // Since this is a row, row_num can only be 0. But the option is provide
d for | |
| // compatibility. | | // compatibility. | |
|
| arma_debug_check((row_num >= 1), "SpRow::row(): invalid row index"); | | arma_debug_check((row_num >= 1), "SpRow::begin_row(): index out of bounds
"); | |
| | | | |
| return SpMat<eT>::begin(); | | return SpMat<eT>::begin(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpRow<eT>::row_iterator | | typename SpRow<eT>::row_iterator | |
| SpRow<eT>::end_row(const uword row_num) | | SpRow<eT>::end_row(const uword row_num) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| // Since this is a row, row_num can only be 0. But the option is provide
d for | | // Since this is a row, row_num can only be 0. But the option is provide
d for | |
| // compatibility. | | // compatibility. | |
|
| arma_debug_check((row_num >= 1), "SpRow::row(): invalid row index"); | | arma_debug_check((row_num >= 1), "SpRow::end_row(): index out of bounds")
; | |
| | | | |
| return SpMat<eT>::end(); | | return SpMat<eT>::end(); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename SpRow<eT>::const_row_iterator | | typename SpRow<eT>::const_row_iterator | |
| SpRow<eT>::end_row(const uword row_num) const | | SpRow<eT>::end_row(const uword row_num) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| // Since this is a row, row_num can only be 0. But the option is provide
d for | | // Since this is a row, row_num can only be 0. But the option is provide
d for | |
| // compatibility. | | // compatibility. | |
|
| arma_debug_check((row_num >= 1), "SpRow::row(): invalid row index"); | | arma_debug_check((row_num >= 1), "SpRow::end_row(): index out of bounds")
; | |
| | | | |
| return SpMat<eT>::end(); | | return SpMat<eT>::end(); | |
| } | | } | |
| | | | |
| #ifdef ARMA_EXTRA_SPROW_MEAT | | #ifdef ARMA_EXTRA_SPROW_MEAT | |
| #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPROW_MEAT) | | #include ARMA_INCFILE_WRAP(ARMA_EXTRA_SPROW_MEAT) | |
| #endif | | #endif | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 7 change blocks. |
| 171 lines changed or deleted | | 5 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| #include <vector> | | #include <vector> | |
| | | | |
| #if ( defined(__unix__) || defined(__unix) || defined(_POSIX_C_SOURCE) || (
defined(__APPLE__) && defined(__MACH__)) ) && !defined(_WIN32) | | #if ( defined(__unix__) || defined(__unix) || defined(_POSIX_C_SOURCE) || (
defined(__APPLE__) && defined(__MACH__)) ) && !defined(_WIN32) | |
| #include <unistd.h> | | #include <unistd.h> | |
| #endif | | #endif | |
| | | | |
| #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | | #if (defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)) | |
| #include <sys/time.h> | | #include <sys/time.h> | |
| #endif | | #endif | |
| | | | |
|
| | | #if (__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__) | |
| | | #undef ARMA_USE_CXX11 | |
| | | #define ARMA_USE_CXX11 | |
| | | #endif | |
| | | | |
| #include "armadillo_bits/config.hpp" | | #include "armadillo_bits/config.hpp" | |
| #include "armadillo_bits/compiler_setup.hpp" | | #include "armadillo_bits/compiler_setup.hpp" | |
| | | | |
| #if defined(ARMA_USE_CXX11) | | #if defined(ARMA_USE_CXX11) | |
| #include <initializer_list> | | #include <initializer_list> | |
| #include <cstdint> | | #include <cstdint> | |
| #include <random> | | #include <random> | |
| #if !defined(ARMA_DONT_USE_CXX11_CHRONO) | | #if !defined(ARMA_DONT_USE_CXX11_CHRONO) | |
| #include <chrono> | | #include <chrono> | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 70 | |
| | | | |
| #if !defined(ARMA_USE_CXX11) | | #if !defined(ARMA_USE_CXX11) | |
| #if defined(ARMA_HAVE_TR1) | | #if defined(ARMA_HAVE_TR1) | |
| #include <tr1/cmath> | | #include <tr1/cmath> | |
| #include <tr1/complex> | | #include <tr1/complex> | |
| #endif | | #endif | |
| #endif | | #endif | |
| | | | |
| #include "armadillo_bits/include_atlas.hpp" | | #include "armadillo_bits/include_atlas.hpp" | |
| #include "armadillo_bits/include_hdf5.hpp" | | #include "armadillo_bits/include_hdf5.hpp" | |
|
| | | #include "armadillo_bits/include_superlu.hpp" | |
| | | | |
| #if defined(_OPENMP) | | #if defined(_OPENMP) | |
| #include <omp.h> | | #include <omp.h> | |
| #endif | | #endif | |
| | | | |
| //! \namespace arma namespace for Armadillo classes and functions | | //! \namespace arma namespace for Armadillo classes and functions | |
| namespace arma | | namespace arma | |
| { | | { | |
| | | | |
| // preliminaries | | // preliminaries | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 120 | |
| // class prototypes | | // class prototypes | |
| | | | |
| #include "armadillo_bits/Base_bones.hpp" | | #include "armadillo_bits/Base_bones.hpp" | |
| #include "armadillo_bits/BaseCube_bones.hpp" | | #include "armadillo_bits/BaseCube_bones.hpp" | |
| #include "armadillo_bits/SpBase_bones.hpp" | | #include "armadillo_bits/SpBase_bones.hpp" | |
| | | | |
| #include "armadillo_bits/blas_bones.hpp" | | #include "armadillo_bits/blas_bones.hpp" | |
| #include "armadillo_bits/lapack_bones.hpp" | | #include "armadillo_bits/lapack_bones.hpp" | |
| #include "armadillo_bits/atlas_bones.hpp" | | #include "armadillo_bits/atlas_bones.hpp" | |
| #include "armadillo_bits/arpack_bones.hpp" | | #include "armadillo_bits/arpack_bones.hpp" | |
|
| | | #include "armadillo_bits/superlu_bones.hpp" | |
| #include "armadillo_bits/hdf5_bones.hpp" | | #include "armadillo_bits/hdf5_bones.hpp" | |
| | | | |
| #include "armadillo_bits/blas_wrapper.hpp" | | #include "armadillo_bits/blas_wrapper.hpp" | |
| #include "armadillo_bits/lapack_wrapper.hpp" | | #include "armadillo_bits/lapack_wrapper.hpp" | |
| #include "armadillo_bits/atlas_wrapper.hpp" | | #include "armadillo_bits/atlas_wrapper.hpp" | |
| #include "armadillo_bits/arpack_wrapper.hpp" | | #include "armadillo_bits/arpack_wrapper.hpp" | |
|
| | | #include "armadillo_bits/superlu_wrapper.hpp" | |
| | | | |
| #include "armadillo_bits/cond_rel_bones.hpp" | | #include "armadillo_bits/cond_rel_bones.hpp" | |
| #include "armadillo_bits/arrayops_bones.hpp" | | #include "armadillo_bits/arrayops_bones.hpp" | |
| #include "armadillo_bits/podarray_bones.hpp" | | #include "armadillo_bits/podarray_bones.hpp" | |
| #include "armadillo_bits/auxlib_bones.hpp" | | #include "armadillo_bits/auxlib_bones.hpp" | |
| #include "armadillo_bits/sp_auxlib_bones.hpp" | | #include "armadillo_bits/sp_auxlib_bones.hpp" | |
| | | | |
| #include "armadillo_bits/injector_bones.hpp" | | #include "armadillo_bits/injector_bones.hpp" | |
| | | | |
| #include "armadillo_bits/Mat_bones.hpp" | | #include "armadillo_bits/Mat_bones.hpp" | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 151 | |
| #include "armadillo_bits/xvec_htrans_bones.hpp" | | #include "armadillo_bits/xvec_htrans_bones.hpp" | |
| #include "armadillo_bits/xtrans_mat_bones.hpp" | | #include "armadillo_bits/xtrans_mat_bones.hpp" | |
| #include "armadillo_bits/SizeMat_bones.hpp" | | #include "armadillo_bits/SizeMat_bones.hpp" | |
| #include "armadillo_bits/SizeCube_bones.hpp" | | #include "armadillo_bits/SizeCube_bones.hpp" | |
| | | | |
| #include "armadillo_bits/SpValProxy_bones.hpp" | | #include "armadillo_bits/SpValProxy_bones.hpp" | |
| #include "armadillo_bits/SpMat_bones.hpp" | | #include "armadillo_bits/SpMat_bones.hpp" | |
| #include "armadillo_bits/SpCol_bones.hpp" | | #include "armadillo_bits/SpCol_bones.hpp" | |
| #include "armadillo_bits/SpRow_bones.hpp" | | #include "armadillo_bits/SpRow_bones.hpp" | |
| #include "armadillo_bits/SpSubview_bones.hpp" | | #include "armadillo_bits/SpSubview_bones.hpp" | |
|
| | | #include "armadillo_bits/spdiagview_bones.hpp" | |
| | | | |
| #include "armadillo_bits/typedef_mat_fixed.hpp" | | #include "armadillo_bits/typedef_mat_fixed.hpp" | |
| | | | |
| #include "armadillo_bits/field_bones.hpp" | | #include "armadillo_bits/field_bones.hpp" | |
| #include "armadillo_bits/subview_bones.hpp" | | #include "armadillo_bits/subview_bones.hpp" | |
| #include "armadillo_bits/subview_elem1_bones.hpp" | | #include "armadillo_bits/subview_elem1_bones.hpp" | |
| #include "armadillo_bits/subview_elem2_bones.hpp" | | #include "armadillo_bits/subview_elem2_bones.hpp" | |
| #include "armadillo_bits/subview_field_bones.hpp" | | #include "armadillo_bits/subview_field_bones.hpp" | |
| #include "armadillo_bits/subview_cube_bones.hpp" | | #include "armadillo_bits/subview_cube_bones.hpp" | |
| #include "armadillo_bits/diagview_bones.hpp" | | #include "armadillo_bits/diagview_bones.hpp" | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 205 | |
| #include "armadillo_bits/op_diagmat_bones.hpp" | | #include "armadillo_bits/op_diagmat_bones.hpp" | |
| #include "armadillo_bits/op_diagvec_bones.hpp" | | #include "armadillo_bits/op_diagvec_bones.hpp" | |
| #include "armadillo_bits/op_dot_bones.hpp" | | #include "armadillo_bits/op_dot_bones.hpp" | |
| #include "armadillo_bits/op_inv_bones.hpp" | | #include "armadillo_bits/op_inv_bones.hpp" | |
| #include "armadillo_bits/op_htrans_bones.hpp" | | #include "armadillo_bits/op_htrans_bones.hpp" | |
| #include "armadillo_bits/op_max_bones.hpp" | | #include "armadillo_bits/op_max_bones.hpp" | |
| #include "armadillo_bits/op_min_bones.hpp" | | #include "armadillo_bits/op_min_bones.hpp" | |
| #include "armadillo_bits/op_mean_bones.hpp" | | #include "armadillo_bits/op_mean_bones.hpp" | |
| #include "armadillo_bits/op_median_bones.hpp" | | #include "armadillo_bits/op_median_bones.hpp" | |
| #include "armadillo_bits/op_sort_bones.hpp" | | #include "armadillo_bits/op_sort_bones.hpp" | |
|
| | | #include "armadillo_bits/op_sort_index_bones.hpp" | |
| #include "armadillo_bits/op_sum_bones.hpp" | | #include "armadillo_bits/op_sum_bones.hpp" | |
| #include "armadillo_bits/op_stddev_bones.hpp" | | #include "armadillo_bits/op_stddev_bones.hpp" | |
| #include "armadillo_bits/op_strans_bones.hpp" | | #include "armadillo_bits/op_strans_bones.hpp" | |
| #include "armadillo_bits/op_var_bones.hpp" | | #include "armadillo_bits/op_var_bones.hpp" | |
| #include "armadillo_bits/op_repmat_bones.hpp" | | #include "armadillo_bits/op_repmat_bones.hpp" | |
| #include "armadillo_bits/op_reshape_bones.hpp" | | #include "armadillo_bits/op_reshape_bones.hpp" | |
| #include "armadillo_bits/op_vectorise_bones.hpp" | | #include "armadillo_bits/op_vectorise_bones.hpp" | |
| #include "armadillo_bits/op_resize_bones.hpp" | | #include "armadillo_bits/op_resize_bones.hpp" | |
| #include "armadillo_bits/op_cov_bones.hpp" | | #include "armadillo_bits/op_cov_bones.hpp" | |
| #include "armadillo_bits/op_cor_bones.hpp" | | #include "armadillo_bits/op_cor_bones.hpp" | |
| | | | |
| skipping to change at line 229 | | skipping to change at line 239 | |
| #include "armadillo_bits/op_symmat_bones.hpp" | | #include "armadillo_bits/op_symmat_bones.hpp" | |
| #include "armadillo_bits/op_hist_bones.hpp" | | #include "armadillo_bits/op_hist_bones.hpp" | |
| #include "armadillo_bits/op_unique_bones.hpp" | | #include "armadillo_bits/op_unique_bones.hpp" | |
| #include "armadillo_bits/op_toeplitz_bones.hpp" | | #include "armadillo_bits/op_toeplitz_bones.hpp" | |
| #include "armadillo_bits/op_fft_bones.hpp" | | #include "armadillo_bits/op_fft_bones.hpp" | |
| #include "armadillo_bits/op_any_bones.hpp" | | #include "armadillo_bits/op_any_bones.hpp" | |
| #include "armadillo_bits/op_all_bones.hpp" | | #include "armadillo_bits/op_all_bones.hpp" | |
| #include "armadillo_bits/op_normalise_bones.hpp" | | #include "armadillo_bits/op_normalise_bones.hpp" | |
| #include "armadillo_bits/op_clamp_bones.hpp" | | #include "armadillo_bits/op_clamp_bones.hpp" | |
| #include "armadillo_bits/op_expmat_bones.hpp" | | #include "armadillo_bits/op_expmat_bones.hpp" | |
|
| | | #include "armadillo_bits/op_nonzeros_bones.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_bones.hpp" | | #include "armadillo_bits/glue_times_bones.hpp" | |
| #include "armadillo_bits/glue_mixed_bones.hpp" | | #include "armadillo_bits/glue_mixed_bones.hpp" | |
| #include "armadillo_bits/glue_cov_bones.hpp" | | #include "armadillo_bits/glue_cov_bones.hpp" | |
| #include "armadillo_bits/glue_cor_bones.hpp" | | #include "armadillo_bits/glue_cor_bones.hpp" | |
| #include "armadillo_bits/glue_kron_bones.hpp" | | #include "armadillo_bits/glue_kron_bones.hpp" | |
| #include "armadillo_bits/glue_cross_bones.hpp" | | #include "armadillo_bits/glue_cross_bones.hpp" | |
| #include "armadillo_bits/glue_join_bones.hpp" | | #include "armadillo_bits/glue_join_bones.hpp" | |
| #include "armadillo_bits/glue_relational_bones.hpp" | | #include "armadillo_bits/glue_relational_bones.hpp" | |
| #include "armadillo_bits/glue_solve_bones.hpp" | | #include "armadillo_bits/glue_solve_bones.hpp" | |
| | | | |
| skipping to change at line 258 | | skipping to change at line 269 | |
| #include "armadillo_bits/spop_sum_bones.hpp" | | #include "armadillo_bits/spop_sum_bones.hpp" | |
| #include "armadillo_bits/spop_strans_bones.hpp" | | #include "armadillo_bits/spop_strans_bones.hpp" | |
| #include "armadillo_bits/spop_htrans_bones.hpp" | | #include "armadillo_bits/spop_htrans_bones.hpp" | |
| #include "armadillo_bits/spop_misc_bones.hpp" | | #include "armadillo_bits/spop_misc_bones.hpp" | |
| #include "armadillo_bits/spop_mean_bones.hpp" | | #include "armadillo_bits/spop_mean_bones.hpp" | |
| #include "armadillo_bits/spop_var_bones.hpp" | | #include "armadillo_bits/spop_var_bones.hpp" | |
| | | | |
| #include "armadillo_bits/spglue_plus_bones.hpp" | | #include "armadillo_bits/spglue_plus_bones.hpp" | |
| #include "armadillo_bits/spglue_minus_bones.hpp" | | #include "armadillo_bits/spglue_minus_bones.hpp" | |
| #include "armadillo_bits/spglue_times_bones.hpp" | | #include "armadillo_bits/spglue_times_bones.hpp" | |
|
| | | #include "armadillo_bits/spglue_join_bones.hpp" | |
| | | | |
| // | | // | |
| // low-level debugging and memory handling functions | | // low-level debugging and memory handling functions | |
| | | | |
| #include "armadillo_bits/debug.hpp" | | #include "armadillo_bits/debug.hpp" | |
| #include "armadillo_bits/memory.hpp" | | #include "armadillo_bits/memory.hpp" | |
| | | | |
| // | | // | |
| // wrappers for various cmath functions | | // wrappers for various cmath functions | |
| | | | |
| | | | |
| skipping to change at line 431 | | skipping to change at line 443 | |
| #include "armadillo_bits/fn_size.hpp" | | #include "armadillo_bits/fn_size.hpp" | |
| #include "armadillo_bits/fn_numel.hpp" | | #include "armadillo_bits/fn_numel.hpp" | |
| #include "armadillo_bits/fn_inplace_strans.hpp" | | #include "armadillo_bits/fn_inplace_strans.hpp" | |
| #include "armadillo_bits/fn_inplace_trans.hpp" | | #include "armadillo_bits/fn_inplace_trans.hpp" | |
| #include "armadillo_bits/fn_randi.hpp" | | #include "armadillo_bits/fn_randi.hpp" | |
| #include "armadillo_bits/fn_randg.hpp" | | #include "armadillo_bits/fn_randg.hpp" | |
| #include "armadillo_bits/fn_cond.hpp" | | #include "armadillo_bits/fn_cond.hpp" | |
| #include "armadillo_bits/fn_normalise.hpp" | | #include "armadillo_bits/fn_normalise.hpp" | |
| #include "armadillo_bits/fn_clamp.hpp" | | #include "armadillo_bits/fn_clamp.hpp" | |
| #include "armadillo_bits/fn_expmat.hpp" | | #include "armadillo_bits/fn_expmat.hpp" | |
|
| | | #include "armadillo_bits/fn_nonzeros.hpp" | |
| | | | |
| #include "armadillo_bits/fn_speye.hpp" | | #include "armadillo_bits/fn_speye.hpp" | |
| #include "armadillo_bits/fn_spones.hpp" | | #include "armadillo_bits/fn_spones.hpp" | |
| #include "armadillo_bits/fn_sprandn.hpp" | | #include "armadillo_bits/fn_sprandn.hpp" | |
| #include "armadillo_bits/fn_sprandu.hpp" | | #include "armadillo_bits/fn_sprandu.hpp" | |
| #include "armadillo_bits/fn_eigs_sym.hpp" | | #include "armadillo_bits/fn_eigs_sym.hpp" | |
| #include "armadillo_bits/fn_eigs_gen.hpp" | | #include "armadillo_bits/fn_eigs_gen.hpp" | |
| #include "armadillo_bits/fn_norm_sparse.hpp" | | #include "armadillo_bits/fn_norm_sparse.hpp" | |
|
| | | #include "armadillo_bits/fn_spsolve.hpp" | |
| | | #include "armadillo_bits/fn_svds.hpp" | |
| | | | |
| // | | // | |
| // misc stuff | | // misc stuff | |
| | | | |
| #include "armadillo_bits/hdf5_misc.hpp" | | #include "armadillo_bits/hdf5_misc.hpp" | |
| #include "armadillo_bits/fft_engine.hpp" | | #include "armadillo_bits/fft_engine.hpp" | |
| | | | |
| #if !defined(ARMA_BAD_COMPILER) | | #if !defined(ARMA_BAD_COMPILER) | |
| #include "armadillo_bits/gmm_misc_bones.hpp" | | #include "armadillo_bits/gmm_misc_bones.hpp" | |
| #include "armadillo_bits/gmm_misc_meat.hpp" | | #include "armadillo_bits/gmm_misc_meat.hpp" | |
| | | | |
| skipping to change at line 501 | | skipping to change at line 516 | |
| #include "armadillo_bits/diagview_meat.hpp" | | #include "armadillo_bits/diagview_meat.hpp" | |
| #include "armadillo_bits/subview_each_meat.hpp" | | #include "armadillo_bits/subview_each_meat.hpp" | |
| | | | |
| #include "armadillo_bits/SpValProxy_meat.hpp" | | #include "armadillo_bits/SpValProxy_meat.hpp" | |
| #include "armadillo_bits/SpMat_meat.hpp" | | #include "armadillo_bits/SpMat_meat.hpp" | |
| #include "armadillo_bits/SpMat_iterators_meat.hpp" | | #include "armadillo_bits/SpMat_iterators_meat.hpp" | |
| #include "armadillo_bits/SpCol_meat.hpp" | | #include "armadillo_bits/SpCol_meat.hpp" | |
| #include "armadillo_bits/SpRow_meat.hpp" | | #include "armadillo_bits/SpRow_meat.hpp" | |
| #include "armadillo_bits/SpSubview_meat.hpp" | | #include "armadillo_bits/SpSubview_meat.hpp" | |
| #include "armadillo_bits/SpSubview_iterators_meat.hpp" | | #include "armadillo_bits/SpSubview_iterators_meat.hpp" | |
|
| | | #include "armadillo_bits/spdiagview_meat.hpp" | |
| | | | |
| #include "armadillo_bits/diskio_meat.hpp" | | #include "armadillo_bits/diskio_meat.hpp" | |
| #include "armadillo_bits/wall_clock_meat.hpp" | | #include "armadillo_bits/wall_clock_meat.hpp" | |
| #include "armadillo_bits/running_stat_meat.hpp" | | #include "armadillo_bits/running_stat_meat.hpp" | |
| #include "armadillo_bits/running_stat_vec_meat.hpp" | | #include "armadillo_bits/running_stat_vec_meat.hpp" | |
| | | | |
| #include "armadillo_bits/op_diagmat_meat.hpp" | | #include "armadillo_bits/op_diagmat_meat.hpp" | |
| #include "armadillo_bits/op_diagvec_meat.hpp" | | #include "armadillo_bits/op_diagvec_meat.hpp" | |
| #include "armadillo_bits/op_dot_meat.hpp" | | #include "armadillo_bits/op_dot_meat.hpp" | |
| #include "armadillo_bits/op_inv_meat.hpp" | | #include "armadillo_bits/op_inv_meat.hpp" | |
| #include "armadillo_bits/op_htrans_meat.hpp" | | #include "armadillo_bits/op_htrans_meat.hpp" | |
| #include "armadillo_bits/op_max_meat.hpp" | | #include "armadillo_bits/op_max_meat.hpp" | |
| #include "armadillo_bits/op_min_meat.hpp" | | #include "armadillo_bits/op_min_meat.hpp" | |
| #include "armadillo_bits/op_mean_meat.hpp" | | #include "armadillo_bits/op_mean_meat.hpp" | |
| #include "armadillo_bits/op_median_meat.hpp" | | #include "armadillo_bits/op_median_meat.hpp" | |
| #include "armadillo_bits/op_sort_meat.hpp" | | #include "armadillo_bits/op_sort_meat.hpp" | |
|
| | | #include "armadillo_bits/op_sort_index_meat.hpp" | |
| #include "armadillo_bits/op_sum_meat.hpp" | | #include "armadillo_bits/op_sum_meat.hpp" | |
| #include "armadillo_bits/op_stddev_meat.hpp" | | #include "armadillo_bits/op_stddev_meat.hpp" | |
| #include "armadillo_bits/op_strans_meat.hpp" | | #include "armadillo_bits/op_strans_meat.hpp" | |
| #include "armadillo_bits/op_var_meat.hpp" | | #include "armadillo_bits/op_var_meat.hpp" | |
| #include "armadillo_bits/op_repmat_meat.hpp" | | #include "armadillo_bits/op_repmat_meat.hpp" | |
| #include "armadillo_bits/op_reshape_meat.hpp" | | #include "armadillo_bits/op_reshape_meat.hpp" | |
| #include "armadillo_bits/op_vectorise_meat.hpp" | | #include "armadillo_bits/op_vectorise_meat.hpp" | |
| #include "armadillo_bits/op_resize_meat.hpp" | | #include "armadillo_bits/op_resize_meat.hpp" | |
| #include "armadillo_bits/op_cov_meat.hpp" | | #include "armadillo_bits/op_cov_meat.hpp" | |
| #include "armadillo_bits/op_cor_meat.hpp" | | #include "armadillo_bits/op_cor_meat.hpp" | |
| | | | |
| skipping to change at line 550 | | skipping to change at line 567 | |
| #include "armadillo_bits/op_symmat_meat.hpp" | | #include "armadillo_bits/op_symmat_meat.hpp" | |
| #include "armadillo_bits/op_hist_meat.hpp" | | #include "armadillo_bits/op_hist_meat.hpp" | |
| #include "armadillo_bits/op_unique_meat.hpp" | | #include "armadillo_bits/op_unique_meat.hpp" | |
| #include "armadillo_bits/op_toeplitz_meat.hpp" | | #include "armadillo_bits/op_toeplitz_meat.hpp" | |
| #include "armadillo_bits/op_fft_meat.hpp" | | #include "armadillo_bits/op_fft_meat.hpp" | |
| #include "armadillo_bits/op_any_meat.hpp" | | #include "armadillo_bits/op_any_meat.hpp" | |
| #include "armadillo_bits/op_all_meat.hpp" | | #include "armadillo_bits/op_all_meat.hpp" | |
| #include "armadillo_bits/op_normalise_meat.hpp" | | #include "armadillo_bits/op_normalise_meat.hpp" | |
| #include "armadillo_bits/op_clamp_meat.hpp" | | #include "armadillo_bits/op_clamp_meat.hpp" | |
| #include "armadillo_bits/op_expmat_meat.hpp" | | #include "armadillo_bits/op_expmat_meat.hpp" | |
|
| | | #include "armadillo_bits/op_nonzeros_meat.hpp" | |
| | | | |
| #include "armadillo_bits/glue_times_meat.hpp" | | #include "armadillo_bits/glue_times_meat.hpp" | |
| #include "armadillo_bits/glue_mixed_meat.hpp" | | #include "armadillo_bits/glue_mixed_meat.hpp" | |
| #include "armadillo_bits/glue_cov_meat.hpp" | | #include "armadillo_bits/glue_cov_meat.hpp" | |
| #include "armadillo_bits/glue_cor_meat.hpp" | | #include "armadillo_bits/glue_cor_meat.hpp" | |
| #include "armadillo_bits/glue_kron_meat.hpp" | | #include "armadillo_bits/glue_kron_meat.hpp" | |
| #include "armadillo_bits/glue_cross_meat.hpp" | | #include "armadillo_bits/glue_cross_meat.hpp" | |
| #include "armadillo_bits/glue_join_meat.hpp" | | #include "armadillo_bits/glue_join_meat.hpp" | |
| #include "armadillo_bits/glue_relational_meat.hpp" | | #include "armadillo_bits/glue_relational_meat.hpp" | |
| #include "armadillo_bits/glue_solve_meat.hpp" | | #include "armadillo_bits/glue_solve_meat.hpp" | |
| | | | |
| skipping to change at line 579 | | skipping to change at line 597 | |
| #include "armadillo_bits/spop_sum_meat.hpp" | | #include "armadillo_bits/spop_sum_meat.hpp" | |
| #include "armadillo_bits/spop_strans_meat.hpp" | | #include "armadillo_bits/spop_strans_meat.hpp" | |
| #include "armadillo_bits/spop_htrans_meat.hpp" | | #include "armadillo_bits/spop_htrans_meat.hpp" | |
| #include "armadillo_bits/spop_misc_meat.hpp" | | #include "armadillo_bits/spop_misc_meat.hpp" | |
| #include "armadillo_bits/spop_mean_meat.hpp" | | #include "armadillo_bits/spop_mean_meat.hpp" | |
| #include "armadillo_bits/spop_var_meat.hpp" | | #include "armadillo_bits/spop_var_meat.hpp" | |
| | | | |
| #include "armadillo_bits/spglue_plus_meat.hpp" | | #include "armadillo_bits/spglue_plus_meat.hpp" | |
| #include "armadillo_bits/spglue_minus_meat.hpp" | | #include "armadillo_bits/spglue_minus_meat.hpp" | |
| #include "armadillo_bits/spglue_times_meat.hpp" | | #include "armadillo_bits/spglue_times_meat.hpp" | |
|
| | | #include "armadillo_bits/spglue_join_meat.hpp" | |
| } | | } | |
| | | | |
| #include "armadillo_bits/compiler_setup_post.hpp" | | #include "armadillo_bits/compiler_setup_post.hpp" | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 14 change blocks. |
| 0 lines changed or deleted | | 19 lines changed or added | |
|
| atlas_wrapper.hpp | | atlas_wrapper.hpp | |
| | | | |
| skipping to change at line 30 | | skipping to change at line 30 | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| eT | | eT | |
| cblas_dot(const int N, const eT* X, const eT* Y) | | cblas_dot(const int N, const eT* X, const eT* Y) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| return eT( arma_atlas(cblas_sdot)(N, (const T*)X, 1, (const T*)Y, 1)
); | | return eT( arma_wrapper(cblas_sdot)(N, (const T*)X, 1, (const T*)Y, 1
) ); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| return eT( arma_atlas(cblas_ddot)(N, (const T*)X, 1, (const T*)Y, 1)
); | | return eT( arma_wrapper(cblas_ddot)(N, (const T*)X, 1, (const T*)Y, 1
) ); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_inline | | arma_inline | |
| eT | | eT | |
| cx_cblas_dot(const int N, const eT* X, const eT* Y) | | cx_cblas_dot(const int N, const eT* X, const eT* Y) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef typename std::complex<float> T; | | typedef typename std::complex<float> T; | |
| | | | |
| T out; | | T out; | |
|
| arma_atlas(cblas_cdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out); | | arma_wrapper(cblas_cdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out
); | |
| | | | |
| return eT(out); | | return eT(out); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef typename std::complex<double> T; | | typedef typename std::complex<double> T; | |
| | | | |
| T out; | | T out; | |
|
| arma_atlas(cblas_zdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out); | | arma_wrapper(cblas_zdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out
); | |
| | | | |
| return eT(out); | | return eT(out); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return eT(0); | | return eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 95 | |
| const eT *X, const int incX, | | const eT *X, const int incX, | |
| const eT beta, | | const eT beta, | |
| eT *Y, const int incY | | eT *Y, const int incY | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_atlas(cblas_sgemv)(Order, TransA, M, N, (const T)tmp_real(alpha)
, (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY
); | | arma_wrapper(cblas_sgemv)(Order, TransA, M, N, (const T)tmp_real(alph
a), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, in
cY); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_atlas(cblas_dgemv)(Order, TransA, M, N, (const T)tmp_real(alpha)
, (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY
); | | arma_wrapper(cblas_dgemv)(Order, TransA, M, N, (const T)tmp_real(alph
a), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, in
cY); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_atlas(cblas_cgemv)(Order, TransA, M, N, (const T*)&alpha, (const
T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | | arma_wrapper(cblas_cgemv)(Order, TransA, M, N, (const T*)&alpha, (con
st T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_atlas(cblas_zgemv)(Order, TransA, M, N, (const T*)&alpha, (const
T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | | arma_wrapper(cblas_zgemv)(Order, TransA, M, N, (const T*)&alpha, (con
st T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| cblas_gemm | | cblas_gemm | |
| ( | | ( | |
| const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, | | const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, | |
| const enum CBLAS_TRANSPOSE TransB, const int M, const int N, | | const enum CBLAS_TRANSPOSE TransB, const int M, const int N, | |
| const int K, const eT alpha, const eT *A, | | const int K, const eT alpha, const eT *A, | |
| const int lda, const eT *B, const int ldb, | | const int lda, const eT *B, const int ldb, | |
| const eT beta, eT *C, const int ldc | | const eT beta, eT *C, const int ldc | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_atlas(cblas_sgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_
real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (
T*)C, ldc); | | arma_wrapper(cblas_sgemm)(Order, TransA, TransB, M, N, K, (const T)tm
p_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta),
(T*)C, ldc); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_atlas(cblas_dgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_
real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (
T*)C, ldc); | | arma_wrapper(cblas_dgemm)(Order, TransA, TransB, M, N, K, (const T)tm
p_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta),
(T*)C, ldc); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_atlas(cblas_cgemm)(Order, TransA, TransB, M, N, K, (const T*)&al
pha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | | arma_wrapper(cblas_cgemm)(Order, TransA, TransB, M, N, K, (const T*)&
alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_atlas(cblas_zgemm)(Order, TransA, TransB, M, N, K, (const T*)&al
pha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | | arma_wrapper(cblas_zgemm)(Order, TransA, TransB, M, N, K, (const T*)&
alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| cblas_syrk | | cblas_syrk | |
| ( | | ( | |
| const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CB
LAS_TRANSPOSE Trans, | | const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CB
LAS_TRANSPOSE Trans, | |
| const int N, const int K, const eT alpha, | | const int N, const int K, const eT alpha, | |
| const eT* A, const int lda, const eT beta, eT* C, const int ldc | | const eT* A, const int lda, const eT beta, eT* C, const int ldc | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_atlas(cblas_ssyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (co
nst T*)A, lda, (const T)beta, (T*)C, ldc); | | arma_wrapper(cblas_ssyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (
const T*)A, lda, (const T)beta, (T*)C, ldc); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_atlas(cblas_dsyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (co
nst T*)A, lda, (const T)beta, (T*)C, ldc); | | arma_wrapper(cblas_dsyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (
const T*)A, lda, (const T)beta, (T*)C, ldc); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| inline | | inline | |
| void | | void | |
| cblas_herk | | cblas_herk | |
| ( | | ( | |
| const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CB
LAS_TRANSPOSE Trans, | | const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CB
LAS_TRANSPOSE Trans, | |
| const int N, const int K, const T alpha, | | const int N, const int K, const T alpha, | |
| const std::complex<T>* A, const int lda, const T beta, std::complex<T>*
C, const int ldc | | const std::complex<T>* A, const int lda, const T beta, std::complex<T>*
C, const int ldc | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<T>::value == false)); | | arma_type_check((is_supported_blas_type<T>::value == false)); | |
| | | | |
| if(is_float<T>::value == true) | | if(is_float<T>::value == true) | |
| { | | { | |
| typedef float TT; | | typedef float TT; | |
| typedef std::complex<float> cx_TT; | | typedef std::complex<float> cx_TT; | |
| | | | |
|
| arma_atlas(cblas_cherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (c
onst cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); | | arma_wrapper(cblas_cherk)(Order, Uplo, Trans, N, K, (const TT)alpha,
(const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); | |
| } | | } | |
| else | | else | |
| if(is_double<T>::value == true) | | if(is_double<T>::value == true) | |
| { | | { | |
| typedef double TT; | | typedef double TT; | |
| typedef std::complex<double> cx_TT; | | typedef std::complex<double> cx_TT; | |
| | | | |
|
| arma_atlas(cblas_zherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (c
onst cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); | | arma_wrapper(cblas_zherk)(Order, Uplo, Trans, N, K, (const TT)alpha,
(const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| int | | int | |
| clapack_getrf | | clapack_getrf | |
| ( | | ( | |
| const enum CBLAS_ORDER Order, const int M, const int N, | | const enum CBLAS_ORDER Order, const int M, const int N, | |
| eT *A, const int lda, int *ipiv | | eT *A, const int lda, int *ipiv | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| return arma_atlas(clapack_sgetrf)(Order, M, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_sgetrf)(Order, M, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| return arma_atlas(clapack_dgetrf)(Order, M, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_dgetrf)(Order, M, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| return arma_atlas(clapack_cgetrf)(Order, M, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_cgetrf)(Order, M, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| return arma_atlas(clapack_zgetrf)(Order, M, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_zgetrf)(Order, M, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return -1; | | return -1; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| int | | int | |
| | | | |
| skipping to change at line 264 | | skipping to change at line 264 | |
| ( | | ( | |
| const enum CBLAS_ORDER Order, const int N, eT *A, | | const enum CBLAS_ORDER Order, const int N, eT *A, | |
| const int lda, const int *ipiv | | const int lda, const int *ipiv | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| return arma_atlas(clapack_sgetri)(Order, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_sgetri)(Order, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| return arma_atlas(clapack_dgetri)(Order, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_dgetri)(Order, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| return arma_atlas(clapack_cgetri)(Order, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_cgetri)(Order, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| return arma_atlas(clapack_zgetri)(Order, N, (T*)A, lda, ipiv); | | return arma_wrapper(clapack_zgetri)(Order, N, (T*)A, lda, ipiv); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return -1; | | return -1; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| int | | int | |
| | | | |
| skipping to change at line 306 | | skipping to change at line 306 | |
| const int N, const int NRHS, | | const int N, const int NRHS, | |
| eT* A, const int lda, int* ipiv, | | eT* A, const int lda, int* ipiv, | |
| eT* B, const int ldb | | eT* B, const int ldb | |
| ) | | ) | |
| { | | { | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | arma_type_check((is_supported_blas_type<eT>::value == false)); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| return arma_atlas(clapack_sgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T
*)B, ldb); | | return arma_wrapper(clapack_sgesv)(Order, N, NRHS, (T*)A, lda, ipiv,
(T*)B, ldb); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| return arma_atlas(clapack_dgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T
*)B, ldb); | | return arma_wrapper(clapack_dgesv)(Order, N, NRHS, (T*)A, lda, ipiv,
(T*)B, ldb); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| return arma_atlas(clapack_cgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T
*)B, ldb); | | return arma_wrapper(clapack_cgesv)(Order, N, NRHS, (T*)A, lda, ipiv,
(T*)B, ldb); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| return arma_atlas(clapack_zgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T
*)B, ldb); | | return arma_wrapper(clapack_zgesv)(Order, N, NRHS, (T*)A, lda, ipiv,
(T*)B, ldb); | |
| } | | } | |
| else | | else | |
| { | | { | |
| return -1; | | return -1; | |
| } | | } | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 28 change blocks. |
| 28 lines changed or deleted | | 28 lines changed or added | |
|
| auxlib_meat.hpp | | auxlib_meat.hpp | |
|
| // Copyright (C) 2008-2014 Conrad Sanderson | | // Copyright (C) 2008-2015 Conrad Sanderson | |
| // Copyright (C) 2008-2014 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2015 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2009 Edmund Highcock | | // Copyright (C) 2009 Edmund Highcock | |
| // Copyright (C) 2011 James Sanders | | // Copyright (C) 2011 James Sanders | |
| // Copyright (C) 2011 Stanislav Funiak | | // Copyright (C) 2011 Stanislav Funiak | |
| // Copyright (C) 2012 Eric Jon Sundstrom | | // Copyright (C) 2012 Eric Jon Sundstrom | |
| // Copyright (C) 2012 Michael McNeil Forbes | | // Copyright (C) 2012 Michael McNeil Forbes | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| | | | |
| skipping to change at line 239 | | skipping to change at line 239 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(out.is_empty()) | | if(out.is_empty()) | |
| { | | { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_ATLAS) | | #if defined(ARMA_USE_ATLAS) | |
| { | | { | |
|
| | | arma_debug_assert_atlas_size(out); | |
| | | | |
| podarray<int> ipiv(out.n_rows); | | podarray<int> ipiv(out.n_rows); | |
| | | | |
| int info = atlas::clapack_getrf(atlas::CblasColMajor, out.n_rows, out.n
_cols, out.memptr(), out.n_rows, ipiv.memptr()); | | int info = atlas::clapack_getrf(atlas::CblasColMajor, out.n_rows, out.n
_cols, out.memptr(), out.n_rows, ipiv.memptr()); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| info = atlas::clapack_getri(atlas::CblasColMajor, out.n_rows, out.mem
ptr(), out.n_rows, ipiv.memptr()); | | info = atlas::clapack_getri(atlas::CblasColMajor, out.n_rows, out.mem
ptr(), out.n_rows, ipiv.memptr()); | |
| } | | } | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(out); | |
| | | | |
| blas_int n_rows = out.n_rows; | | blas_int n_rows = out.n_rows; | |
| blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n
_rows); | | blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), n
_rows); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<blas_int> ipiv(out.n_rows); | | podarray<blas_int> ipiv(out.n_rows); | |
| | | | |
| if(n_rows > 16) | | if(n_rows > 16) | |
| { | | { | |
| eT work_query[2]; | | eT work_query[2]; | |
| blas_int lwork_query = -1; | | blas_int lwork_query = -1; | |
| | | | |
| skipping to change at line 319 | | skipping to change at line 323 | |
| | | | |
| if(out.is_empty()) | | if(out.is_empty()) | |
| { | | { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| bool status; | | bool status; | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(out); | |
| | | | |
| char uplo = (layout == 0) ? 'U' : 'L'; | | char uplo = (layout == 0) ? 'U' : 'L'; | |
| char diag = 'N'; | | char diag = 'N'; | |
| blas_int n = blas_int(out.n_rows); | | blas_int n = blas_int(out.n_rows); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| lapack::trtri(&uplo, &diag, &n, out.memptr(), &n, &info); | | lapack::trtri(&uplo, &diag, &n, out.memptr(), &n, &info); | |
| | | | |
| status = (info == 0); | | status = (info == 0); | |
| } | | } | |
| #else | | #else | |
| | | | |
| skipping to change at line 373 | | skipping to change at line 379 | |
| | | | |
| if(out.is_empty()) | | if(out.is_empty()) | |
| { | | { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| bool status; | | bool status; | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(out); | |
| | | | |
| char uplo = (layout == 0) ? 'U' : 'L'; | | char uplo = (layout == 0) ? 'U' : 'L'; | |
| blas_int n = blas_int(out.n_rows); | | blas_int n = blas_int(out.n_rows); | |
| blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*
n); | | blas_int lwork = (std::max)(blas_int(podarray_prealloc_n_elem::val), 2*
n); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<blas_int> ipiv; | | podarray<blas_int> ipiv; | |
| ipiv.set_size(out.n_rows); | | ipiv.set_size(out.n_rows); | |
| | | | |
| podarray<eT> work; | | podarray<eT> work; | |
| work.set_size( uword(lwork) ); | | work.set_size( uword(lwork) ); | |
| | | | |
| skipping to change at line 428 | | skipping to change at line 436 | |
| | | | |
| if(out.is_empty()) | | if(out.is_empty()) | |
| { | | { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| bool status; | | bool status; | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(out); | |
| | | | |
| char uplo = (layout == 0) ? 'U' : 'L'; | | char uplo = (layout == 0) ? 'U' : 'L'; | |
| blas_int n = blas_int(out.n_rows); | | blas_int n = blas_int(out.n_rows); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| lapack::potrf(&uplo, &n, out.memptr(), &n, &info); | | lapack::potrf(&uplo, &n, out.memptr(), &n, &info); | |
| | | | |
| status = (info == 0); | | status = (info == 0); | |
| | | | |
| if(status == true) | | if(status == true) | |
| { | | { | |
| | | | |
| skipping to change at line 597 | | skipping to change at line 607 | |
| | | | |
| Mat<eT>& tmp = (make_copy == true) ? X_copy : const_cast< Mat<eT>& >(X); | | Mat<eT>& tmp = (make_copy == true) ? X_copy : const_cast< Mat<eT>& >(X); | |
| | | | |
| if(tmp.is_empty()) | | if(tmp.is_empty()) | |
| { | | { | |
| return eT(1); | | return eT(1); | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_ATLAS) | | #if defined(ARMA_USE_ATLAS) | |
| { | | { | |
|
| | | arma_debug_assert_atlas_size(tmp); | |
| | | | |
| podarray<int> ipiv(tmp.n_rows); | | podarray<int> ipiv(tmp.n_rows); | |
| | | | |
| //const int info = | | //const int info = | |
| atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.
memptr(), tmp.n_rows, ipiv.memptr()); | | atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows, tmp.n_cols, tmp.
memptr(), tmp.n_rows, ipiv.memptr()); | |
| | | | |
| // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | | // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | |
| eT val = tmp.at(0,0); | | eT val = tmp.at(0,0); | |
| for(uword i=1; i < tmp.n_rows; ++i) | | for(uword i=1; i < tmp.n_rows; ++i) | |
| { | | { | |
| val *= tmp.at(i,i); | | val *= tmp.at(i,i); | |
| | | | |
| skipping to change at line 622 | | skipping to change at line 634 | |
| if( int(i) != ipiv.mem[i] ) // NOTE: no adjustment required, as the
clapack version of getrf() assumes counting from 0 | | if( int(i) != ipiv.mem[i] ) // NOTE: no adjustment required, as the
clapack version of getrf() assumes counting from 0 | |
| { | | { | |
| sign *= -1; | | sign *= -1; | |
| } | | } | |
| } | | } | |
| | | | |
| return ( (sign < 0) ? -val : val ); | | return ( (sign < 0) ? -val : val ); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(tmp); | |
| | | | |
| podarray<blas_int> ipiv(tmp.n_rows); | | podarray<blas_int> ipiv(tmp.n_rows); | |
| | | | |
| blas_int info = 0; | | blas_int info = 0; | |
| blas_int n_rows = blas_int(tmp.n_rows); | | blas_int n_rows = blas_int(tmp.n_rows); | |
| blas_int n_cols = blas_int(tmp.n_cols); | | blas_int n_cols = blas_int(tmp.n_cols); | |
| | | | |
| lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &
info); | | lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &
info); | |
| | | | |
| // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | | // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | |
| eT val = tmp.at(0,0); | | eT val = tmp.at(0,0); | |
| | | | |
| skipping to change at line 681 | | skipping to change at line 695 | |
| Mat<eT> tmp(X.get_ref()); | | Mat<eT> tmp(X.get_ref()); | |
| arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix
is not square" ); | | arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix
is not square" ); | |
| | | | |
| if(tmp.is_empty()) | | if(tmp.is_empty()) | |
| { | | { | |
| out_val = eT(0); | | out_val = eT(0); | |
| out_sign = T(1); | | out_sign = T(1); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_atlas_size(tmp); | |
| | | | |
| podarray<int> ipiv(tmp.n_rows); | | podarray<int> ipiv(tmp.n_rows); | |
| | | | |
| const int info = atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows,
tmp.n_cols, tmp.memptr(), tmp.n_rows, ipiv.memptr()); | | const int info = atlas::clapack_getrf(atlas::CblasColMajor, tmp.n_rows,
tmp.n_cols, tmp.memptr(), tmp.n_rows, ipiv.memptr()); | |
| | | | |
| // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | | // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | |
| | | | |
| sword sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tm
p.at(0,0) ) < T(0)) ? -1 : +1 ) : +1; | | sword sign = (is_complex<eT>::value == false) ? ( (access::tmp_real( tm
p.at(0,0) ) < T(0)) ? -1 : +1 ) : +1; | |
| eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re
al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t
mp.at(0,0) ); | | eT val = (is_complex<eT>::value == false) ? std::log( (access::tmp_re
al( tmp.at(0,0) ) < T(0)) ? tmp.at(0,0)*T(-1) : tmp.at(0,0) ) : std::log( t
mp.at(0,0) ); | |
| | | | |
| for(uword i=1; i < tmp.n_rows; ++i) | | for(uword i=1; i < tmp.n_rows; ++i) | |
| | | | |
| skipping to change at line 723 | | skipping to change at line 739 | |
| Mat<eT> tmp(X.get_ref()); | | Mat<eT> tmp(X.get_ref()); | |
| arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix
is not square" ); | | arma_debug_check( (tmp.is_square() == false), "log_det(): given matrix
is not square" ); | |
| | | | |
| if(tmp.is_empty()) | | if(tmp.is_empty()) | |
| { | | { | |
| out_val = eT(0); | | out_val = eT(0); | |
| out_sign = T(1); | | out_sign = T(1); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(tmp); | |
| | | | |
| podarray<blas_int> ipiv(tmp.n_rows); | | podarray<blas_int> ipiv(tmp.n_rows); | |
| | | | |
| blas_int info = 0; | | blas_int info = 0; | |
| blas_int n_rows = blas_int(tmp.n_rows); | | blas_int n_rows = blas_int(tmp.n_rows); | |
| blas_int n_cols = blas_int(tmp.n_cols); | | blas_int n_cols = blas_int(tmp.n_cols); | |
| | | | |
| lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &
info); | | lapack::getrf(&n_rows, &n_cols, tmp.memptr(), &n_rows, ipiv.memptr(), &
info); | |
| | | | |
| // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | | // on output tmp appears to be L+U_alt, where U_alt is U with the main
diagonal set to zero | |
| | | | |
| | | | |
| skipping to change at line 798 | | skipping to change at line 816 | |
| ipiv.reset(); | | ipiv.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK) | |
| { | | { | |
| bool status; | | bool status; | |
| | | | |
| #if defined(ARMA_USE_ATLAS) | | #if defined(ARMA_USE_ATLAS) | |
| { | | { | |
|
| | | arma_debug_assert_atlas_size(U); | |
| | | | |
| ipiv.set_size( (std::min)(U_n_rows, U_n_cols) ); | | ipiv.set_size( (std::min)(U_n_rows, U_n_cols) ); | |
| | | | |
| int info = atlas::clapack_getrf(atlas::CblasColMajor, U_n_rows, U_n_c
ols, U.memptr(), U_n_rows, ipiv.memptr()); | | int info = atlas::clapack_getrf(atlas::CblasColMajor, U_n_rows, U_n_c
ols, U.memptr(), U_n_rows, ipiv.memptr()); | |
| | | | |
| status = (info == 0); | | status = (info == 0); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(U); | |
| | | | |
| ipiv.set_size( (std::min)(U_n_rows, U_n_cols) ); | | ipiv.set_size( (std::min)(U_n_rows, U_n_cols) ); | |
| | | | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| blas_int n_rows = U_n_rows; | | blas_int n_rows = U_n_rows; | |
| blas_int n_cols = U_n_cols; | | blas_int n_cols = U_n_cols; | |
| | | | |
| lapack::getrf(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &
info); | | lapack::getrf(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &
info); | |
| | | | |
| // take into account that Fortran counts from 1 | | // take into account that Fortran counts from 1 | |
| | | | |
| skipping to change at line 993 | | skipping to change at line 1015 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not square"); | | arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not square"); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| eigval.set_size(A.n_rows); | | eigval.set_size(A.n_rows); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(A.n_rows); | | blas_int N = blas_int(A.n_rows); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), 3*N-1) ); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), 3*N-1) ); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| skipping to change at line 1040 | | skipping to change at line 1064 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not square"); | | arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not square"); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| eigval.set_size(A.n_rows); | | eigval.set_size(A.n_rows); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(A.n_rows); | | blas_int N = blas_int(A.n_rows); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), 2*N-1) ); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), 2*N-1) ); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| skipping to change at line 1088 | | skipping to change at line 1114 | |
| | | | |
| arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | | arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | |
| | | | |
| if(eigvec.is_empty()) | | if(eigvec.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(eigvec); | |
| | | | |
| eigval.set_size(eigvec.n_rows); | | eigval.set_size(eigvec.n_rows); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(eigvec.n_rows); | | blas_int N = blas_int(eigvec.n_rows); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), 3*N-1) ); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), 3*N-1) ); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| skipping to change at line 1137 | | skipping to change at line 1165 | |
| | | | |
| arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | | arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | |
| | | | |
| if(eigvec.is_empty()) | | if(eigvec.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(eigvec); | |
| | | | |
| eigval.set_size(eigvec.n_rows); | | eigval.set_size(eigvec.n_rows); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(eigvec.n_rows); | | blas_int N = blas_int(eigvec.n_rows); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), 2*N-1) ); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), 2*N-1) ); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> work( static_cast<uword>(lwork) ); | | podarray<eT> work( static_cast<uword>(lwork) ); | |
| | | | |
| skipping to change at line 1186 | | skipping to change at line 1216 | |
| | | | |
| arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | | arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | |
| | | | |
| if(eigvec.is_empty()) | | if(eigvec.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(eigvec); | |
| | | | |
| eigval.set_size(eigvec.n_rows); | | eigval.set_size(eigvec.n_rows); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(eigvec.n_rows); | | blas_int N = blas_int(eigvec.n_rows); | |
| blas_int lwork = 2 * (1 + 6*N + 2*(N*N)); | | blas_int lwork = 2 * (1 + 6*N + 2*(N*N)); | |
| blas_int liwork = 3 * (3 + 5*N); | | blas_int liwork = 3 * (3 + 5*N); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| | | | |
| skipping to change at line 1238 | | skipping to change at line 1270 | |
| | | | |
| arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | | arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not square" ); | |
| | | | |
| if(eigvec.is_empty()) | | if(eigvec.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| eigvec.reset(); | | eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(eigvec); | |
| | | | |
| eigval.set_size(eigvec.n_rows); | | eigval.set_size(eigvec.n_rows); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int N = blas_int(eigvec.n_rows); | | blas_int N = blas_int(eigvec.n_rows); | |
| blas_int lwork = 2 * (2*N + N*N); | | blas_int lwork = 2 * (2*N + N*N); | |
| blas_int lrwork = 2 * (1 + 5*N + 2*(N*N)); | | blas_int lrwork = 2 * (1 + 5*N + 2*(N*N)); | |
| blas_int liwork = 3 * (3 + 5*N); | | blas_int liwork = 3 * (3 + 5*N); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| skipping to change at line 1329 | | skipping to change at line 1363 | |
| arma_debug_check( (A.is_square() == false), "eig_gen(): given matrix is
not square" ); | | arma_debug_check( (A.is_square() == false), "eig_gen(): given matrix is
not square" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | if(A.is_finite() == false) { return false; } // workaround for a bug | |
| | | in LAPACK 3.5 | |
| | | | |
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| eigval.set_size(A_n_rows); | | eigval.set_size(A_n_rows); | |
| | | | |
| l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | | l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | |
| r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | | r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | |
| | | | |
| blas_int N = blas_int(A_n_rows); | | blas_int N = blas_int(A_n_rows); | |
| blas_int ldvl = blas_int(l_eigvec.n_rows); | | blas_int ldvl = blas_int(l_eigvec.n_rows); | |
| blas_int ldvr = blas_int(r_eigvec.n_rows); | | blas_int ldvr = blas_int(r_eigvec.n_rows); | |
| | | | |
| skipping to change at line 1433 | | skipping to change at line 1471 | |
| arma_debug_check( (A.is_square() == false), "eig_gen(): given matrix is
not square" ); | | arma_debug_check( (A.is_square() == false), "eig_gen(): given matrix is
not square" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | if(A.is_finite() == false) { return false; } // workaround for a bug | |
| | | in LAPACK 3.5 | |
| | | | |
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| eigval.set_size(A_n_rows); | | eigval.set_size(A_n_rows); | |
| | | | |
| l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | | l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | |
| r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | | r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | |
| | | | |
| blas_int N = blas_int(A_n_rows); | | blas_int N = blas_int(A_n_rows); | |
| blas_int ldvl = blas_int(l_eigvec.n_rows); | | blas_int ldvl = blas_int(l_eigvec.n_rows); | |
| blas_int ldvr = blas_int(r_eigvec.n_rows); | | blas_int ldvr = blas_int(r_eigvec.n_rows); | |
| | | | |
| skipping to change at line 1531 | | skipping to change at line 1573 | |
| arma_debug_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices m
ust have the same size" ); | | arma_debug_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices m
ust have the same size" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| eigval.set_size(A_n_rows); | | eigval.set_size(A_n_rows); | |
| | | | |
| l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | | l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | |
| r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | | r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | |
| | | | |
| blas_int N = blas_int(A_n_rows); | | blas_int N = blas_int(A_n_rows); | |
| blas_int ldvl = blas_int(l_eigvec.n_rows); | | blas_int ldvl = blas_int(l_eigvec.n_rows); | |
| blas_int ldvr = blas_int(r_eigvec.n_rows); | | blas_int ldvr = blas_int(r_eigvec.n_rows); | |
| | | | |
| skipping to change at line 1685 | | skipping to change at line 1729 | |
| arma_debug_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices m
ust have the same size" ); | | arma_debug_check( (A.n_rows != B.n_rows), "eig_pair(): given matrices m
ust have the same size" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| eigval.reset(); | | eigval.reset(); | |
| l_eigvec.reset(); | | l_eigvec.reset(); | |
| r_eigvec.reset(); | | r_eigvec.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| podarray<eT> alpha(A_n_rows); | | podarray<eT> alpha(A_n_rows); | |
| podarray<eT> beta(A_n_rows); | | podarray<eT> beta(A_n_rows); | |
| | | | |
| l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | | l_eigvec.set_size( ((jobvl == 'V') ? A_n_rows : 1), A_n_rows ); | |
| r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | | r_eigvec.set_size( ((jobvr == 'V') ? A_n_rows : 1), A_n_rows ); | |
| | | | |
| blas_int N = blas_int(A_n_rows); | | blas_int N = blas_int(A_n_rows); | |
| blas_int ldvl = blas_int(l_eigvec.n_rows); | | blas_int ldvl = blas_int(l_eigvec.n_rows); | |
| | | | |
| skipping to change at line 1776 | | skipping to change at line 1822 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
| out = X.get_ref(); | | out = X.get_ref(); | |
| | | | |
| arma_debug_check( (out.is_square() == false), "chol(): given matrix is
not square" ); | | arma_debug_check( (out.is_square() == false), "chol(): given matrix is
not square" ); | |
| | | | |
| if(out.is_empty()) { return true; } | | if(out.is_empty()) { return true; } | |
| | | | |
|
| | | arma_debug_assert_blas_size(out); | |
| | | | |
| const uword out_n_rows = out.n_rows; | | const uword out_n_rows = out.n_rows; | |
| | | | |
| char uplo = (layout == 0) ? 'U' : 'L'; | | char uplo = (layout == 0) ? 'U' : 'L'; | |
| blas_int n = out_n_rows; | | blas_int n = out_n_rows; | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| lapack::potrf(&uplo, &n, out.memptr(), &n, &info); | | lapack::potrf(&uplo, &n, out.memptr(), &n, &info); | |
| | | | |
| if(layout == 0) | | if(layout == 0) | |
| { | | { | |
| | | | |
| skipping to change at line 1837 | | skipping to change at line 1885 | |
| | | | |
| const uword R_n_rows = R.n_rows; | | const uword R_n_rows = R.n_rows; | |
| const uword R_n_cols = R.n_cols; | | const uword R_n_cols = R.n_cols; | |
| | | | |
| if(R.is_empty()) | | if(R.is_empty()) | |
| { | | { | |
| Q.eye(R_n_rows, R_n_rows); | | Q.eye(R_n_rows, R_n_rows); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(R); | |
| | | | |
| blas_int m = static_cast<blas_int>(R_n_rows); | | blas_int m = static_cast<blas_int>(R_n_rows); | |
| blas_int n = static_cast<blas_int>(R_n_cols); | | blas_int n = static_cast<blas_int>(R_n_cols); | |
| blas_int lwork = 0; | | blas_int lwork = 0; | |
| blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take
into account requirements of geqrf() _and_ orgqr()/ungqr() | | blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take
into account requirements of geqrf() _and_ orgqr()/ungqr() | |
| blas_int k = (std::min)(m,n); | | blas_int k = (std::min)(m,n); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> tau( static_cast<uword>(k) ); | | podarray<eT> tau( static_cast<uword>(k) ); | |
| | | | |
| eT work_query[2]; | | eT work_query[2]; | |
| | | | |
| skipping to change at line 1953 | | skipping to change at line 2003 | |
| return auxlib::qr(Q, R, Q); | | return auxlib::qr(Q, R, Q); | |
| } | | } | |
| | | | |
| if(Q.is_empty()) | | if(Q.is_empty()) | |
| { | | { | |
| Q.set_size(Q_n_rows, 0 ); | | Q.set_size(Q_n_rows, 0 ); | |
| R.set_size(0, Q_n_cols); | | R.set_size(0, Q_n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(Q); | |
| | | | |
| blas_int m = static_cast<blas_int>(Q_n_rows); | | blas_int m = static_cast<blas_int>(Q_n_rows); | |
| blas_int n = static_cast<blas_int>(Q_n_cols); | | blas_int n = static_cast<blas_int>(Q_n_cols); | |
| blas_int lwork = 0; | | blas_int lwork = 0; | |
| blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take
into account requirements of geqrf() _and_ orgqr()/ungqr() | | blas_int lwork_min = (std::max)(blas_int(1), (std::max)(m,n)); // take
into account requirements of geqrf() _and_ orgqr()/ungqr() | |
| blas_int k = (std::min)(m,n); | | blas_int k = (std::min)(m,n); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<eT> tau( static_cast<uword>(k) ); | | podarray<eT> tau( static_cast<uword>(k) ); | |
| | | | |
| eT work_query[2]; | | eT work_query[2]; | |
| | | | |
| skipping to change at line 2049 | | skipping to change at line 2101 | |
| | | | |
| X_n_rows = A.n_rows; | | X_n_rows = A.n_rows; | |
| X_n_cols = A.n_cols; | | X_n_cols = A.n_cols; | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| S.reset(); | | S.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| Mat<eT> U(1, 1); | | Mat<eT> U(1, 1); | |
| Mat<eT> V(1, A.n_cols); | | Mat<eT> V(1, A.n_cols); | |
| | | | |
| char jobu = 'N'; | | char jobu = 'N'; | |
| char jobvt = 'N'; | | char jobvt = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| | | | |
| skipping to change at line 2125 | | skipping to change at line 2179 | |
| | | | |
| X_n_rows = A.n_rows; | | X_n_rows = A.n_rows; | |
| X_n_cols = A.n_cols; | | X_n_cols = A.n_cols; | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| S.reset(); | | S.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| Mat<eT> U(1, 1); | | Mat<eT> U(1, 1); | |
| Mat<eT> V(1, A.n_cols); | | Mat<eT> V(1, A.n_cols); | |
| | | | |
| char jobu = 'N'; | | char jobu = 'N'; | |
| char jobvt = 'N'; | | char jobvt = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| | | | |
| skipping to change at line 2240 | | skipping to change at line 2296 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| U.eye(A.n_rows, A.n_rows); | | U.eye(A.n_rows, A.n_rows); | |
| S.reset(); | | S.reset(); | |
| V.eye(A.n_cols, A.n_cols); | | V.eye(A.n_cols, A.n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| U.set_size(A.n_rows, A.n_rows); | | U.set_size(A.n_rows, A.n_rows); | |
| V.set_size(A.n_cols, A.n_cols); | | V.set_size(A.n_cols, A.n_cols); | |
| | | | |
| char jobu = 'A'; | | char jobu = 'A'; | |
| char jobvt = 'A'; | | char jobvt = 'A'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| skipping to change at line 2318 | | skipping to change at line 2376 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| U.eye(A.n_rows, A.n_rows); | | U.eye(A.n_rows, A.n_rows); | |
| S.reset(); | | S.reset(); | |
| V.eye(A.n_cols, A.n_cols); | | V.eye(A.n_cols, A.n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| U.set_size(A.n_rows, A.n_rows); | | U.set_size(A.n_rows, A.n_rows); | |
| V.set_size(A.n_cols, A.n_cols); | | V.set_size(A.n_cols, A.n_cols); | |
| | | | |
| char jobu = 'A'; | | char jobu = 'A'; | |
| char jobvt = 'A'; | | char jobvt = 'A'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| skipping to change at line 2404 | | skipping to change at line 2464 | |
| inline | | inline | |
| bool | | bool | |
| auxlib::svd_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X,
const char mode) | | auxlib::svd_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>& X,
const char mode) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| S.set_size( static_cast<uword>(min_mn) ); | | S.set_size( static_cast<uword>(min_mn) ); | |
| | | | |
| blas_int ldu = 0; | | blas_int ldu = 0; | |
| blas_int ldvt = 0; | | blas_int ldvt = 0; | |
| | | | |
| | | | |
| skipping to change at line 2542 | | skipping to change at line 2604 | |
| auxlib::svd_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T>
>& V, const Base< std::complex<T>, T1>& X, const char mode) | | auxlib::svd_econ(Mat< std::complex<T> >& U, Col<T>& S, Mat< std::complex<T>
>& V, const Base< std::complex<T>, T1>& X, const char mode) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
| typedef std::complex<T> eT; | | typedef std::complex<T> eT; | |
| | | | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| S.set_size( static_cast<uword>(min_mn) ); | | S.set_size( static_cast<uword>(min_mn) ); | |
| | | | |
| blas_int ldu = 0; | | blas_int ldu = 0; | |
| blas_int ldvt = 0; | | blas_int ldvt = 0; | |
| | | | |
| | | | |
| skipping to change at line 2691 | | skipping to change at line 2755 | |
| | | | |
| X_n_rows = A.n_rows; | | X_n_rows = A.n_rows; | |
| X_n_cols = A.n_cols; | | X_n_cols = A.n_cols; | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| S.reset(); | | S.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| Mat<eT> U(1, 1); | | Mat<eT> U(1, 1); | |
| Mat<eT> V(1, 1); | | Mat<eT> V(1, 1); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| blas_int ldu = blas_int(U.n_rows); | | blas_int ldu = blas_int(U.n_rows); | |
| | | | |
| skipping to change at line 2760 | | skipping to change at line 2826 | |
| | | | |
| X_n_rows = A.n_rows; | | X_n_rows = A.n_rows; | |
| X_n_cols = A.n_cols; | | X_n_cols = A.n_cols; | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| S.reset(); | | S.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| Mat<eT> U(1, 1); | | Mat<eT> U(1, 1); | |
| Mat<eT> V(1, 1); | | Mat<eT> V(1, 1); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| blas_int ldu = blas_int(U.n_rows); | | blas_int ldu = blas_int(U.n_rows); | |
| | | | |
| skipping to change at line 2844 | | skipping to change at line 2912 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| U.eye(A.n_rows, A.n_rows); | | U.eye(A.n_rows, A.n_rows); | |
| S.reset(); | | S.reset(); | |
| V.eye(A.n_cols, A.n_cols); | | V.eye(A.n_cols, A.n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| U.set_size(A.n_rows, A.n_rows); | | U.set_size(A.n_rows, A.n_rows); | |
| V.set_size(A.n_cols, A.n_cols); | | V.set_size(A.n_cols, A.n_cols); | |
| | | | |
| char jobz = 'A'; | | char jobz = 'A'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int max_mn = (std::max)(m,n); | | blas_int max_mn = (std::max)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| skipping to change at line 2916 | | skipping to change at line 2986 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| U.eye(A.n_rows, A.n_rows); | | U.eye(A.n_rows, A.n_rows); | |
| S.reset(); | | S.reset(); | |
| V.eye(A.n_cols, A.n_cols); | | V.eye(A.n_cols, A.n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| U.set_size(A.n_rows, A.n_rows); | | U.set_size(A.n_rows, A.n_rows); | |
| V.set_size(A.n_cols, A.n_cols); | | V.set_size(A.n_cols, A.n_cols); | |
| | | | |
| char jobz = 'A'; | | char jobz = 'A'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int max_mn = (std::max)(m,n); | | blas_int max_mn = (std::max)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| | | | |
| skipping to change at line 2974 | | skipping to change at line 3046 | |
| inline | | inline | |
| bool | | bool | |
| auxlib::svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>&
X) | | auxlib::svd_dc_econ(Mat<eT>& U, Col<eT>& S, Mat<eT>& V, const Base<eT,T1>&
X) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| char jobz = 'S'; | | char jobz = 'S'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int max_mn = (std::max)(m,n); | | blas_int max_mn = (std::max)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| blas_int ldu = m; | | blas_int ldu = m; | |
| blas_int ldvt = min_mn; | | blas_int ldvt = min_mn; | |
| blas_int lwork1 = 3*min_mn*min_mn + (std::max)( max_mn, 4*min_mn*min_mn
+ 4*min_mn ); | | blas_int lwork1 = 3*min_mn*min_mn + (std::max)( max_mn, 4*min_mn*min_mn
+ 4*min_mn ); | |
| | | | |
| skipping to change at line 3047 | | skipping to change at line 3121 | |
| arma_extra_debug_print("auxlib::svd_dc_econ(): redirecting to auxlib::s
vd_econ(), as use of lapack::cx_gesdd() is disabled"); | | arma_extra_debug_print("auxlib::svd_dc_econ(): redirecting to auxlib::s
vd_econ(), as use of lapack::cx_gesdd() is disabled"); | |
| | | | |
| return auxlib::svd_econ(U, S, V, X, 'b'); | | return auxlib::svd_econ(U, S, V, X, 'b'); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
| typedef std::complex<T> eT; | | typedef std::complex<T> eT; | |
| | | | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| char jobz = 'S'; | | char jobz = 'S'; | |
| | | | |
| blas_int m = blas_int(A.n_rows); | | blas_int m = blas_int(A.n_rows); | |
| blas_int n = blas_int(A.n_cols); | | blas_int n = blas_int(A.n_cols); | |
| blas_int min_mn = (std::min)(m,n); | | blas_int min_mn = (std::min)(m,n); | |
| blas_int max_mn = (std::max)(m,n); | | blas_int max_mn = (std::max)(m,n); | |
| blas_int lda = blas_int(A.n_rows); | | blas_int lda = blas_int(A.n_rows); | |
| blas_int ldu = m; | | blas_int ldu = m; | |
| blas_int ldvt = min_mn; | | blas_int ldvt = min_mn; | |
| blas_int lwork = 2 * (min_mn*min_mn + 2*min_mn + max_mn); | | blas_int lwork = 2 * (min_mn*min_mn + 2*min_mn + max_mn); | |
| | | | |
| skipping to change at line 3163 | | skipping to change at line 3239 | |
| arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | | arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | |
| | | | |
| if(A.is_empty() || out.is_empty()) | | if(A.is_empty() || out.is_empty()) | |
| { | | { | |
| out.zeros(A.n_cols, B_n_cols); | | out.zeros(A.n_cols, B_n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_ATLAS) | | #if defined(ARMA_USE_ATLAS) | |
| { | | { | |
|
| | | arma_debug_assert_atlas_size(A); | |
| | | | |
| podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions o
f Atlas might be trashing memory | | podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions o
f Atlas might be trashing memory | |
| | | | |
| int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B_
n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows); | | int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B_
n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #elif defined(ARMA_USE_LAPACK) | | #elif defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| blas_int n = blas_int(A_n_rows); // assuming A is square | | blas_int n = blas_int(A_n_rows); // assuming A is square | |
| blas_int lda = blas_int(A_n_rows); | | blas_int lda = blas_int(A_n_rows); | |
| blas_int ldb = blas_int(A_n_rows); | | blas_int ldb = blas_int(A_n_rows); | |
| blas_int nrhs = blas_int(B_n_cols); | | blas_int nrhs = blas_int(B_n_cols); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| podarray<blas_int> ipiv(A_n_rows + 2); // +2 for paranoia: some vers
ions of Lapack might be trashing memory | | podarray<blas_int> ipiv(A_n_rows + 2); // +2 for paranoia: some vers
ions of Lapack might be trashing memory | |
| | | | |
| arma_extra_debug_print("lapack::gesv()"); | | arma_extra_debug_print("lapack::gesv()"); | |
| lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memp
tr(), &ldb, &info); | | lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memp
tr(), &ldb, &info); | |
| | | | |
| skipping to change at line 3226 | | skipping to change at line 3306 | |
| arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | | arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | |
| | | | |
| out.set_size(A_n_cols, B_n_cols); | | out.set_size(A_n_cols, B_n_cols); | |
| | | | |
| if(A.is_empty() || tmp.is_empty()) | | if(A.is_empty() || tmp.is_empty()) | |
| { | | { | |
| out.zeros(); | | out.zeros(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A,tmp); | |
| | | | |
| char trans = 'N'; | | char trans = 'N'; | |
| | | | |
| blas_int m = blas_int(A_n_rows); | | blas_int m = blas_int(A_n_rows); | |
| blas_int n = blas_int(A_n_cols); | | blas_int n = blas_int(A_n_cols); | |
| blas_int lda = blas_int(A_n_rows); | | blas_int lda = blas_int(A_n_rows); | |
| blas_int ldb = blas_int(A_n_rows); | | blas_int ldb = blas_int(A_n_rows); | |
| blas_int nrhs = blas_int(B_n_cols); | | blas_int nrhs = blas_int(B_n_cols); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), n + (std::max)(n, nrhs)
) ); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), n + (std::max)(n, nrhs)
) ); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| | | | |
| skipping to change at line 3295 | | skipping to change at line 3377 | |
| | | | |
| arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | | arma_debug_check( (A_n_rows != B_n_rows), "solve(): number of rows in t
he given objects must be the same" ); | |
| | | | |
| // B could be an alias of "out", hence we need to check whether B is em
pty before setting the size of "out" | | // B could be an alias of "out", hence we need to check whether B is em
pty before setting the size of "out" | |
| if(A.is_empty() || B.is_empty()) | | if(A.is_empty() || B.is_empty()) | |
| { | | { | |
| out.zeros(A_n_cols, B_n_cols); | | out.zeros(A_n_cols, B_n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A,B); | |
| | | | |
| char trans = 'N'; | | char trans = 'N'; | |
| | | | |
| blas_int m = blas_int(A_n_rows); | | blas_int m = blas_int(A_n_rows); | |
| blas_int n = blas_int(A_n_cols); | | blas_int n = blas_int(A_n_cols); | |
| blas_int lda = blas_int(A_n_rows); | | blas_int lda = blas_int(A_n_rows); | |
| blas_int ldb = blas_int(A_n_cols); | | blas_int ldb = blas_int(A_n_cols); | |
| blas_int nrhs = blas_int(B_n_cols); | | blas_int nrhs = blas_int(B_n_cols); | |
| blas_int lwork = 3 * ( (std::max)(blas_int(1), m + (std::max)(m,nrhs))
); | | blas_int lwork = 3 * ( (std::max)(blas_int(1), m + (std::max)(m,nrhs))
); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| | | | |
| skipping to change at line 3366 | | skipping to change at line 3450 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
| if(A.is_empty() || B.is_empty()) | | if(A.is_empty() || B.is_empty()) | |
| { | | { | |
| out.zeros(A.n_cols, B.n_cols); | | out.zeros(A.n_cols, B.n_cols); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A,B); | |
| | | | |
| out = B; | | out = B; | |
| | | | |
| char uplo = (layout == 0) ? 'U' : 'L'; | | char uplo = (layout == 0) ? 'U' : 'L'; | |
| char trans = 'N'; | | char trans = 'N'; | |
| char diag = 'N'; | | char diag = 'N'; | |
| blas_int n = blas_int(A.n_rows); | | blas_int n = blas_int(A.n_rows); | |
| blas_int nrhs = blas_int(B.n_cols); | | blas_int nrhs = blas_int(B.n_cols); | |
| blas_int info = 0; | | blas_int info = 0; | |
| | | | |
| lapack::trtrs<eT>(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out.
memptr(), &n, &info); | | lapack::trtrs<eT>(&uplo, &trans, &diag, &n, &nrhs, A.memptr(), &n, out.
memptr(), &n, &info); | |
| | | | |
| skipping to change at line 3412 | | skipping to change at line 3498 | |
| { | | { | |
| arma_debug_check( (A.is_square() == false), "schur_dec(): given matrix
is not square" ); | | arma_debug_check( (A.is_square() == false), "schur_dec(): given matrix
is not square" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| Z.reset(); | | Z.reset(); | |
| T.reset(); | | T.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| Z.set_size(A_n_rows, A_n_rows); | | Z.set_size(A_n_rows, A_n_rows); | |
| T = A; | | T = A; | |
| | | | |
| char jobvs = 'V'; // get Schur vectors (Z) | | char jobvs = 'V'; // get Schur vectors (Z) | |
| char sort = 'N'; // do not sort eigenvalues/vecto
rs | | char sort = 'N'; // do not sort eigenvalues/vecto
rs | |
| blas_int* select = 0; // pointer to sorting function | | blas_int* select = 0; // pointer to sorting function | |
| blas_int n = blas_int(A_n_rows); | | blas_int n = blas_int(A_n_rows); | |
| blas_int sdim = 0; // output for sorting | | blas_int sdim = 0; // output for sorting | |
| | | | |
| skipping to change at line 3465 | | skipping to change at line 3553 | |
| { | | { | |
| arma_debug_check( (A.is_square() == false), "schur_dec(): matrix A is n
ot square" ); | | arma_debug_check( (A.is_square() == false), "schur_dec(): matrix A is n
ot square" ); | |
| | | | |
| if(A.is_empty()) | | if(A.is_empty()) | |
| { | | { | |
| Z.reset(); | | Z.reset(); | |
| T.reset(); | | T.reset(); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
|
| | | arma_debug_assert_blas_size(A); | |
| | | | |
| typedef std::complex<cT> eT; | | typedef std::complex<cT> eT; | |
| | | | |
| const uword A_n_rows = A.n_rows; | | const uword A_n_rows = A.n_rows; | |
| | | | |
| Z.set_size(A_n_rows, A_n_rows); | | Z.set_size(A_n_rows, A_n_rows); | |
| T = A; | | T = A; | |
| | | | |
| char jobvs = 'V'; // get Schur vectors (Z) | | char jobvs = 'V'; // get Schur vectors (Z) | |
| char sort = 'N'; // do not sort eigenvalues/vect
ors | | char sort = 'N'; // do not sort eigenvalues/vect
ors | |
| blas_int* select = 0; // pointer to sorting function | | blas_int* select = 0; // pointer to sorting function | |
| | | | |
End of changes. 44 change blocks. |
| 2 lines changed or deleted | | 94 lines changed or added | |
|
| diskio_meat.hpp | | diskio_meat.hpp | |
| | | | |
| skipping to change at line 1520 | | skipping to change at line 1520 | |
| | | | |
| //! Load a matrix in text format (human readable), | | //! Load a matrix in text format (human readable), | |
| //! with a header that indicates the matrix type as well as its dimensions | | //! with a header that indicates the matrix type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_ascii(Mat<eT>& x, std::istream& f, std::string& err_msg) | | diskio::load_arma_ascii(Mat<eT>& x, std::istream& f, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | std::streampos pos = f.tellg(); | |
| | | | |
| bool load_okay = true; | | bool load_okay = true; | |
| | | | |
| std::string f_header; | | std::string f_header; | |
| uword f_n_rows; | | uword f_n_rows; | |
| uword f_n_cols; | | uword f_n_cols; | |
| | | | |
| f >> f_header; | | f >> f_header; | |
| f >> f_n_rows; | | f >> f_n_rows; | |
| f >> f_n_cols; | | f >> f_n_cols; | |
| | | | |
| | | | |
| skipping to change at line 1568 | | skipping to change at line 1570 | |
| } | | } | |
| | | | |
| load_okay = f.good(); | | load_okay = f.good(); | |
| } | | } | |
| else | | else | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| err_msg = "incorrect header in "; | | err_msg = "incorrect header in "; | |
| } | | } | |
| | | | |
|
| | | // allow automatic conversion of u32/s32 matrices into u64/s64 matrices | |
| | | | |
| | | if(load_okay == false) | |
| | | { | |
| | | if( (sizeof(eT) == 8) && is_same_type<uword,eT>::yes ) | |
| | | { | |
| | | Mat<u32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_ascii(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Mat<eT> >::from(tmp); } | |
| | | } | |
| | | else | |
| | | if( (sizeof(eT) == 8) && is_same_type<sword,eT>::yes ) | |
| | | { | |
| | | Mat<s32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_ascii(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Mat<eT> >::from(tmp); } | |
| | | } | |
| | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| //! Load a matrix in CSV text format (human readable) | | //! Load a matrix in CSV text format (human readable) | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_csv_ascii(Mat<eT>& x, const std::string& name, std::string& er
r_msg) | | diskio::load_csv_ascii(Mat<eT>& x, const std::string& name, std::string& er
r_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 1726 | | skipping to change at line 1759 | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_binary(Mat<eT>& x, std::istream& f, std::string& err_msg) | | diskio::load_arma_binary(Mat<eT>& x, std::istream& f, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | std::streampos pos = f.tellg(); | |
| | | | |
| bool load_okay = true; | | bool load_okay = true; | |
| | | | |
| std::string f_header; | | std::string f_header; | |
| uword f_n_rows; | | uword f_n_rows; | |
| uword f_n_cols; | | uword f_n_cols; | |
| | | | |
| f >> f_header; | | f >> f_header; | |
| f >> f_n_rows; | | f >> f_n_rows; | |
| f >> f_n_cols; | | f >> f_n_cols; | |
| | | | |
| | | | |
| skipping to change at line 1752 | | skipping to change at line 1787 | |
| f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem*
sizeof(eT)) ); | | f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem*
sizeof(eT)) ); | |
| | | | |
| load_okay = f.good(); | | load_okay = f.good(); | |
| } | | } | |
| else | | else | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| err_msg = "incorrect header in "; | | err_msg = "incorrect header in "; | |
| } | | } | |
| | | | |
|
| | | // allow automatic conversion of u32/s32 matrices into u64/s64 matrices | |
| | | | |
| | | if(load_okay == false) | |
| | | { | |
| | | if( (sizeof(eT) == 8) && is_same_type<uword,eT>::yes ) | |
| | | { | |
| | | Mat<u32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_binary(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Mat<eT> >::from(tmp); } | |
| | | } | |
| | | else | |
| | | if( (sizeof(eT) == 8) && is_same_type<sword,eT>::yes ) | |
| | | { | |
| | | Mat<s32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_binary(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Mat<eT> >::from(tmp); } | |
| | | } | |
| | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| inline | | inline | |
| void | | void | |
| diskio::pnm_skip_comments(std::istream& f) | | diskio::pnm_skip_comments(std::istream& f) | |
| { | | { | |
| while( isspace(f.peek()) ) | | while( isspace(f.peek()) ) | |
| { | | { | |
| while( isspace(f.peek()) ) | | while( isspace(f.peek()) ) | |
| | | | |
| skipping to change at line 2908 | | skipping to change at line 2974 | |
| f >> f_n_nz; | | f >> f_n_nz; | |
| | | | |
| //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win
dows machine a newline could be two characters | | //f.seekg(1, ios::cur); // NOTE: this may not be portable, as on a Win
dows machine a newline could be two characters | |
| f.get(); | | f.get(); | |
| | | | |
| x.set_size(f_n_rows, f_n_cols); | | x.set_size(f_n_rows, f_n_cols); | |
| | | | |
| x.mem_resize(f_n_nz); | | x.mem_resize(f_n_nz); | |
| | | | |
| f.read( reinterpret_cast<char*>(access::rwp(x.values)), std::strea
msize(x.n_nonzero*sizeof(eT)) ); | | f.read( reinterpret_cast<char*>(access::rwp(x.values)), std::strea
msize(x.n_nonzero*sizeof(eT)) ); | |
|
| | | | |
| | | std::streampos pos = f.tellg(); | |
| | | | |
| f.read( reinterpret_cast<char*>(access::rwp(x.row_indices)), std::strea
msize(x.n_nonzero*sizeof(uword)) ); | | f.read( reinterpret_cast<char*>(access::rwp(x.row_indices)), std::strea
msize(x.n_nonzero*sizeof(uword)) ); | |
| f.read( reinterpret_cast<char*>(access::rwp(x.col_ptrs)), std::strea
msize((x.n_cols+1)*sizeof(uword)) ); | | f.read( reinterpret_cast<char*>(access::rwp(x.col_ptrs)), std::strea
msize((x.n_cols+1)*sizeof(uword)) ); | |
| | | | |
|
| bool check1 = true; | | bool check1 = true; for(uword i=0; i < x.n_nonzero; ++i) { if(x.value | |
| | | s[i] == eT(0)) { check1 = false; break; } } | |
| | | bool check2 = true; for(uword i=0; i < x.n_cols; ++i) { if(x.col_p | |
| | | trs[i+1] < x.col_ptrs[i]) { check2 = false; break; } } | |
| | | bool check3 = (x.col_ptrs[x.n_cols] == x.n_nonzero); | |
| | | | |
|
| for(uword i=0; i < x.n_nonzero; ++i) | | if((check1 == true) && ((check2 == false) || (check3 == false))) | |
| { | | { | |
|
| if(x.values[i] == eT(0)) { check1 = false; break; } | | if(sizeof(uword) == 8) | |
| } | | { | |
| | | arma_extra_debug_print("detected inconsistent data while loading; r | |
| | | e-reading integer parts as u32"); | |
| | | | |
|
| bool check2 = true; | | // inconstency could be due to a different uword size used during s | |
| | | aving, | |
| | | // so try loading the row_indices and col_ptrs under the assumption | |
| | | of 32 bit unsigned integers | |
| | | | |
|
| for(uword i=0; i < x.n_cols; ++i) | | f.clear(); | |
| { | | f.seekg(pos); | |
| if(x.col_ptrs[i+1] < x.col_ptrs[i]) { check2 = false; break; } | | | |
| } | | podarray<u32> tmp_a(x.n_nonzero ); tmp_a.zeros(); | |
| | | podarray<u32> tmp_b(x.n_cols + 1); tmp_b.zeros(); | |
| | | | |
| | | f.read( reinterpret_cast<char*>(tmp_a.memptr()), std::streamsize( x | |
| | | .n_nonzero * sizeof(u32)) ); | |
| | | f.read( reinterpret_cast<char*>(tmp_b.memptr()), std::streamsize((x | |
| | | .n_cols + 1) * sizeof(u32)) ); | |
| | | | |
| | | check2 = true; for(uword i=0; i < x.n_cols; ++i) { if(tmp_b[i+1] | |
| | | < tmp_b[i]) { check2 = false; break; } } | |
| | | check3 = (tmp_b[x.n_cols] == x.n_nonzero); | |
| | | | |
|
| const bool check3 = (x.col_ptrs[x.n_cols] == x.n_nonzero); | | load_okay = f.good(); | |
| | | | |
| | | if( load_okay && (check2 == true) && (check3 == true) ) | |
| | | { | |
| | | arma_extra_debug_print("reading integer parts as u32 succeeded"); | |
| | | | |
| | | arrayops::convert(access::rwp(x.row_indices), tmp_a.memptr(), x.n | |
| | | _nonzero ); | |
| | | arrayops::convert(access::rwp(x.col_ptrs), tmp_b.memptr(), x.n | |
| | | _cols + 1); | |
| | | } | |
| | | else | |
| | | { | |
| | | arma_extra_debug_print("reading integer parts as u32 failed"); | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| if((check1 == false) || (check2 == false) || (check3 == false)) | | if((check1 == false) || (check2 == false) || (check3 == false)) | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| err_msg = "inconsistent data in "; | | err_msg = "inconsistent data in "; | |
| } | | } | |
| else | | else | |
| { | | { | |
| load_okay = f.good(); | | load_okay = f.good(); | |
| } | | } | |
| | | | |
| skipping to change at line 3401 | | skipping to change at line 3495 | |
| | | | |
| //! Load a cube in text format (human readable), | | //! Load a cube in text format (human readable), | |
| //! with a header that indicates the cube type as well as its dimensions | | //! with a header that indicates the cube type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_ascii(Cube<eT>& x, std::istream& f, std::string& err_msg) | | diskio::load_arma_ascii(Cube<eT>& x, std::istream& f, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | std::streampos pos = f.tellg(); | |
| | | | |
| bool load_okay = true; | | bool load_okay = true; | |
| | | | |
| std::string f_header; | | std::string f_header; | |
| uword f_n_rows; | | uword f_n_rows; | |
| uword f_n_cols; | | uword f_n_cols; | |
| uword f_n_slices; | | uword f_n_slices; | |
| | | | |
| f >> f_header; | | f >> f_header; | |
| f >> f_n_rows; | | f >> f_n_rows; | |
| f >> f_n_cols; | | f >> f_n_cols; | |
| | | | |
| skipping to change at line 3436 | | skipping to change at line 3532 | |
| } | | } | |
| | | | |
| load_okay = f.good(); | | load_okay = f.good(); | |
| } | | } | |
| else | | else | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| err_msg = "incorrect header in "; | | err_msg = "incorrect header in "; | |
| } | | } | |
| | | | |
|
| | | // allow automatic conversion of u32/s32 cubes into u64/s64 cubes | |
| | | | |
| | | if(load_okay == false) | |
| | | { | |
| | | if( (sizeof(eT) == 8) && is_same_type<uword,eT>::yes ) | |
| | | { | |
| | | Cube<u32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_ascii(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Cube<eT> >::from(tmp); } | |
| | | } | |
| | | else | |
| | | if( (sizeof(eT) == 8) && is_same_type<sword,eT>::yes ) | |
| | | { | |
| | | Cube<s32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_ascii(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Cube<eT> >::from(tmp); } | |
| | | } | |
| | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| //! Load a cube in binary format, | | //! Load a cube in binary format, | |
| //! with a header that indicates the cube type as well as its dimensions | | //! with a header that indicates the cube type as well as its dimensions | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_binary(Cube<eT>& x, const std::string& name, std::string&
err_msg) | | diskio::load_arma_binary(Cube<eT>& x, const std::string& name, std::string&
err_msg) | |
| { | | { | |
| | | | |
| skipping to change at line 3469 | | skipping to change at line 3596 | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_arma_binary(Cube<eT>& x, std::istream& f, std::string& err_msg
) | | diskio::load_arma_binary(Cube<eT>& x, std::istream& f, std::string& err_msg
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| | | std::streampos pos = f.tellg(); | |
| | | | |
| bool load_okay = true; | | bool load_okay = true; | |
| | | | |
| std::string f_header; | | std::string f_header; | |
| uword f_n_rows; | | uword f_n_rows; | |
| uword f_n_cols; | | uword f_n_cols; | |
| uword f_n_slices; | | uword f_n_slices; | |
| | | | |
| f >> f_header; | | f >> f_header; | |
| f >> f_n_rows; | | f >> f_n_rows; | |
| f >> f_n_cols; | | f >> f_n_cols; | |
| | | | |
| skipping to change at line 3497 | | skipping to change at line 3626 | |
| f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem*
sizeof(eT)) ); | | f.read( reinterpret_cast<char *>(x.memptr()), std::streamsize(x.n_elem*
sizeof(eT)) ); | |
| | | | |
| load_okay = f.good(); | | load_okay = f.good(); | |
| } | | } | |
| else | | else | |
| { | | { | |
| load_okay = false; | | load_okay = false; | |
| err_msg = "incorrect header in "; | | err_msg = "incorrect header in "; | |
| } | | } | |
| | | | |
|
| | | // allow automatic conversion of u32/s32 cubes into u64/s64 cubes | |
| | | | |
| | | if(load_okay == false) | |
| | | { | |
| | | if( (sizeof(eT) == 8) && is_same_type<uword,eT>::yes ) | |
| | | { | |
| | | Cube<u32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_binary(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Cube<eT> >::from(tmp); } | |
| | | } | |
| | | else | |
| | | if( (sizeof(eT) == 8) && is_same_type<sword,eT>::yes ) | |
| | | { | |
| | | Cube<s32> tmp; | |
| | | std::string junk; | |
| | | | |
| | | f.clear(); | |
| | | f.seekg(pos); | |
| | | | |
| | | load_okay = diskio::load_arma_binary(tmp, f, junk); | |
| | | | |
| | | if(load_okay) { x = conv_to< Cube<eT> >::from(tmp); } | |
| | | } | |
| | | } | |
| | | | |
| return load_okay; | | return load_okay; | |
| } | | } | |
| | | | |
| //! Load a HDF5 file as a cube | | //! Load a HDF5 file as a cube | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_hdf5_binary(Cube<eT>& x, const std::string& name, std::string&
err_msg) | | diskio::load_hdf5_binary(Cube<eT>& x, const std::string& name, std::string&
err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
End of changes. 15 change blocks. |
| 10 lines changed or deleted | | 180 lines changed or added | |
|
| fn_sort_index.hpp | | fn_sort_index.hpp | |
|
| // Copyright (C) 2009-2014 Conrad Sanderson | | // Copyright (C) 2009-2015 Conrad Sanderson | |
| // Copyright (C) 2009-2014 NICTA (www.nicta.com.au) | | // Copyright (C) 2009-2015 NICTA (www.nicta.com.au) | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup fn_sort_index | | //! \addtogroup fn_sort_index | |
| //! @{ | | //! @{ | |
| | | | |
|
| template<typename T1, typename T2> | | | |
| struct arma_sort_index_packet | | | |
| { | | | |
| T1 val; | | | |
| T2 index; | | | |
| }; | | | |
| | | | |
| class arma_sort_index_helper_ascend | | | |
| { | | | |
| public: | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| arma_inline | | | |
| bool | | | |
| operator() (const arma_sort_index_packet<T1,T2>& A, const arma_sort_index | | | |
| _packet<T1,T2>& B) const | | | |
| { | | | |
| return (A.val < B.val); | | | |
| } | | | |
| }; | | | |
| | | | |
| class arma_sort_index_helper_descend | | | |
| { | | | |
| public: | | | |
| | | | |
| template<typename T1, typename T2> | | | |
| arma_inline | | | |
| bool | | | |
| operator() (const arma_sort_index_packet<T1,T2>& A, const arma_sort_index | | | |
| _packet<T1,T2>& B) const | | | |
| { | | | |
| return (A.val > B.val); | | | |
| } | | | |
| }; | | | |
| | | | |
| template<typename umat_elem_type, typename eT, const uword sort_type, const | | | |
| uword sort_stable> | | | |
| void | | | |
| inline | | | |
| sort_index_helper(umat_elem_type* out_mem, const eT* in_mem, const uword n_ | | | |
| elem, typename arma_not_cx<eT>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| arma_ignore(junk); | | | |
| | | | |
| std::vector< arma_sort_index_packet<eT, umat_elem_type> > packet_vec(n_el | | | |
| em); | | | |
| | | | |
| for(uword i=0; i<n_elem; ++i) | | | |
| { | | | |
| packet_vec[i].val = in_mem[i]; | | | |
| packet_vec[i].index = i; | | | |
| } | | | |
| | | | |
| if(sort_type == 0) | | | |
| { | | | |
| // ascend | | | |
| | | | |
| arma_sort_index_helper_ascend comparator; | | | |
| | | | |
| if(sort_stable == 0) | | | |
| { | | | |
| std::sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| else | | | |
| { | | | |
| std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| } | | | |
| else | | | |
| { | | | |
| // descend | | | |
| | | | |
| arma_sort_index_helper_descend comparator; | | | |
| | | | |
| if(sort_stable == 0) | | | |
| { | | | |
| std::sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| else | | | |
| { | | | |
| std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| } | | | |
| | | | |
| for(uword i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = packet_vec[i].index; | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename umat_elem_type, typename eT, const uword sort_type, const | | | |
| uword sort_stable> | | | |
| void | | | |
| inline | | | |
| sort_index_helper(umat_elem_type* out_mem, const eT* in_mem, const uword n_ | | | |
| elem, typename arma_cx_only<eT>::result* junk = 0) | | | |
| { | | | |
| arma_extra_debug_sigprint(); | | | |
| arma_ignore(junk); | | | |
| | | | |
| typedef typename get_pod_type<eT>::result T; | | | |
| | | | |
| std::vector< arma_sort_index_packet<T, umat_elem_type> > packet_vec(n_ele | | | |
| m); | | | |
| | | | |
| for(uword i=0; i<n_elem; ++i) | | | |
| { | | | |
| packet_vec[i].val = std::abs(in_mem[i]); | | | |
| packet_vec[i].index = i; | | | |
| } | | | |
| | | | |
| if(sort_type == 0) | | | |
| { | | | |
| // ascend | | | |
| | | | |
| arma_sort_index_helper_ascend comparator; | | | |
| | | | |
| if(sort_stable == 0) | | | |
| { | | | |
| std::sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| else | | | |
| { | | | |
| std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| } | | | |
| else | | | |
| { | | | |
| // descend | | | |
| | | | |
| arma_sort_index_helper_descend comparator; | | | |
| | | | |
| if(sort_stable == 0) | | | |
| { | | | |
| std::sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| else | | | |
| { | | | |
| std::stable_sort( packet_vec.begin(), packet_vec.end(), comparator ); | | | |
| } | | | |
| } | | | |
| | | | |
| for(uword i=0; i<n_elem; ++i) | | | |
| { | | | |
| out_mem[i] = packet_vec[i].index; | | | |
| } | | | |
| } | | | |
| | | | |
| //! kept for compatibility with old code | | //! kept for compatibility with old code | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<uword,T1,op_sort_index> | |
| sort_index | | sort_index | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const uword sort_type = 0 | | const uword sort_type = 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | arma_debug_check( (sort_type > 1), "sort_index(): sort_type must be 0 or | |
| typedef typename umat::elem_type out_elem_type; | | 1"); | |
| | | | |
|
| const unwrap<T1> tmp(X.get_ref()); | | return mtOp<uword,T1,op_sort_index>(X.get_ref(), sort_type, uword(0)); | |
| const Mat<eT>& A = tmp.M; | | | |
| | | | |
| umat out; | | | |
| | | | |
| if(A.is_empty() == false) | | | |
| { | | | |
| arma_debug_check( (A.is_vec() == false), "sort_index(): currently only | | | |
| handles vectors"); | | | |
| | | | |
| out.set_size(A.n_rows, A.n_cols); | | | |
| | | | |
| if(sort_type == 0) | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 0, 0>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| else | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 1, 0>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! kept for compatibility with old code | | //! kept for compatibility with old code | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
|
| umat | | const mtOp<uword,T1,op_stable_sort_index> | |
| stable_sort_index | | stable_sort_index | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const uword sort_type = 0 | | const uword sort_type = 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | arma_debug_check( (sort_type > 1), "stable_sort_index(): sort_type must b | |
| typedef typename umat::elem_type out_elem_type; | | e 0 or 1"); | |
| | | | |
| const unwrap<T1> tmp(X.get_ref()); | | | |
| const Mat<eT>& A = tmp.M; | | | |
| | | | |
| umat out; | | | |
| | | | |
|
| if(A.is_empty() == false) | | return mtOp<uword,T1,op_stable_sort_index>(X.get_ref(), sort_type, uword( | |
| { | | 0)); | |
| arma_debug_check( (A.is_vec() == false), "stable_sort_index(): currentl | | | |
| y only handles vectors"); | | | |
| | | | |
| out.set_size(A.n_rows, A.n_cols); | | | |
| | | | |
| if(sort_type == 0) | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 0, 1>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| else | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 1, 1>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| typename | | typename | |
| enable_if2 | | enable_if2 | |
| < | | < | |
| ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value ==
true) ), | | ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value ==
true) ), | |
|
| umat | | const mtOp<uword,T1,op_sort_index> | |
| >::result | | >::result | |
| sort_index | | sort_index | |
| ( | | ( | |
| const T1& X, | | const T1& X, | |
| const T2* sort_direction | | const T2* sort_direction | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | | |
| typedef typename umat::elem_type out_elem_type; | | | |
| | | | |
| const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0); | | const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 'a') && (sig != 'd')), "sort_index(): unknown
sort direction" ); | | arma_debug_check( ((sig != 'a') && (sig != 'd')), "sort_index(): unknown
sort direction" ); | |
| | | | |
|
| const unwrap<T1> tmp(X); | | return mtOp<uword,T1,op_sort_index>(X, ((sig == 'a') ? uword(0) : uword(1 | |
| const Mat<eT>& A = tmp.M; | | )), uword(0)); | |
| | | | |
| umat out; | | | |
| | | | |
| if(A.is_empty() == false) | | | |
| { | | | |
| arma_debug_check( (A.is_vec() == false), "sort_index(): currently only | | | |
| handles vectors"); | | | |
| | | | |
| out.set_size(A.n_rows, A.n_cols); | | | |
| | | | |
| if(sig == 'a') | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 0, 0>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| else | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 1, 0>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| typename | | typename | |
| enable_if2 | | enable_if2 | |
| < | | < | |
| ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value ==
true) ), | | ( (is_arma_type<T1>::value == true) && (is_same_type<T2, char>::value ==
true) ), | |
|
| umat | | const mtOp<uword,T1,op_stable_sort_index> | |
| >::result | | >::result | |
| stable_sort_index | | stable_sort_index | |
| ( | | ( | |
| const T1& X, | | const T1& X, | |
| const T2* sort_direction | | const T2* sort_direction | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| typedef typename T1::elem_type eT; | | | |
| typedef typename umat::elem_type out_elem_type; | | | |
| | | | |
| const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0); | | const char sig = (sort_direction != NULL) ? sort_direction[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 'a') && (sig != 'd')), "stable_sort_index(): u
nknown sort direction" ); | | arma_debug_check( ((sig != 'a') && (sig != 'd')), "stable_sort_index(): u
nknown sort direction" ); | |
| | | | |
|
| const unwrap<T1> tmp(X); | | return mtOp<uword,T1,op_stable_sort_index>(X, ((sig == 'a') ? uword(0) : | |
| const Mat<eT>& A = tmp.M; | | uword(1)), uword(0)); | |
| | | | |
| umat out; | | | |
| | | | |
| if(A.is_empty() == false) | | | |
| { | | | |
| arma_debug_check( (A.is_vec() == false), "stable_sort_index(): currentl | | | |
| y only handles vectors"); | | | |
| | | | |
| out.set_size(A.n_rows, A.n_cols); | | | |
| | | | |
| if(sig == 'a') | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 0, 1>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| else | | | |
| { | | | |
| sort_index_helper<out_elem_type, eT, 1, 1>(out.memptr(), A.mem, A.n_e | | | |
| lem); | | | |
| } | | | |
| } | | | |
| | | | |
| return out; | | | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 14 change blocks. |
| 265 lines changed or deleted | | 17 lines changed or added | |
|
| sp_auxlib_meat.hpp | | sp_auxlib_meat.hpp | |
|
| // Copyright (C) 2013-2014 Ryan Curtin | | // Copyright (C) 2013-2015 Ryan Curtin | |
| // Copyright (C) 2013-2014 Conrad Sanderson | | // Copyright (C) 2013-2015 Conrad Sanderson | |
| // Copyright (C) 2013-2014 NICTA | | // Copyright (C) 2013-2015 NICTA | |
| // | | // | |
| // This Source Code Form is subject to the terms of the Mozilla Public | | // This Source Code Form is subject to the terms of the Mozilla Public | |
| // License, v. 2.0. If a copy of the MPL was not distributed with this | | // License, v. 2.0. If a copy of the MPL was not distributed with this | |
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
| | | | |
| //! \addtogroup sp_auxlib | | //! \addtogroup sp_auxlib | |
| //! @{ | | //! @{ | |
| | | | |
| inline | | inline | |
| sp_auxlib::form_type | | sp_auxlib::form_type | |
| | | | |
| skipping to change at line 410 | | skipping to change at line 410 | |
| arma_ignore(n_eigvals); | | arma_ignore(n_eigvals); | |
| arma_ignore(form_str); | | arma_ignore(form_str); | |
| arma_ignore(default_tol); | | arma_ignore(default_tol); | |
| | | | |
| arma_stop("eigs_gen(): use of ARPACK needs to be enabled"); | | arma_stop("eigs_gen(): use of ARPACK needs to be enabled"); | |
| return false; | | return false; | |
| } | | } | |
| #endif | | #endif | |
| } | | } | |
| | | | |
|
| | | template<typename T1, typename T2> | |
| | | inline | |
| | | bool | |
| | | sp_auxlib::spsolve(Mat<typename T1::elem_type>& X, const SpBase<typename T1 | |
| | | ::elem_type, T1>& A_expr, const Base<typename T1::elem_type, T2>& B_expr, c | |
| | | onst superlu_opts& user_opts) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | #if defined(ARMA_USE_SUPERLU) | |
| | | { | |
| | | // The goal is to solve the system A*X = B for the matrix X. | |
| | | | |
| | | // The first thing we need to do is create SuperMatrix structures to ca | |
| | | ll | |
| | | // the SuperLU functions with. SuperLU will overwrite the B matrix wit | |
| | | h | |
| | | // the output matrix, so we'll unwrap B into X temporarily. | |
| | | | |
| | | typedef typename T1::elem_type eT; | |
| | | | |
| | | const unwrap_spmat<T1> tmp1(A_expr.get_ref()); | |
| | | const SpMat<eT>& A = tmp1.M; | |
| | | | |
| | | X = B_expr.get_ref(); | |
| | | | |
| | | if(A.n_rows > A.n_cols) | |
| | | { | |
| | | arma_stop("spsolve(): solving over-determined systems currently not s | |
| | | upported"); | |
| | | X.reset(); | |
| | | return false; | |
| | | } | |
| | | else if(A.n_rows < A.n_cols) | |
| | | { | |
| | | arma_stop("spsolve(): solving under-determined systems currently not | |
| | | supported"); | |
| | | X.reset(); | |
| | | return false; | |
| | | } | |
| | | | |
| | | arma_debug_check( (A.n_rows != X.n_rows), "spsolve(): number of rows in | |
| | | the given objects must be the same" ); | |
| | | | |
| | | if(A.is_empty() || X.is_empty()) | |
| | | { | |
| | | X.zeros(A.n_cols, X.n_cols); | |
| | | return true; | |
| | | } | |
| | | | |
| | | if(arma_config::debug) | |
| | | { | |
| | | bool overflow; | |
| | | | |
| | | overflow = (A.n_nonzero > INT_MAX); | |
| | | overflow = (A.n_rows > INT_MAX) || overflow; | |
| | | overflow = (A.n_cols > INT_MAX) || overflow; | |
| | | overflow = (X.n_rows > INT_MAX) || overflow; | |
| | | overflow = (X.n_cols > INT_MAX) || overflow; | |
| | | | |
| | | if(overflow) | |
| | | { | |
| | | arma_bad("spsolve(): integer overflow: matrix dimensions are too la | |
| | | rge for integer type used by SuperLU"); | |
| | | } | |
| | | } | |
| | | | |
| | | superlu::SuperMatrix x; arrayops::inplace_set(reinterpret_cast<char*>( | |
| | | &x), char(0), sizeof(superlu::SuperMatrix)); | |
| | | superlu::SuperMatrix a; arrayops::inplace_set(reinterpret_cast<char*>( | |
| | | &a), char(0), sizeof(superlu::SuperMatrix)); | |
| | | | |
| | | const bool status_x = convert_to_supermatrix(x, X); | |
| | | const bool status_a = convert_to_supermatrix(a, A); | |
| | | | |
| | | if( (status_x == false) || (status_a == false) ) | |
| | | { | |
| | | destroy_supermatrix(a); | |
| | | destroy_supermatrix(x); | |
| | | X.reset(); | |
| | | return false; | |
| | | } | |
| | | | |
| | | superlu::SuperMatrix l; arrayops::inplace_set(reinterpret_cast<char*>( | |
| | | &l), char(0), sizeof(superlu::SuperMatrix)); | |
| | | superlu::SuperMatrix u; arrayops::inplace_set(reinterpret_cast<char*>( | |
| | | &u), char(0), sizeof(superlu::SuperMatrix)); | |
| | | | |
| | | // Use default options. | |
| | | superlu::superlu_options_t options; | |
| | | superlu::set_default_opts(&options); | |
| | | | |
| | | // process user_opts | |
| | | | |
| | | if(user_opts.equilibrate == true) { options.Equil = superlu::YES; } | |
| | | if(user_opts.equilibrate == false) { options.Equil = superlu::NO; } | |
| | | | |
| | | if(user_opts.symmetric == true) { options.SymmetricMode = superlu::YE | |
| | | S; } | |
| | | if(user_opts.symmetric == false) { options.SymmetricMode = superlu::NO | |
| | | ; } | |
| | | | |
| | | options.DiagPivotThresh = user_opts.pivot_thresh; | |
| | | | |
| | | if(user_opts.permutation == superlu_opts::NATURAL) { options.Col | |
| | | Perm = superlu::NATURAL; } | |
| | | if(user_opts.permutation == superlu_opts::MMD_ATA) { options.Col | |
| | | Perm = superlu::MMD_ATA; } | |
| | | if(user_opts.permutation == superlu_opts::MMD_AT_PLUS_A) { options.Col | |
| | | Perm = superlu::MMD_AT_PLUS_A; } | |
| | | if(user_opts.permutation == superlu_opts::COLAMD) { options.Col | |
| | | Perm = superlu::COLAMD; } | |
| | | | |
| | | if(user_opts.refine == superlu_opts::REF_NONE) { options.IterRefine | |
| | | = superlu::NOREFINE; } | |
| | | if(user_opts.refine == superlu_opts::REF_SINGLE) { options.IterRefine | |
| | | = superlu::SLU_SINGLE; } | |
| | | if(user_opts.refine == superlu_opts::REF_DOUBLE) { options.IterRefine | |
| | | = superlu::SLU_DOUBLE; } | |
| | | if(user_opts.refine == superlu_opts::REF_EXTRA) { options.IterRefine | |
| | | = superlu::SLU_EXTRA; } | |
| | | | |
| | | // paranoia: use SuperLU's memory allocation, in case it reallocs | |
| | | | |
| | | int* perm_c = (int*) superlu::malloc( (A.n_cols+1) * sizeof(int)); // | |
| | | extra paranoia: increase array length by 1 | |
| | | int* perm_r = (int*) superlu::malloc( (A.n_rows+1) * sizeof(int)); | |
| | | | |
| | | arrayops::inplace_set(perm_c, 0, A.n_cols+1); | |
| | | arrayops::inplace_set(perm_r, 0, A.n_rows+1); | |
| | | | |
| | | superlu::SuperLUStat_t stat; | |
| | | superlu::init_stat(&stat); | |
| | | | |
| | | int info = 0; // Return code. | |
| | | | |
| | | superlu::gssv<eT>(&options, &a, perm_c, perm_r, &l, &u, &x, &stat, &inf | |
| | | o); | |
| | | | |
| | | // Process the return code. | |
| | | if( (info > 0) && (info <= int(A.n_cols)) ) | |
| | | { | |
| | | std::stringstream tmp; | |
| | | tmp << "spsolve(): could not solve system; LU factorisation completed | |
| | | , but detected zero in U(" << (info-1) << ',' << (info-1) << ')'; | |
| | | arma_debug_warn(true, tmp.str()); | |
| | | } | |
| | | else | |
| | | if(info > int(A.n_cols)) | |
| | | { | |
| | | std::stringstream tmp; | |
| | | tmp << "spsolve(): memory allocation failure: could not allocate " << | |
| | | (info - int(A.n_cols)) << " bytes"; | |
| | | arma_debug_warn(true, tmp.str()); | |
| | | } | |
| | | else | |
| | | if(info < 0) | |
| | | { | |
| | | std::stringstream tmp; | |
| | | tmp << "spsolve(): unknown SuperLU error code from gssv(): " << info; | |
| | | arma_debug_warn(true, tmp.str()); | |
| | | } | |
| | | | |
| | | superlu::free_stat(&stat); | |
| | | | |
| | | superlu::free(perm_c); | |
| | | superlu::free(perm_r); | |
| | | | |
| | | // No need to extract the matrix, since it's still using the same memor | |
| | | y. | |
| | | destroy_supermatrix(u); | |
| | | destroy_supermatrix(l); | |
| | | destroy_supermatrix(a); | |
| | | destroy_supermatrix(x); | |
| | | | |
| | | return (info == 0); | |
| | | } | |
| | | #else | |
| | | { | |
| | | arma_ignore(X); | |
| | | arma_ignore(A_expr); | |
| | | arma_ignore(B_expr); | |
| | | arma_stop("spsolve(): use of SuperLU needs to be enabled"); | |
| | | return false; | |
| | | } | |
| | | #endif | |
| | | } | |
| | | | |
| | | #if defined(ARMA_USE_SUPERLU) | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | sp_auxlib::convert_to_supermatrix(superlu::SuperMatrix& out, const SpMat< | |
| | | eT>& A) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | // We store in column-major CSC. | |
| | | out.Stype = superlu::SLU_NC; | |
| | | | |
| | | if(is_float<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_S; | |
| | | } | |
| | | else | |
| | | if(is_double<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_D; | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_float<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_C; | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_double<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_Z; | |
| | | } | |
| | | | |
| | | out.Mtype = superlu::SLU_GE; // Just a general matrix. We don't know m | |
| | | ore now. | |
| | | | |
| | | // We have to actually create the object which stores the data. | |
| | | // This gets cleaned by destroy_supermatrix(). | |
| | | // We have to use SuperLU's stupid memory allocation routines since the | |
| | | y are | |
| | | // not guaranteed to be new and delete. See the comments in superlu_bo | |
| | | nes.hpp | |
| | | superlu::NCformat* nc = (superlu::NCformat*)superlu::malloc(sizeof(supe | |
| | | rlu::NCformat)); | |
| | | | |
| | | if(nc == NULL) { return false; } | |
| | | | |
| | | nc->nnz = A.n_nonzero; | |
| | | nc->nzval = (void*) superlu::malloc(sizeof(eT) * | |
| | | A.n_nonzero ); | |
| | | nc->colptr = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * | |
| | | (A.n_cols + 1)); | |
| | | nc->rowind = (superlu::int_t*)superlu::malloc(sizeof(superlu::int_t) * | |
| | | A.n_nonzero ); | |
| | | | |
| | | if( (nc->nzval == NULL) || (nc->colptr == NULL) || (nc->rowind == NULL) | |
| | | ) { return false; } | |
| | | | |
| | | // Fill the matrix. | |
| | | arrayops::copy((eT*) nc->nzval, A.values, A.n_nonzero); | |
| | | | |
| | | // // These have to be copied by hand, because the types may differ. | |
| | | // for (uword i = 0; i <= A.n_cols; ++i) { nc->colptr[i] = (int_t) A.c | |
| | | ol_ptrs[i]; } | |
| | | // for (uword i = 0; i < A.n_nonzero; ++i) { nc->rowind[i] = (int_t) A. | |
| | | row_indices[i]; } | |
| | | | |
| | | arrayops::convert(nc->colptr, A.col_ptrs, A.n_cols+1 ); | |
| | | arrayops::convert(nc->rowind, A.row_indices, A.n_nonzero); | |
| | | | |
| | | out.nrow = A.n_rows; | |
| | | out.ncol = A.n_cols; | |
| | | out.Store = (void*) nc; | |
| | | | |
| | | return true; | |
| | | } | |
| | | | |
| | | template<typename eT> | |
| | | inline | |
| | | bool | |
| | | sp_auxlib::convert_to_supermatrix(superlu::SuperMatrix& out, const Mat<eT | |
| | | >& A) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | // This is being stored as a dense matrix. | |
| | | out.Stype = superlu::SLU_DN; | |
| | | | |
| | | if(is_float<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_S; | |
| | | } | |
| | | else | |
| | | if(is_double<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_D; | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_float<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_C; | |
| | | } | |
| | | else | |
| | | if(is_supported_complex_double<eT>::value) | |
| | | { | |
| | | out.Dtype = superlu::SLU_Z; | |
| | | } | |
| | | | |
| | | out.Mtype = superlu::SLU_GE; | |
| | | | |
| | | // We have to create the object that stores the data. | |
| | | superlu::DNformat* dn = (superlu::DNformat*)superlu::malloc(sizeof(supe | |
| | | rlu::DNformat)); | |
| | | | |
| | | if(dn == NULL) { return false; } | |
| | | | |
| | | dn->lda = A.n_rows; | |
| | | dn->nzval = (void*) A.memptr(); // re-use memory instead of copying | |
| | | | |
| | | out.nrow = A.n_rows; | |
| | | out.ncol = A.n_cols; | |
| | | out.Store = (void*) dn; | |
| | | | |
| | | return true; | |
| | | } | |
| | | | |
| | | inline | |
| | | void | |
| | | sp_auxlib::destroy_supermatrix(superlu::SuperMatrix& out) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | // Clean up. | |
| | | if(out.Stype == superlu::SLU_NC) | |
| | | { | |
| | | superlu::destroy_compcol_mat(&out); | |
| | | } | |
| | | else | |
| | | if(out.Stype == superlu::SLU_DN) | |
| | | { | |
| | | // superlu::destroy_dense_mat(&out); | |
| | | | |
| | | // since dn->nzval is set to re-use memory from a Mat object (which m | |
| | | anages its own memory), | |
| | | // we cannot simply call superlu::destroy_dense_mat(). | |
| | | // Only the out.Store structure can be freed. | |
| | | | |
| | | superlu::DNformat* dn = (superlu::DNformat*) out.Store; | |
| | | | |
| | | if(dn != NULL) { superlu::free(dn); } | |
| | | } | |
| | | else | |
| | | if(out.Stype == superlu::SLU_SC) | |
| | | { | |
| | | superlu::destroy_supernode_mat(&out); | |
| | | } | |
| | | else | |
| | | { | |
| | | // Uh, crap. | |
| | | | |
| | | std::stringstream tmp; | |
| | | | |
| | | tmp << "sp_auxlib::destroy_supermatrix(): unhandled Stype" << std::en | |
| | | dl; | |
| | | tmp << "Stype val: " << out.Stype << std::endl; | |
| | | tmp << "Stype name: "; | |
| | | | |
| | | if(out.Stype == superlu::SLU_NC) { tmp << "SLU_NC"; } | |
| | | if(out.Stype == superlu::SLU_NCP) { tmp << "SLU_NCP"; } | |
| | | if(out.Stype == superlu::SLU_NR) { tmp << "SLU_NR"; } | |
| | | if(out.Stype == superlu::SLU_SC) { tmp << "SLU_SC"; } | |
| | | if(out.Stype == superlu::SLU_SCP) { tmp << "SLU_SCP"; } | |
| | | if(out.Stype == superlu::SLU_SR) { tmp << "SLU_SR"; } | |
| | | if(out.Stype == superlu::SLU_DN) { tmp << "SLU_DN"; } | |
| | | if(out.Stype == superlu::SLU_NR_loc) { tmp << "SLU_NR_loc"; } | |
| | | | |
| | | arma_debug_warn(true, tmp.str()); | |
| | | arma_bad("sp_auxlib::destroy_supermatrix(): internal error"); | |
| | | } | |
| | | } | |
| | | | |
| | | #endif | |
| | | | |
| template<typename eT, typename T, typename T1> | | template<typename eT, typename T, typename T1> | |
| inline | | inline | |
| void | | void | |
| sp_auxlib::run_aupd | | sp_auxlib::run_aupd | |
| ( | | ( | |
| const uword n_eigvals, char* which, const SpProxy<T1>& p, const bool sym, | | const uword n_eigvals, char* which, const SpProxy<T1>& p, const bool sym, | |
| blas_int& n, eT& tol, | | blas_int& n, eT& tol, | |
| podarray<T>& resid, blas_int& ncv, podarray<T>& v, blas_int& ldv, | | podarray<T>& resid, blas_int& ncv, podarray<T>& v, blas_int& ldv, | |
| podarray<blas_int>& iparam, podarray<blas_int>& ipntr, | | podarray<blas_int>& iparam, podarray<blas_int>& ipntr, | |
| podarray<T>& workd, podarray<T>& workl, blas_int& lworkl, podarray<eT>& r
work, | | podarray<T>& workd, podarray<T>& workl, blas_int& lworkl, podarray<eT>& r
work, | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 374 lines changed or added | |
|