| arrayops_meat.hpp | | arrayops_meat.hpp | |
|
| // Copyright (C) 2011-2013 Conrad Sanderson | | // Copyright (C) 2011-2014 Conrad Sanderson | |
| // Copyright (C) 2011-2013 NICTA (www.nicta.com.au) | | // Copyright (C) 2011-2014 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 arrayops | | //! \addtogroup arrayops | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| arma_inline | | arma_inline | |
| void | | void | |
| arrayops::copy(eT* dest, const eT* src, const uword n_elem) | | arrayops::copy(eT* dest, const eT* src, const uword n_elem) | |
| { | | { | |
|
| if(n_elem <= 16) | | if( (n_elem <= 16) && (is_cx<eT>::no) ) | |
| { | | { | |
| arrayops::copy_small(dest, src, n_elem); | | arrayops::copy_small(dest, src, n_elem); | |
| } | | } | |
| else | | else | |
| { | | { | |
| std::memcpy(dest, src, n_elem*sizeof(eT)); | | std::memcpy(dest, src, n_elem*sizeof(eT)); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 502 | | skipping to change at line 502 | |
| dest[i] /= src[i]; | | dest[i] /= src[i]; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| arma_hot | | arma_hot | |
| inline | | inline | |
| void | | void | |
| arrayops::inplace_set(eT* dest, const eT val, const uword n_elem) | | arrayops::inplace_set(eT* dest, const eT val, const uword n_elem) | |
| { | | { | |
|
| if(n_elem <= 16) | | if( (n_elem <= 16) && (is_cx<eT>::no) ) | |
| { | | { | |
| arrayops::inplace_set_small(dest, val, n_elem); | | arrayops::inplace_set_small(dest, val, n_elem); | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(memory::is_aligned(dest)) | | if(memory::is_aligned(dest)) | |
| { | | { | |
| memory::mark_as_aligned(dest); | | memory::mark_as_aligned(dest); | |
| | | | |
| uword i,j; | | uword i,j; | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 4 lines changed or added | |
|
| diskio_meat.hpp | | diskio_meat.hpp | |
| | | | |
| skipping to change at line 2099 | | skipping to change at line 2099 | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_auto_detect(Mat<eT>& x, std::istream& f, std::string& err_msg) | | diskio::load_auto_detect(Mat<eT>& x, std::istream& f, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| static const std::string ARMA_MAT_TXT = "ARMA_MAT_TXT"; | | static const std::string ARMA_MAT_TXT = "ARMA_MAT_TXT"; | |
| static const std::string ARMA_MAT_BIN = "ARMA_MAT_BIN"; | | static const std::string ARMA_MAT_BIN = "ARMA_MAT_BIN"; | |
| static const std::string P5 = "P5"; | | static const std::string P5 = "P5"; | |
| | | | |
|
| podarray<char> raw_header(ARMA_MAT_TXT.length() + 1); | | podarray<char> raw_header( uword(ARMA_MAT_TXT.length()) + 1); | |
| | | | |
| std::streampos pos = f.tellg(); | | std::streampos pos = f.tellg(); | |
| | | | |
| f.read( raw_header.memptr(), std::streamsize(ARMA_MAT_TXT.length()) ); | | f.read( raw_header.memptr(), std::streamsize(ARMA_MAT_TXT.length()) ); | |
|
| raw_header[ARMA_MAT_TXT.length()] = '\0'; | | raw_header[uword(ARMA_MAT_TXT.length())] = '\0'; | |
| | | | |
| f.clear(); | | f.clear(); | |
| f.seekg(pos); | | f.seekg(pos); | |
| | | | |
| const std::string header = raw_header.mem; | | const std::string header = raw_header.mem; | |
| | | | |
| if(ARMA_MAT_TXT == header.substr(0,ARMA_MAT_TXT.length())) | | if(ARMA_MAT_TXT == header.substr(0,ARMA_MAT_TXT.length())) | |
| { | | { | |
| return load_arma_ascii(x, f, err_msg); | | return load_arma_ascii(x, f, err_msg); | |
| } | | } | |
| | | | |
| skipping to change at line 3645 | | skipping to change at line 3645 | |
| inline | | inline | |
| bool | | bool | |
| diskio::load_auto_detect(Cube<eT>& x, std::istream& f, std::string& err_msg
) | | diskio::load_auto_detect(Cube<eT>& x, std::istream& f, std::string& err_msg
) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| static const std::string ARMA_CUB_TXT = "ARMA_CUB_TXT"; | | static const std::string ARMA_CUB_TXT = "ARMA_CUB_TXT"; | |
| static const std::string ARMA_CUB_BIN = "ARMA_CUB_BIN"; | | static const std::string ARMA_CUB_BIN = "ARMA_CUB_BIN"; | |
| static const std::string P6 = "P6"; | | static const std::string P6 = "P6"; | |
| | | | |
|
| podarray<char> raw_header(ARMA_CUB_TXT.length() + 1); | | podarray<char> raw_header(uword(ARMA_CUB_TXT.length()) + 1); | |
| | | | |
| std::streampos pos = f.tellg(); | | std::streampos pos = f.tellg(); | |
| | | | |
| f.read( raw_header.memptr(), std::streamsize(ARMA_CUB_TXT.length()) ); | | f.read( raw_header.memptr(), std::streamsize(ARMA_CUB_TXT.length()) ); | |
|
| raw_header[ARMA_CUB_TXT.length()] = '\0'; | | raw_header[uword(ARMA_CUB_TXT.length())] = '\0'; | |
| | | | |
| f.clear(); | | f.clear(); | |
| f.seekg(pos); | | f.seekg(pos); | |
| | | | |
| const std::string header = raw_header.mem; | | const std::string header = raw_header.mem; | |
| | | | |
| if(ARMA_CUB_TXT == header.substr(0, ARMA_CUB_TXT.length())) | | if(ARMA_CUB_TXT == header.substr(0, ARMA_CUB_TXT.length())) | |
| { | | { | |
| return load_arma_ascii(x, f, err_msg); | | return load_arma_ascii(x, f, err_msg); | |
| } | | } | |
| | | | |
| skipping to change at line 4001 | | skipping to change at line 4001 | |
| bool | | bool | |
| diskio::load_auto_detect(field<T1>& x, std::istream& f, std::string& err_ms
g) | | diskio::load_auto_detect(field<T1>& x, std::istream& f, std::string& err_ms
g) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_type_check(( is_Mat<T1>::value == false )); | | arma_type_check(( is_Mat<T1>::value == false )); | |
| | | | |
| static const std::string ARMA_FLD_BIN = "ARMA_FLD_BIN"; | | static const std::string ARMA_FLD_BIN = "ARMA_FLD_BIN"; | |
| static const std::string P6 = "P6"; | | static const std::string P6 = "P6"; | |
| | | | |
|
| podarray<char> raw_header(ARMA_FLD_BIN.length() + 1); | | podarray<char> raw_header(uword(ARMA_FLD_BIN.length()) + 1); | |
| | | | |
| std::streampos pos = f.tellg(); | | std::streampos pos = f.tellg(); | |
| | | | |
| f.read( raw_header.memptr(), std::streamsize(ARMA_FLD_BIN.length()) ); | | f.read( raw_header.memptr(), std::streamsize(ARMA_FLD_BIN.length()) ); | |
| | | | |
| f.clear(); | | f.clear(); | |
| f.seekg(pos); | | f.seekg(pos); | |
| | | | |
|
| raw_header[ARMA_FLD_BIN.length()] = '\0'; | | raw_header[uword(ARMA_FLD_BIN.length())] = '\0'; | |
| | | | |
| const std::string header = raw_header.mem; | | const std::string header = raw_header.mem; | |
| | | | |
| if(ARMA_FLD_BIN == header.substr(0, ARMA_FLD_BIN.length())) | | if(ARMA_FLD_BIN == header.substr(0, ARMA_FLD_BIN.length())) | |
| { | | { | |
| return load_arma_binary(x, f, err_msg); | | return load_arma_binary(x, f, err_msg); | |
| } | | } | |
| else | | else | |
| if(P6 == header.substr(0, P6.length())) | | if(P6 == header.substr(0, P6.length())) | |
| { | | { | |
| | | | |
End of changes. 6 change blocks. |
| 6 lines changed or deleted | | 6 lines changed or added | |
|
| field_meat.hpp | | field_meat.hpp | |
| | | | |
| skipping to change at line 1397 | | skipping to change at line 1397 | |
| // | | // | |
| // | | // | |
| | | | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field<oT>&, const std::string&, const file_type, std:
:string& err_msg) | | field_aux::save(const field<oT>&, const std::string&, const file_type, std:
:string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| err_msg = " [sorry, saving/loading this type of field is currently not su
pported] filename = "; | | err_msg = " [saving/loading this type of field is currently not supported
] filename = "; | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field<oT>&, std::ostream&, const file_type, std::stri
ng& err_msg) | | field_aux::save(const field<oT>&, std::ostream&, const file_type, std::stri
ng& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| err_msg = " [sorry, saving/loading this type of field is currently not su
pported] filename = "; | | err_msg = " [saving/loading this type of field is currently not supported
] filename = "; | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::load(field<oT>&, const std::string&, const file_type, std::strin
g& err_msg) | | field_aux::load(field<oT>&, const std::string&, const file_type, std::strin
g& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| err_msg = " [sorry, saving/loading this type of field is currently not su
pported] filename = "; | | err_msg = " [saving/loading this type of field is currently not supported
] filename = "; | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::load(field<oT>&, std::istream&, const file_type, std::string& er
r_msg) | | field_aux::load(field<oT>&, std::istream&, const file_type, std::string& er
r_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| err_msg = " [sorry, saving/loading this type of field is currently not su
pported] filename = "; | | err_msg = " [saving/loading this type of field is currently not supported
] filename = "; | |
| | | | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< Mat<eT> >& x, const std::string& name, const f
ile_type type, std::string& err_msg) | | field_aux::save(const field< Mat<eT> >& x, const std::string& name, const f
ile_type type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| skipping to change at line 1648 | | skipping to change at line 1648 | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< Row<eT> >& x, const std::string& name, const f
ile_type type, std::string& err_msg) | | field_aux::save(const field< Row<eT> >& x, const std::string& name, const f
ile_type type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case arma_binary: | | case arma_binary: | |
|
| return diskio::save_arma_binary(x, name, err_msg); | | return diskio::save_arma_binary(x, name); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
|
| return diskio::save_ppm_binary(x, name, err_msg); | | return diskio::save_ppm_binary(x, name); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< Row<eT> >& x, std::ostream& os, const file_typ
e type, std::string& err_msg) | | field_aux::save(const field< Row<eT> >& x, std::ostream& os, const file_typ
e type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case arma_binary: | | case arma_binary: | |
|
| return diskio::save_arma_binary(x, os, err_msg); | | return diskio::save_arma_binary(x, os); | |
| break; | | break; | |
| | | | |
| case ppm_binary: | | case ppm_binary: | |
|
| return diskio::save_ppm_binary(x, os, err_msg); | | return diskio::save_ppm_binary(x, os); | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| | | | |
| skipping to change at line 1748 | | skipping to change at line 1748 | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< Cube<eT> >& x, const std::string& name, const
file_type type, std::string& err_msg) | | field_aux::save(const field< Cube<eT> >& x, const std::string& name, const
file_type type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case arma_binary: | | case arma_binary: | |
|
| return diskio::save_arma_binary(x, name, err_msg); | | return diskio::save_arma_binary(x, name); | |
| break; | | | |
| | | | |
| case ppm_binary: | | | |
| return diskio::save_ppm_binary(x, name, err_msg); | | | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< Cube<eT> >& x, std::ostream& os, const file_ty
pe type, std::string& err_msg) | | field_aux::save(const field< Cube<eT> >& x, std::ostream& os, const file_ty
pe type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case arma_binary: | | case arma_binary: | |
|
| return diskio::save_arma_binary(x, os, err_msg); | | return diskio::save_arma_binary(x, os); | |
| break; | | | |
| | | | |
| case ppm_binary: | | | |
| return diskio::save_ppm_binary(x, os, err_msg); | | | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::load(field< Cube<eT> >& x, const std::string& name, const file_t
ype type, std::string& err_msg) | | field_aux::load(field< Cube<eT> >& x, const std::string& name, const file_t
ype type, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case auto_detect: | | case auto_detect: | |
|
| return diskio::load_auto_detect(x, name, err_msg); | | | |
| break; | | | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| return diskio::load_arma_binary(x, name, err_msg); | | return diskio::load_arma_binary(x, name, err_msg); | |
| break; | | break; | |
| | | | |
|
| case ppm_binary: | | | |
| return diskio::load_ppm_binary(x, name, err_msg); | | | |
| break; | | | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| bool | | bool | |
| field_aux::load(field< Cube<eT> >& x, std::istream& is, const file_type typ
e, std::string& err_msg) | | field_aux::load(field< Cube<eT> >& x, std::istream& is, const file_type typ
e, std::string& err_msg) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| switch(type) | | switch(type) | |
| { | | { | |
| case auto_detect: | | case auto_detect: | |
|
| return diskio::load_auto_detect(x, is, err_msg); | | | |
| break; | | | |
| | | | |
| case arma_binary: | | case arma_binary: | |
| return diskio::load_arma_binary(x, is, err_msg); | | return diskio::load_arma_binary(x, is, err_msg); | |
| break; | | break; | |
| | | | |
|
| case ppm_binary: | | | |
| return diskio::load_ppm_binary(x, is, err_msg); | | | |
| break; | | | |
| | | | |
| default: | | default: | |
| err_msg = " [unsupported type] filename = "; | | err_msg = " [unsupported type] filename = "; | |
| return false; | | return false; | |
| } | | } | |
| } | | } | |
| | | | |
| inline | | inline | |
| bool | | bool | |
| field_aux::save(const field< std::string >& x, const std::string& name, con
st file_type type, std::string& err_msg) | | field_aux::save(const field< std::string >& x, const std::string& name, con
st file_type type, std::string& err_msg) | |
| { | | { | |
| | | | |
End of changes. 14 change blocks. |
| 32 lines changed or deleted | | 10 lines changed or added | |
|
| fn_det.hpp | | fn_det.hpp | |
| | | | |
| skipping to change at line 43 | | skipping to change at line 43 | |
| det | | det | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | |
| | | | |
| const bool slow = (sig == 's'); | | const bool slow = (sig == 's'); | |
| | | | |
| return auxlib::det(X, slow); | | return auxlib::det(X, slow); | |
| } | | } | |
| | | | |
| //! determinant of diagmat | | //! determinant of diagmat | |
| template<typename T1> | | template<typename T1> | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 102 | |
| arma_warn_unused | | arma_warn_unused | |
| typename T1::elem_type | | typename T1::elem_type | |
| det | | det | |
| ( | | ( | |
| const Op<T1, op_diagmat>& X, | | const Op<T1, op_diagmat>& X, | |
| const char* method | | const char* method | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | |
| | | | |
| return det(X, false); | | return det(X, false); | |
| } | | } | |
| | | | |
| //! determinant of a triangular matrix | | //! determinant of a triangular matrix | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| arma_warn_unused | | arma_warn_unused | |
| | | | |
| skipping to change at line 161 | | skipping to change at line 161 | |
| arma_warn_unused | | arma_warn_unused | |
| typename T1::elem_type | | typename T1::elem_type | |
| det | | det | |
| ( | | ( | |
| const Op<T1, op_trimat>& X, | | const Op<T1, op_trimat>& X, | |
| const char* method | | const char* method | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | |
| | | | |
| return det(X, false); | | return det(X, false); | |
| } | | } | |
| | | | |
| //! determinant of inv(A), without doing the inverse operation | | //! determinant of inv(A), without doing the inverse operation | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| arma_warn_unused | | arma_warn_unused | |
| | | | |
| skipping to change at line 206 | | skipping to change at line 206 | |
| det | | det | |
| ( | | ( | |
| const Op<T1,op_inv>& X, | | const Op<T1,op_inv>& X, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | |
| | | | |
| const bool slow = (sig == 's'); | | const bool slow = (sig == 's'); | |
| | | | |
| return det(X, slow); | | return det(X, slow); | |
| } | | } | |
| | | | |
| //! determinant of trans(A) | | //! determinant of trans(A) | |
| template<typename T1> | | template<typename T1> | |
| | | | |
| skipping to change at line 251 | | skipping to change at line 251 | |
| const Op<T1,op_htrans>& in, | | const Op<T1,op_htrans>& in, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk1
= 0, | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk1
= 0, | |
| const typename arma_not_cx<typename T1::elem_type>::result* junk2
= 0 | | const typename arma_not_cx<typename T1::elem_type>::result* junk2
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk1); | | arma_ignore(junk1); | |
| arma_ignore(junk2); | | arma_ignore(junk2); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "det(): unknown method
specified" ); | |
| | | | |
| const bool slow = (sig == 's'); | | const bool slow = (sig == 's'); | |
| | | | |
| return auxlib::det(in.m, slow); // bypass op_htrans | | return auxlib::det(in.m, slow); // bypass op_htrans | |
| } | | } | |
| | | | |
| template<typename T> | | template<typename T> | |
| arma_inline | | arma_inline | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 5 lines changed or added | |
|
| fn_inplace_trans.hpp | | fn_inplace_trans.hpp | |
| | | | |
| skipping to change at line 46 | | skipping to change at line 46 | |
| void | | void | |
| >::result | | >::result | |
| inplace_htrans | | inplace_htrans | |
| ( | | ( | |
| Mat<eT>& X, | | Mat<eT>& X, | |
| const char* method = "std" | | const char* method = "std" | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_htrans(): unkn
own method specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_htrans(): unkn
own method specified" ); | |
| | | | |
| const bool low_memory = (sig == 'l'); | | const bool low_memory = (sig == 'l'); | |
| | | | |
| if( (low_memory == false) || (X.n_rows == X.n_cols) ) | | if( (low_memory == false) || (X.n_rows == X.n_cols) ) | |
| { | | { | |
| op_htrans::apply_mat_inplace(X); | | op_htrans::apply_mat_inplace(X); | |
| } | | } | |
| else | | else | |
| | | | |
| skipping to change at line 80 | | skipping to change at line 80 | |
| void | | void | |
| >::result | | >::result | |
| inplace_trans | | inplace_trans | |
| ( | | ( | |
| Mat<eT>& X, | | Mat<eT>& X, | |
| const char* method = "std" | | const char* method = "std" | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unkno
wn method specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unkno
wn method specified" ); | |
| | | | |
| inplace_strans(X, method); | | inplace_strans(X, method); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| typename | | typename | |
| enable_if2 | | enable_if2 | |
| | | | |
| skipping to change at line 103 | | skipping to change at line 103 | |
| void | | void | |
| >::result | | >::result | |
| inplace_trans | | inplace_trans | |
| ( | | ( | |
| Mat<eT>& X, | | Mat<eT>& X, | |
| const char* method = "std" | | const char* method = "std" | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unkno
wn method specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unkno
wn method specified" ); | |
| | | | |
| inplace_htrans(X, method); | | inplace_htrans(X, method); | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| fn_inv.hpp | | fn_inv.hpp | |
| | | | |
| skipping to change at line 41 | | skipping to change at line 41 | |
| inv | | inv | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "inv(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "inv(): unknown method
specified" ); | |
| | | | |
| return Op<T1, op_inv>(X.get_ref(), ((sig == 'f') ? 0 : 1), 0); | | return Op<T1, op_inv>(X.get_ref(), ((sig == 'f') ? 0 : 1), 0); | |
| } | | } | |
| | | | |
| //! delayed matrix inverse (triangular matrices) | | //! delayed matrix inverse (triangular matrices) | |
| template<typename T1> | | template<typename T1> | |
| arma_inline | | arma_inline | |
| const Op<T1, op_inv_tr> | | const Op<T1, op_inv_tr> | |
| | | | |
| skipping to change at line 79 | | skipping to change at line 79 | |
| inv | | inv | |
| ( | | ( | |
| const Op<T1, op_trimat>& X, | | const Op<T1, op_trimat>& X, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "inv(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "inv(): unknown method
specified" ); | |
| | | | |
| return Op<T1, op_inv_tr>(X.m, X.aux_uword_a, 0); | | return Op<T1, op_inv_tr>(X.m, X.aux_uword_a, 0); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| bool | | bool | |
| inv | | inv | |
| | | | |
| skipping to change at line 152 | | skipping to change at line 152 | |
| inv_sympd | | inv_sympd | |
| ( | | ( | |
| const Base<typename T1::elem_type, T1>& X, | | const Base<typename T1::elem_type, T1>& X, | |
| const char* method = "std", | | const char* method = "std", | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "inv_sympd(): unknown m
ethod specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "inv_sympd(): unknown m
ethod specified" ); | |
| | | | |
| return Op<T1, op_inv_sympd>(X.get_ref(), 0, 0); | | return Op<T1, op_inv_sympd>(X.get_ref(), 0, 0); | |
| } | | } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline | | inline | |
| bool | | bool | |
| inv_sympd | | inv_sympd | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| fn_norm.hpp | | fn_norm.hpp | |
| | | | |
| skipping to change at line 537 | | skipping to change at line 537 | |
| | | | |
| typedef typename T1::pod_type T; | | typedef typename T1::pod_type T; | |
| | | | |
| const Proxy<T1> P(X); | | const Proxy<T1> P(X); | |
| | | | |
| if(P.get_n_elem() == 0) | | if(P.get_n_elem() == 0) | |
| { | | { | |
| return T(0); | | return T(0); | |
| } | | } | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| const bool is_vec = (P.get_n_rows() == 1) || (P.get_n_cols() == 1); | | const bool is_vec = (P.get_n_rows() == 1) || (P.get_n_cols() == 1); | |
| | | | |
| if(is_vec == true) | | if(is_vec == true) | |
| { | | { | |
| if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm | | if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm | |
| { | | { | |
| return arma_vec_norm_max(P); | | return arma_vec_norm_max(P); | |
| } | | } | |
| else | | else | |
| if(sig == '-') // min norm | | if(sig == '-') // min norm | |
| | | | |
| skipping to change at line 722 | | skipping to change at line 722 | |
| } | | } | |
| | | | |
| const unwrap_spmat<typename SpProxy<T1>::stored_type> tmp(P.Q); | | const unwrap_spmat<typename SpProxy<T1>::stored_type> tmp(P.Q); | |
| const SpMat<eT>& A = tmp.M; | | const SpMat<eT>& A = tmp.M; | |
| | | | |
| // create a fake dense vector to allow reuse of code for dense vectors | | // create a fake dense vector to allow reuse of code for dense vectors | |
| Col<eT> fake_vector( access::rwp(A.values), A.n_nonzero, false ); | | Col<eT> fake_vector( access::rwp(A.values), A.n_nonzero, false ); | |
| | | | |
| const Proxy< Col<eT> > P_fake_vector(fake_vector); | | const Proxy< Col<eT> > P_fake_vector(fake_vector); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| const bool is_vec = (P.get_n_rows() == 1) || (P.get_n_cols() == 1); | | const bool is_vec = (P.get_n_rows() == 1) || (P.get_n_cols() == 1); | |
| | | | |
| if(is_vec == true) | | if(is_vec == true) | |
| { | | { | |
| if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm | | if( (sig == 'i') || (sig == 'I') || (sig == '+') ) // max norm | |
| { | | { | |
| return arma_vec_norm_max(P_fake_vector); | | return arma_vec_norm_max(P_fake_vector); | |
| } | | } | |
| else | | else | |
| if(sig == '-') // min norm | | if(sig == '-') // min norm | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| fn_solve.hpp | | fn_solve.hpp | |
| | | | |
| skipping to change at line 50 | | skipping to change at line 50 | |
| ( | | ( | |
| const Base<typename T1::elem_type,T1>& A, | | const Base<typename T1::elem_type,T1>& A, | |
| const Base<typename T1::elem_type,T2>& B, | | const Base<typename T1::elem_type,T2>& B, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "solve(): unknown metho
d specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "solve(): unknown metho
d specified" ); | |
| | | | |
| return Glue<T1, T2, glue_solve>( A.get_ref(), B.get_ref(), ((sig == 'f')
? 0 : 1) ); | | return Glue<T1, T2, glue_solve>( A.get_ref(), B.get_ref(), ((sig == 'f')
? 0 : 1) ); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| const Glue<T1, T2, glue_solve_tr> | | const Glue<T1, T2, glue_solve_tr> | |
| solve | | solve | |
| | | | |
| skipping to change at line 89 | | skipping to change at line 89 | |
| ( | | ( | |
| const Op<T1, op_trimat>& A, | | const Op<T1, op_trimat>& A, | |
| const Base<typename T1::elem_type,T2>& B, | | const Base<typename T1::elem_type,T2>& B, | |
| const char* method, | | const char* method, | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'f')), "solve(): unknown metho
d specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'f')), "solve(): unknown metho
d specified" ); | |
| | | | |
| return Glue<T1, T2, glue_solve_tr>(A.m, B.get_ref(), A.aux_uword_a); | | return Glue<T1, T2, glue_solve_tr>(A.m, B.get_ref(), A.aux_uword_a); | |
| } | | } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline | | inline | |
| bool | | bool | |
| solve | | solve | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| fn_svd.hpp | | fn_svd.hpp | |
| | | | |
| skipping to change at line 84 | | skipping to change at line 84 | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)
(&V)) ), | | ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)
(&V)) ), | |
| "svd(): two or more output objects are the same object" | | "svd(): two or more output objects are the same object" | |
| ); | | ); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'd')), "svd(): unknown method
specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'd')), "svd(): unknown method
specified" ); | |
| | | | |
| // auxlib::svd() makes an internal copy of X | | // auxlib::svd() makes an internal copy of X | |
| const bool status = (sig == 'd') ? auxlib::svd_dc(U, S, V, X) : auxlib::s
vd(U, S, V, X); | | const bool status = (sig == 'd') ? auxlib::svd_dc(U, S, V, X) : auxlib::s
vd(U, S, V, X); | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| U.reset(); | | U.reset(); | |
| S.reset(); | | S.reset(); | |
| | | | |
| skipping to change at line 131 | | skipping to change at line 131 | |
| ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)
(&V)) ), | | ( ((void*)(&U) == (void*)(&S)) || (&U == &V) || ((void*)(&S) == (void*)
(&V)) ), | |
| "svd_econ(): two or more output objects are the same object" | | "svd_econ(): two or more output objects are the same object" | |
| ); | | ); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (mode != 'l') && (mode != 'r') && (mode != 'b') ), | | ( (mode != 'l') && (mode != 'r') && (mode != 'b') ), | |
| "svd_econ(): parameter 'mode' or 'side' is incorrect" | | "svd_econ(): parameter 'mode' or 'side' is incorrect" | |
| ); | | ); | |
| | | | |
|
| const char sig = method[0]; | | const char sig = (method != NULL) ? method[0] : char(0); | |
| | | | |
| arma_debug_check( ((sig != 's') && (sig != 'd')), "svd_econ(): unknown me
thod specified" ); | | arma_debug_check( ((sig != 's') && (sig != 'd')), "svd_econ(): unknown me
thod specified" ); | |
| | | | |
| const bool status = ((mode == 'b') && (sig == 'd')) ? auxlib::svd_dc_econ
(U, S, V, X) : auxlib::svd_econ(U, S, V, X, mode); | | const bool status = ((mode == 'b') && (sig == 'd')) ? auxlib::svd_dc_econ
(U, S, V, X) : auxlib::svd_econ(U, S, V, X, mode); | |
| | | | |
| if(status == false) | | if(status == false) | |
| { | | { | |
| U.reset(); | | U.reset(); | |
| S.reset(); | | S.reset(); | |
| V.reset(); | | V.reset(); | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 165 | |
| Mat<typename T1::elem_type>& V, | | Mat<typename T1::elem_type>& V, | |
| const Base<typename T1::elem_type,T1>& X, | | const Base<typename T1::elem_type,T1>& X, | |
| const char* side = "both", | | const char* side = "both", | |
| const char* method = "dc", | | const char* method = "dc", | |
| const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | | const typename arma_blas_type_only<typename T1::elem_type>::result* junk
= 0 | |
| ) | | ) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| arma_ignore(junk); | | arma_ignore(junk); | |
| | | | |
|
| return svd_econ(U,S,V,X,side[0],method); | | return svd_econ(U, S, V, X, ((side != NULL) ? side[0] : char(0)), method)
; | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| forward_bones.hpp | | forward_bones.hpp | |
|
| // Copyright (C) 2008-2013 Conrad Sanderson | | // Copyright (C) 2008-2014 Conrad Sanderson | |
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2014 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/. | |
| | | | |
| using std::cout; | | using std::cout; | |
| using std::cerr; | | using std::cerr; | |
| using std::endl; | | using std::endl; | |
| using std::ios; | | using std::ios; | |
|
| | | using std::size_t; | |
| | | | |
| template<typename elem_type, typename derived> struct Base; | | template<typename elem_type, typename derived> struct Base; | |
| template<typename elem_type, typename derived> struct BaseCube; | | template<typename elem_type, typename derived> struct BaseCube; | |
| | | | |
| template<typename eT> class Mat; | | template<typename eT> class Mat; | |
| template<typename eT> class Col; | | template<typename eT> class Col; | |
| template<typename eT> class Row; | | template<typename eT> class Row; | |
| template<typename eT> class Cube; | | template<typename eT> class Cube; | |
| template<typename eT> class xvec_htrans; | | template<typename eT> class xvec_htrans; | |
| template<typename oT> class field; | | template<typename oT> class field; | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 3 lines changed or added | |
|