| Mat_proto.hpp | | Mat_proto.hpp | |
| | | | |
| skipping to change at line 247 | | skipping to change at line 247 | |
| arma_inline void operator++(int); | | arma_inline void operator++(int); | |
| | | | |
| arma_inline const Mat& operator--(); | | arma_inline const Mat& operator--(); | |
| arma_inline void operator--(int); | | arma_inline void operator--(int); | |
| | | | |
| arma_inline arma_warn_unused bool is_empty() const; | | arma_inline arma_warn_unused bool is_empty() const; | |
| arma_inline arma_warn_unused bool is_vec() const; | | arma_inline arma_warn_unused bool is_vec() const; | |
| arma_inline arma_warn_unused bool is_square() const; | | arma_inline arma_warn_unused bool is_square() const; | |
| inline arma_warn_unused bool is_finite() const; | | inline arma_warn_unused bool is_finite() const; | |
| | | | |
|
| // TODO: test and add expanded .in_range() to user documentation | | | |
| arma_inline arma_warn_unused bool in_range(const u32 i) const; | | arma_inline arma_warn_unused bool in_range(const u32 i) const; | |
| arma_inline arma_warn_unused bool in_range(const span& x) const; | | arma_inline arma_warn_unused bool in_range(const span& x) const; | |
| | | | |
|
| arma_inline arma_warn_unused bool in_range(const u32 in_row, co | | arma_inline arma_warn_unused bool in_range(const u32 in_row, const u3 | |
| nst u32 in_col ) const; | | 2 in_col ) const; | |
| arma_inline arma_warn_unused bool in_range(const span& row_span, co | | arma_inline arma_warn_unused bool in_range(const span& row_span, const u3 | |
| nst u32 in_col ) const; | | 2 in_col ) const; | |
| arma_inline arma_warn_unused bool in_range(const u32 in_row, co | | arma_inline arma_warn_unused bool in_range(const u32 in_row, const sp | |
| nst span& col_span) const; | | an& col_span) const; | |
| arma_inline arma_warn_unused bool in_range(const span& row_span, co | | arma_inline arma_warn_unused bool in_range(const span& row_span, const sp | |
| nst span& col_span) const; | | an& col_span) const; | |
| | | | |
| arma_inline arma_warn_unused eT* colptr(const u32 in_col); | | arma_inline arma_warn_unused eT* colptr(const u32 in_col); | |
| arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; | | arma_inline arma_warn_unused const eT* colptr(const u32 in_col) const; | |
| | | | |
| arma_inline arma_warn_unused eT* memptr(); | | arma_inline arma_warn_unused eT* memptr(); | |
| arma_inline arma_warn_unused const eT* memptr() const; | | arma_inline arma_warn_unused const eT* memptr() const; | |
| | | | |
| inline void print(const std::string extra_text = "") const; | | inline void print(const std::string extra_text = "") const; | |
| inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | | inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | |
| | | | |
| | | | |
| skipping to change at line 428 | | skipping to change at line 427 | |
| inline const Mat& operator=(const eT val) { Mat<eT>::operator=(val); re
turn *this; } | | inline const Mat& operator=(const eT val) { Mat<eT>::operator=(val); re
turn *this; } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline fixed(const Base<eT,T1>& A) { mem_setup(); Mat<eT>::operator=(A.
get_ref()); } | | inline fixed(const Base<eT,T1>& A) { mem_setup(); Mat<eT>::operator=(A.
get_ref()); } | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| inline const Mat& operator=(const Base<eT,T1>& A) { Mat<eT>::operator=(
A.get_ref()); return *this; } | | inline const Mat& operator=(const Base<eT,T1>& A) { Mat<eT>::operator=(
A.get_ref()); return *this; } | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline explicit fixed(const Base<pod_type,T1>& A, const Base<pod_type,T
2>& B) { mem_setup(); Mat<eT>::init(A,B); } | | inline explicit fixed(const Base<pod_type,T1>& A, const Base<pod_type,T
2>& B) { mem_setup(); Mat<eT>::init(A,B); } | |
|
| | | | |
| | | inline fixed( eT* aux_mem, const bool copy_aux_mem = true); | |
| | | inline fixed(const eT* aux_mem); | |
| }; | | }; | |
| | | | |
| protected: | | protected: | |
| | | | |
| inline void init(const u32 in_rows, const u32 in_cols); | | inline void init(const u32 in_rows, const u32 in_cols); | |
| inline void init(const std::string& text); | | inline void init(const std::string& text); | |
| inline void init(const Mat& x); | | inline void init(const Mat& x); | |
| | | | |
| template<typename T1, typename T2> | | template<typename T1, typename T2> | |
| inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); | | inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); | |
| | | | |
End of changes. 3 change blocks. |
| 9 lines changed or deleted | | 11 lines changed or added | |
|
| config.hpp | | config.hpp | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| #if !defined(ARMA_USE_LAPACK) | | #if !defined(ARMA_USE_LAPACK) | |
| #define ARMA_USE_LAPACK | | #define ARMA_USE_LAPACK | |
|
| | | //// Uncomment the above line if you have LAPACK or a fast replacement for | |
| | | LAPACK, | |
| | | //// such as Intel's MKL, AMD's ACML, or the Accelerate framework. | |
| | | //// LAPACK is required for matrix decompositions (eg. SVD) and matrix inve | |
| | | rse. | |
| #endif | | #endif | |
| | | | |
| #if !defined(ARMA_USE_BLAS) | | #if !defined(ARMA_USE_BLAS) | |
| #define ARMA_USE_BLAS | | #define ARMA_USE_BLAS | |
|
| | | //// Uncomment the above line if you have BLAS or a fast replacement for BL | |
| | | AS, | |
| | | //// such as GotoBLAS, Intel's MKL, AMD's ACML, or the Accelerate framework | |
| | | . | |
| | | //// BLAS is used for matrix multiplication. | |
| | | //// Without BLAS, matrix multiplication will still work, but might be slow | |
| | | er. | |
| #endif | | #endif | |
| | | | |
| // #define ARMA_BLAS_LONG | | // #define ARMA_BLAS_LONG | |
| //// Uncomment the above line if your BLAS and LAPACK libraries use "long"
instead of "int" | | //// Uncomment the above line if your BLAS and LAPACK libraries use "long"
instead of "int" | |
| | | | |
| // #define ARMA_BLAS_LONG_LONG | | // #define ARMA_BLAS_LONG_LONG | |
| //// Uncomment the above line if your BLAS and LAPACK libraries use "long l
ong" instead of "int" | | //// Uncomment the above line if your BLAS and LAPACK libraries use "long l
ong" instead of "int" | |
| | | | |
| #define ARMA_BLAS_UNDERSCORE | | #define ARMA_BLAS_UNDERSCORE | |
| //// Uncomment the above line if your BLAS and LAPACK libraries have functi
on names with a trailing underscore. | | //// Uncomment the above line if your BLAS and LAPACK libraries have functi
on names with a trailing underscore. | |
|
| //// Conversely, comment it out if the function names don't have a trailing
underscore | | //// Conversely, comment it out if the function names don't have a trailing
underscore. | |
| | | | |
| #if !defined(ARMA_MAT_PREALLOC) | | #if !defined(ARMA_MAT_PREALLOC) | |
| #define ARMA_MAT_PREALLOC 16 | | #define ARMA_MAT_PREALLOC 16 | |
| #endif | | #endif | |
| //// This is the number of preallocated elements used by matrices and vecto
rs; | | //// This is the number of preallocated elements used by matrices and vecto
rs; | |
| //// it must be an integer that is at least 1. | | //// it must be an integer that is at least 1. | |
| //// If you mainly use lots of very small vectors (eg. <= 4 elements), | | //// If you mainly use lots of very small vectors (eg. <= 4 elements), | |
| //// change the number to the size of your vectors. | | //// change the number to the size of your vectors. | |
| | | | |
| #define ARMA_USE_ATLAS | | #define ARMA_USE_ATLAS | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 13 lines changed or added | |
|
| field_meat.hpp | | field_meat.hpp | |
| | | | |
| skipping to change at line 343 | | skipping to change at line 343 | |
| field<oT>::rows(const u32 in_row1, const u32 in_row2) | | field<oT>::rows(const u32 in_row1, const u32 in_row2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), | | ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), | |
| "field::rows(): indicies out of bounds or incorrectly used" | | "field::rows(): indicies out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_rows = in_row2 - in_row1 + 1; | | const u32 sub_n_rows = in_row2 - in_row1 + 1; | |
| | | | |
|
| return subview_field<oT>(*this, in_row1, 0, subfield_n_rows, n_cols); | | return subview_field<oT>(*this, in_row1, 0, sub_n_rows, n_cols); | |
| } | | } | |
| | | | |
| //! creation of subview_field (subfield comprised of specified rows) | | //! creation of subview_field (subfield comprised of specified rows) | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| const subview_field<oT> | | const subview_field<oT> | |
| field<oT>::rows(const u32 in_row1, const u32 in_row2) const | | field<oT>::rows(const u32 in_row1, const u32 in_row2) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), | | ( (in_row1 > in_row2) || (in_row2 >= n_rows) ), | |
| "field::rows(): indicies out of bounds or incorrectly used" | | "field::rows(): indicies out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_rows = in_row2 - in_row1 + 1; | | const u32 sub_n_rows = in_row2 - in_row1 + 1; | |
| | | | |
|
| return subview_field<oT>(*this, in_row1, 0, subfield_n_rows, n_cols); | | return subview_field<oT>(*this, in_row1, 0, sub_n_rows, n_cols); | |
| } | | } | |
| | | | |
| //! creation of subview_field (subfield comprised of specified columns) | | //! creation of subview_field (subfield comprised of specified columns) | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| subview_field<oT> | | subview_field<oT> | |
| field<oT>::cols(const u32 in_col1, const u32 in_col2) | | field<oT>::cols(const u32 in_col1, const u32 in_col2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), | | ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), | |
| "field::cols(): indicies out of bounds or incorrectly used" | | "field::cols(): indicies out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_cols = in_col2 - in_col1 + 1; | | const u32 sub_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
|
| return subview_field<oT>(*this, 0, in_col1, n_rows, subfield_n_cols); | | return subview_field<oT>(*this, 0, in_col1, n_rows, sub_n_cols); | |
| } | | } | |
| | | | |
| //! creation of subview_field (subfield comprised of specified columns) | | //! creation of subview_field (subfield comprised of specified columns) | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| const subview_field<oT> | | const subview_field<oT> | |
| field<oT>::cols(const u32 in_col1, const u32 in_col2) const | | field<oT>::cols(const u32 in_col1, const u32 in_col2) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), | | ( (in_col1 > in_col2) || (in_col2 >= n_cols) ), | |
| "field::cols(): indicies out of bounds or incorrectly used" | | "field::cols(): indicies out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_cols = in_col2 - in_col1 + 1; | | const u32 sub_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
|
| return subview_field<oT>(*this, 0, in_col1, n_rows, subfield_n_cols); | | return subview_field<oT>(*this, 0, in_col1, n_rows, sub_n_cols); | |
| } | | } | |
| | | | |
| //! creation of subview_field (subfield with arbitrary dimensions) | | //! creation of subview_field (subfield with arbitrary dimensions) | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| subview_field<oT> | | subview_field<oT> | |
| field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2
, const u32 in_col2) | | field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2
, const u32 in_col2) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i
n_col2 >= n_cols), | | (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i
n_col2 >= n_cols), | |
| "field::subfield(): indices out of bounds or incorrectly used" | | "field::subfield(): indices out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_rows = in_row2 - in_row1 + 1; | | const u32 sub_n_rows = in_row2 - in_row1 + 1; | |
| const u32 subfield_n_cols = in_col2 - in_col1 + 1; | | const u32 sub_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
|
| return subview_field<oT>(*this, in_row1, in_col1, subfield_n_rows, subfie
ld_n_cols); | | return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols)
; | |
| } | | } | |
| | | | |
|
| //! creation of subview_field (generic submatrix) | | //! creation of subview_field (subfield with arbitrary dimensions) | |
| template<typename oT> | | template<typename oT> | |
| inline | | inline | |
| const subview_field<oT> | | const subview_field<oT> | |
| field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2
, const u32 in_col2) const | | field<oT>::subfield(const u32 in_row1, const u32 in_col1, const u32 in_row2
, const u32 in_col2) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| arma_debug_check | | arma_debug_check | |
| ( | | ( | |
| (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i
n_col2 >= n_cols), | | (in_row1 > in_row2) || (in_col1 > in_col2) || (in_row2 >= n_rows) || (i
n_col2 >= n_cols), | |
| "field::subfield(): indices out of bounds or incorrectly used" | | "field::subfield(): indices out of bounds or incorrectly used" | |
| ); | | ); | |
| | | | |
|
| const u32 subfield_n_rows = in_row2 - in_row1 + 1; | | const u32 sub_n_rows = in_row2 - in_row1 + 1; | |
| const u32 subfield_n_cols = in_col2 - in_col1 + 1; | | const u32 sub_n_cols = in_col2 - in_col1 + 1; | |
| | | | |
| | | return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols) | |
| | | ; | |
| | | } | |
| | | | |
| | | //! creation of subview_field (subfield with arbitrary dimensions) | |
| | | template<typename oT> | |
| | | inline | |
| | | subview_field<oT> | |
| | | field<oT>::subfield(const span& row_span, const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const u32 local_n_rows = n_rows; | |
| | | const u32 local_n_cols = n_cols; | |
| | | | |
| | | const u32 in_row1 = row_all ? 0 : row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | const u32 sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; | |
| | | | |
| | | const u32 in_col1 = col_all ? 0 : col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | const u32 sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | || | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "field::subfield(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols) | |
| | | ; | |
| | | } | |
| | | | |
| | | //! creation of subview_field (subfield with arbitrary dimensions) | |
| | | template<typename oT> | |
| | | inline | |
| | | const subview_field<oT> | |
| | | field<oT>::subfield(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const bool row_all = row_span.whole; | |
| | | const bool col_all = col_span.whole; | |
| | | | |
| | | const u32 local_n_rows = n_rows; | |
| | | const u32 local_n_cols = n_cols; | |
| | | | |
| | | const u32 in_row1 = row_all ? 0 : row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | const u32 sub_n_rows = row_all ? local_n_rows : in_row2 - in_row1 + 1; | |
| | | | |
| | | const u32 in_col1 = col_all ? 0 : col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | const u32 sub_n_cols = col_all ? local_n_cols : in_col2 - in_col1 + 1; | |
| | | | |
| | | arma_debug_check | |
| | | ( | |
| | | ( row_all ? false : ((in_row1 > in_row2) || (in_row2 >= local_n_rows)) | |
| | | ) | |
| | | || | |
| | | ( col_all ? false : ((in_col1 > in_col2) || (in_col2 >= local_n_cols)) | |
| | | ) | |
| | | , | |
| | | "field::subfield(): indices out of bounds or incorrectly used" | |
| | | ); | |
| | | | |
| | | return subview_field<oT>(*this, in_row1, in_col1, sub_n_rows, sub_n_cols) | |
| | | ; | |
| | | } | |
| | | | |
| | | template<typename oT> | |
| | | inline | |
| | | subview_field<oT> | |
| | | field<oT>::operator()(const span& row_span, const span& col_span) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
|
| return subview_field<oT>(*this, in_row1, in_col1, subfield_n_rows, subfie | | return (*this).subfield(row_span, col_span); | |
| ld_n_cols); | | } | |
| | | | |
| | | template<typename oT> | |
| | | inline | |
| | | const subview_field<oT> | |
| | | field<oT>::operator()(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | return (*this).subfield(row_span, col_span); | |
| } | | } | |
| | | | |
| //! print contents of the field (to the cout stream), | | //! print contents of the field (to the cout stream), | |
| //! optionally preceding with a user specified line of text. | | //! optionally preceding with a user specified line of text. | |
| //! the field class preserves the stream's flags | | //! the field class preserves the stream's flags | |
| //! but the associated operator<< function for type oT | | //! but the associated operator<< function for type oT | |
| //! may still modify the stream's parameters. | | //! may still modify the stream's parameters. | |
| //! NOTE: this function assumes that type oT can be printed, | | //! NOTE: this function assumes that type oT can be printed, | |
| //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)" | | //! i.e. the function "std::ostream& operator<< (std::ostream&, const oT&)" | |
| //! has been defined. | | //! has been defined. | |
| | | | |
| skipping to change at line 551 | | skipping to change at line 639 | |
| arma_inline | | arma_inline | |
| bool | | bool | |
| field<oT>::is_empty() const | | field<oT>::is_empty() const | |
| { | | { | |
| return (n_elem == 0); | | return (n_elem == 0); | |
| } | | } | |
| | | | |
| //! returns true if the given index is currently in range | | //! returns true if the given index is currently in range | |
| template<typename oT> | | template<typename oT> | |
| arma_inline | | arma_inline | |
|
| | | arma_warn_unused | |
| bool | | bool | |
| field<oT>::in_range(const u32 i) const | | field<oT>::in_range(const u32 i) const | |
| { | | { | |
| return (i < n_elem); | | return (i < n_elem); | |
| } | | } | |
| | | | |
|
| | | //! returns true if the given start and end indices are currently in range | |
| | | template<typename oT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | field<oT>::in_range(const span& x) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | if(x.whole == true) | |
| | | { | |
| | | return true; | |
| | | } | |
| | | else | |
| | | { | |
| | | const u32 a = x.a; | |
| | | const u32 b = x.b; | |
| | | | |
| | | return ( (a <= b) && (b < n_elem) ); | |
| | | } | |
| | | } | |
| | | | |
| //! returns true if the given location is currently in range | | //! returns true if the given location is currently in range | |
| template<typename oT> | | template<typename oT> | |
| arma_inline | | arma_inline | |
|
| | | arma_warn_unused | |
| bool | | bool | |
| field<oT>::in_range(const u32 in_row, const u32 in_col) const | | field<oT>::in_range(const u32 in_row, const u32 in_col) const | |
| { | | { | |
| return ( (in_row < n_rows) && (in_col < n_cols) ); | | return ( (in_row < n_rows) && (in_col < n_cols) ); | |
| } | | } | |
| | | | |
| template<typename oT> | | template<typename oT> | |
|
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | field<oT>::in_range(const span& row_span, const u32 in_col) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | if(row_span.whole == true) | |
| | | { | |
| | | return (in_col < n_cols); | |
| | | } | |
| | | else | |
| | | { | |
| | | const u32 in_row1 = row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | | |
| | | return ( (in_row1 <= in_row2) && (in_row2 < n_rows) && (in_col < n_cols | |
| | | ) ); | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename oT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | field<oT>::in_range(const u32 in_row, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | if(col_span.whole == true) | |
| | | { | |
| | | return (in_row < n_rows); | |
| | | } | |
| | | else | |
| | | { | |
| | | const u32 in_col1 = col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | | |
| | | return ( (in_row < n_rows) && (in_col1 <= in_col2) && (in_col2 < n_cols | |
| | | ) ); | |
| | | } | |
| | | } | |
| | | | |
| | | template<typename oT> | |
| | | arma_inline | |
| | | arma_warn_unused | |
| | | bool | |
| | | field<oT>::in_range(const span& row_span, const span& col_span) const | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const u32 in_row1 = row_span.a; | |
| | | const u32 in_row2 = row_span.b; | |
| | | | |
| | | const u32 in_col1 = col_span.a; | |
| | | const u32 in_col2 = col_span.b; | |
| | | | |
| | | const bool rows_ok = row_span.whole ? true : ( (in_row1 <= in_row2) && (i | |
| | | n_row2 < n_rows) ); | |
| | | const bool cols_ok = col_span.whole ? true : ( (in_col1 <= in_col2) && (i | |
| | | n_col2 < n_cols) ); | |
| | | | |
| | | return ( (rows_ok == true) && (cols_ok == true) ); | |
| | | } | |
| | | | |
| | | template<typename oT> | |
| inline | | inline | |
| bool | | bool | |
| field<oT>::save(const std::string name, const file_type type, const bool pr
int_status) const | | field<oT>::save(const std::string name, const file_type type, const bool pr
int_status) const | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| std::string err_msg; | | std::string err_msg; | |
| const bool save_okay = field_aux::save(*this, name, type, err_msg); | | const bool save_okay = field_aux::save(*this, name, type, err_msg); | |
| | | | |
| if( (print_status == true) && (save_okay == false) ) | | if( (print_status == true) && (save_okay == false) ) | |
| | | | |
End of changes. 17 change blocks. |
| 16 lines changed or deleted | | 200 lines changed or added | |
|
| field_proto.hpp | | field_proto.hpp | |
|
| // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2010 Conrad Sanderson | | // Copyright (C) 2008-2011 Conrad Sanderson | |
| // Copyright (C) 2009-2010 Ian Cullinan | | // Copyright (C) 2009-2010 Ian Cullinan | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 95 | |
| | | | |
| inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
; | | inline subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
; | |
| inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
const; | | inline const subview_field<oT> rows(const u32 in_row1, const u32 in_row2)
const; | |
| | | | |
| inline subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
; | | inline subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
; | |
| inline const subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
const; | | inline const subview_field<oT> cols(const u32 in_col1, const u32 in_col2)
const; | |
| | | | |
| inline subview_field<oT> subfield(const u32 in_row1, const u32 in_c
ol1, const u32 in_row2, const u32 in_col2); | | inline subview_field<oT> subfield(const u32 in_row1, const u32 in_c
ol1, const u32 in_row2, const u32 in_col2); | |
| inline const subview_field<oT> subfield(const u32 in_row1, const u32 in_c
ol1, const u32 in_row2, const u32 in_col2) const; | | inline const subview_field<oT> subfield(const u32 in_row1, const u32 in_c
ol1, const u32 in_row2, const u32 in_col2) const; | |
| | | | |
|
| | | inline subview_field<oT> subfield (const span& row_span, const spa | |
| | | n& col_span); | |
| | | inline const subview_field<oT> subfield (const span& row_span, const spa | |
| | | n& col_span) const; | |
| | | | |
| | | inline subview_field<oT> operator()(const span& row_span, const spa | |
| | | n& col_span); | |
| | | inline const subview_field<oT> operator()(const span& row_span, const spa | |
| | | n& col_span) const; | |
| | | | |
| inline void print(const std::string extra_text = "") const; | | inline void print(const std::string extra_text = "") const; | |
| inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | | inline void print(std::ostream& user_stream, const std::string extra_text
= "") const; | |
| | | | |
| inline void fill(const oT& x); | | inline void fill(const oT& x); | |
| | | | |
| inline void reset(); | | inline void reset(); | |
| inline void reset_objects(); | | inline void reset_objects(); | |
| | | | |
| arma_inline bool is_empty() const; | | arma_inline bool is_empty() const; | |
| | | | |
|
| arma_inline bool in_range(const u32 i) const; | | arma_inline arma_warn_unused bool in_range(const u32 i) const; | |
| arma_inline bool in_range(const u32 in_row, const u32 in_col) const; | | arma_inline arma_warn_unused bool in_range(const span& x) const; | |
| | | | |
| | | arma_inline arma_warn_unused bool in_range(const u32 in_row, const u3 | |
| | | 2 in_col ) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span& row_span, const u3 | |
| | | 2 in_col ) const; | |
| | | arma_inline arma_warn_unused bool in_range(const u32 in_row, const sp | |
| | | an& col_span) const; | |
| | | arma_inline arma_warn_unused bool in_range(const span& row_span, const sp | |
| | | an& col_span) const; | |
| | | | |
| inline bool save(const std::string name, const file_type type = arma_bi
nary, const bool print_status = true) const; | | inline bool save(const std::string name, const file_type type = arma_bi
nary, const bool print_status = true) const; | |
| inline bool save( std::ostream& os, const file_type type = arma_bi
nary, const bool print_status = true) const; | | inline bool save( std::ostream& os, const file_type type = arma_bi
nary, const bool print_status = true) const; | |
| | | | |
| inline bool load(const std::string name, const file_type type = auto_de
tect, const bool print_status = true); | | inline bool load(const std::string name, const file_type type = auto_de
tect, const bool print_status = true); | |
| inline bool load( std::istream& is, const file_type type = auto_de
tect, const bool print_status = true); | | inline bool load( std::istream& is, const file_type type = auto_de
tect, const bool print_status = true); | |
| | | | |
| inline bool quiet_save(const std::string name, const file_type type = a
rma_binary) const; | | inline bool quiet_save(const std::string name, const file_type type = a
rma_binary) const; | |
| inline bool quiet_save( std::ostream& os, const file_type type = a
rma_binary) const; | | inline bool quiet_save( std::ostream& os, const file_type type = a
rma_binary) const; | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 23 lines changed or added | |
|