| Mat_bones.hpp | | Mat_bones.hpp | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 177 | |
| | | | |
| inline subview<eT> submat (const span& row_span, const span
& col_span); | | inline subview<eT> submat (const span& row_span, const span
& col_span); | |
| inline const subview<eT> submat (const span& row_span, const span
& col_span) const; | | inline const subview<eT> submat (const span& row_span, const span
& col_span) const; | |
| | | | |
| inline subview<eT> operator()(const span& row_span, const span
& col_span); | | inline subview<eT> operator()(const span& row_span, const span
& col_span); | |
| inline const subview<eT> operator()(const span& row_span, const span
& col_span) const; | | inline const subview<eT> operator()(const span& row_span, const span
& col_span) const; | |
| | | | |
| template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a); | | template<typename T1> arma_inline subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a); | |
| template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a) const; | | template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const B
ase<uword,T1>& a) const; | |
| | | | |
|
| | | template<typename T1> arma_inline subview_elem1<eT,T1> operator()(c | |
| | | onst Base<uword,T1>& a); | |
| | | template<typename T1> arma_inline const subview_elem1<eT,T1> operator()(c | |
| | | onst Base<uword,T1>& a) const; | |
| | | | |
| template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | | template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | |
| template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | | template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> elem(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | |
| | | | |
| template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | | template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | |
| template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | | template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> submat(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | |
| | | | |
| template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> operator()(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | | template<typename T1, typename T2> arma_inline subview_elem2<eT,T1,
T2> operator()(const Base<uword,T1>& ri, const Base<uword,T2>& ci); | |
| template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> operator()(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | | template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,
T2> operator()(const Base<uword,T1>& ri, const Base<uword,T2>& ci) const; | |
| | | | |
| template<typename T1> arma_inline subview_elem2<eT,T1,T1> rows(cons
t Base<uword,T1>& ri); | | template<typename T1> arma_inline subview_elem2<eT,T1,T1> rows(cons
t Base<uword,T1>& ri); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 5 lines changed or added | |
|
| SpMat_bones.hpp | | SpMat_bones.hpp | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| inline ~SpMat(); | | inline ~SpMat(); | |
| | | | |
| inline SpMat(const uword in_rows, const uword in_cols); | | inline SpMat(const uword in_rows, const uword in_cols); | |
| | | | |
| inline SpMat(const char* text); | | inline SpMat(const char* text); | |
| inline const SpMat& operator=(const char* text); | | inline const SpMat& operator=(const char* text); | |
| inline SpMat(const std::string& text); | | inline SpMat(const std::string& text); | |
| inline const SpMat& operator=(const std::string& text); | | inline const SpMat& operator=(const std::string& text); | |
| inline SpMat(const SpMat<eT>& x); | | inline SpMat(const SpMat<eT>& x); | |
| | | | |
|
| | | /** | |
| | | * Construct a sparse matrix and insert a large number of points at once. | |
| | | * locations.row[0] should be row indices, locations.row[1] should be col | |
| | | umn | |
| | | * indices, and values should be the corresponding values. If sorted is | |
| | | true, | |
| | | * then it is assumed that the locations and values are already sorted in | |
| | | * column-major ordering. | |
| | | * | |
| | | * The size is automatically determined to be the minimum size to fit all | |
| | | * points in the locations list. | |
| | | */ | |
| | | template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc | |
| | | ations, const Base<eT,T2>& values, const bool sort_locations = true); | |
| | | //! Same as the other batch insertion constructor, but with manual size s | |
| | | pecification. | |
| | | template<typename T1, typename T2> inline SpMat(const Base<uword,T1>& loc | |
| | | ations, const Base<eT,T2>& values, const uword n_rows, const uword n_cols, | |
| | | const bool sort_locations = true); | |
| | | | |
| inline const SpMat& operator=(const eT val); //! Sets size to 1x1. | | inline const SpMat& operator=(const eT val); //! Sets size to 1x1. | |
| inline const SpMat& operator*=(const eT val); | | inline const SpMat& operator*=(const eT val); | |
| inline const SpMat& operator/=(const eT val); | | inline const SpMat& operator/=(const eT val); | |
| // operator+=(val) and operator-=(val) are not defined as they don't make
sense for sparse matrices | | // operator+=(val) and operator-=(val) are not defined as they don't make
sense for sparse matrices | |
| | | | |
| /** | | /** | |
| * Operators on other sparse matrices. These work as though you would ex
pect. | | * Operators on other sparse matrices. These work as though you would ex
pect. | |
| */ | | */ | |
| inline const SpMat& operator=(const SpMat& m); | | inline const SpMat& operator=(const SpMat& m); | |
| inline const SpMat& operator+=(const SpMat& m); | | inline const SpMat& operator+=(const SpMat& m); | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 20 lines changed or added | |
|
| SpMat_meat.hpp | | SpMat_meat.hpp | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 151 | |
| , vec_state(0) | | , vec_state(0) | |
| , values(NULL) | | , values(NULL) | |
| , row_indices(NULL) | | , row_indices(NULL) | |
| , col_ptrs(NULL) | | , col_ptrs(NULL) | |
| { | | { | |
| arma_extra_debug_sigprint_this(this); | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| init(x); | | init(x); | |
| } | | } | |
| | | | |
|
| | | //! Insert a large number of values at once. | |
| | | //! locations.row[0] should be row indices, locations.row[1] should be colu | |
| | | mn indices, | |
| | | //! and values should be the corresponding values. | |
| | | //! If sort_locations is false, then it is assumed that the locations and v | |
| | | alues | |
| | | //! are already sorted in column-major ordering. | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2> | |
| | | inline | |
| | | SpMat<eT>::SpMat(const Base<uword,T1>& locations_expr, const Base<eT,T2>& v | |
| | | als_expr, const bool sort_locations) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , n_nonzero(0) | |
| | | , vec_state(0) | |
| | | , values(NULL) | |
| | | , row_indices(NULL) | |
| | | , col_ptrs(NULL) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | const unwrap<T1> locs_tmp( locations_expr.get_ref() ); | |
| | | const Mat<uword>& locs = locs_tmp.M; | |
| | | | |
| | | const unwrap<T2> vals_tmp( vals_expr.get_ref() ); | |
| | | const Mat<eT>& vals = vals_tmp.M; | |
| | | | |
| | | arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'value | |
| | | s' object is not a vector" ); | |
| | | | |
| | | arma_debug_check((locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of | |
| | | locations is different than number of values"); | |
| | | | |
| | | // If there are no elements in the list, max() will fail. | |
| | | if (locs.n_cols == 0) | |
| | | { | |
| | | init(0, 0); | |
| | | return; | |
| | | } | |
| | | | |
| | | arma_debug_check((locs.n_rows != 2), "SpMat::SpMat(): locations matrix mu | |
| | | st have two rows"); | |
| | | | |
| | | // Automatically determine size (and check if it's sorted). | |
| | | uvec bounds = arma::max(locs, 1); | |
| | | init(bounds[0] + 1, bounds[1] + 1); | |
| | | | |
| | | // Resize to correct number of elements. | |
| | | mem_resize(vals.n_elem); | |
| | | | |
| | | // Reset column pointers to zero. | |
| | | arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); | |
| | | | |
| | | bool actually_sorted = true; | |
| | | if(sort_locations == true) | |
| | | { | |
| | | // sort_index() uses std::sort() which may use quicksort... so we bette | |
| | | r | |
| | | // make sure it's not already sorted before taking an O(N^2) sort penal | |
| | | ty. | |
| | | for (uword i = 1; i < locs.n_cols; ++i) | |
| | | { | |
| | | if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at( | |
| | | 1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) | |
| | | { | |
| | | actually_sorted = false; | |
| | | break; | |
| | | } | |
| | | } | |
| | | | |
| | | if(actually_sorted == false) | |
| | | { | |
| | | // This may not be the fastest possible implementation but it maximiz | |
| | | es code reuse. | |
| | | Col<uword> abslocs(locs.n_cols); | |
| | | | |
| | | for (uword i = 0; i < locs.n_cols; ++i) | |
| | | { | |
| | | abslocs[i] = locs.at(1, i) * n_rows + locs.at(0, i); | |
| | | } | |
| | | | |
| | | // Now we will sort with sort_index(). | |
| | | uvec sorted_indices = sort_index(abslocs); // Ascending sort. | |
| | | | |
| | | // Now we add the elements in this sorted order. | |
| | | for (uword i = 0; i < sorted_indices.n_elem; ++i) | |
| | | { | |
| | | arma_debug_check((locs.at(0, sorted_indices[i]) >= n_rows), "SpMat: | |
| | | :SpMat(): invalid row index"); | |
| | | arma_debug_check((locs.at(1, sorted_indices[i]) >= n_cols), "SpMat: | |
| | | :SpMat(): invalid column index"); | |
| | | | |
| | | access::rw(values[i]) = vals[sorted_indices[i]]; | |
| | | access::rw(row_indices[i]) = locs.at(0, sorted_indices[i]); | |
| | | | |
| | | access::rw(col_ptrs[locs.at(1, sorted_indices[i]) + 1])++; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | if( (sort_locations == false) || (actually_sorted == true) ) | |
| | | { | |
| | | // Now set the values and row indices correctly. | |
| | | // Increment the column pointers in each column (so they are column "co | |
| | | unts"). | |
| | | for (uword i = 0; i < vals.n_elem; ++i) | |
| | | { | |
| | | arma_debug_check((locs.at(0, i) >= n_rows), "SpMat::SpMat(): invalid | |
| | | row index"); | |
| | | arma_debug_check((locs.at(1, i) >= n_cols), "SpMat::SpMat(): invalid | |
| | | column index"); | |
| | | | |
| | | // Check ordering in debug mode. | |
| | | if(i > 0) | |
| | | { | |
| | | arma_debug_check | |
| | | ( | |
| | | ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.a | |
| | | t(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), | |
| | | "SpMat::SpMat(): out of order points; either pass sort_locations | |
| | | = true, or sort points in column-major ordering" | |
| | | ); | |
| | | arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, | |
| | | i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in | |
| | | list"); | |
| | | } | |
| | | | |
| | | access::rw(values[i]) = vals[i]; | |
| | | access::rw(row_indices[i]) = locs.at(0, i); | |
| | | | |
| | | access::rw(col_ptrs[locs.at(1, i) + 1])++; | |
| | | } | |
| | | } | |
| | | | |
| | | // Now fix the column pointers. | |
| | | for (uword i = 0; i <= n_cols; ++i) | |
| | | { | |
| | | access::rw(col_ptrs[i + 1]) += col_ptrs[i]; | |
| | | } | |
| | | } | |
| | | | |
| | | //! Insert a large number of values at once. | |
| | | //! locations.row[0] should be row indices, locations.row[1] should be colu | |
| | | mn indices, | |
| | | //! and values should be the corresponding values. | |
| | | //! If sort_locations is false, then it is assumed that the locations and v | |
| | | alues | |
| | | //! are already sorted in column-major ordering. | |
| | | //! In this constructor the size is explicitly given. | |
| | | template<typename eT> | |
| | | template<typename T1, typename T2> | |
| | | inline | |
| | | SpMat<eT>::SpMat(const Base<uword,T1>& locations_expr, const Base<eT,T2>& v | |
| | | als_expr, const uword in_n_rows, const uword in_n_cols, const bool sort_loc | |
| | | ations) | |
| | | : n_rows(0) | |
| | | , n_cols(0) | |
| | | , n_elem(0) | |
| | | , n_nonzero(0) | |
| | | , vec_state(0) | |
| | | , values(NULL) | |
| | | , row_indices(NULL) | |
| | | , col_ptrs(NULL) | |
| | | { | |
| | | arma_extra_debug_sigprint_this(this); | |
| | | | |
| | | init(in_n_rows, in_n_cols); | |
| | | | |
| | | const unwrap<T1> locs_tmp( locations_expr.get_ref() ); | |
| | | const Mat<uword>& locs = locs_tmp.M; | |
| | | | |
| | | const unwrap<T2> vals_tmp( vals_expr.get_ref() ); | |
| | | const Mat<eT>& vals = vals_tmp.M; | |
| | | | |
| | | arma_debug_check( (vals.is_vec() == false), "SpMat::SpMat(): given 'value | |
| | | s' object is not a vector" ); | |
| | | | |
| | | arma_debug_check((locs.n_rows != 2), "SpMat::SpMat(): locations matrix mu | |
| | | st have two rows"); | |
| | | | |
| | | arma_debug_check((locs.n_cols != vals.n_elem), "SpMat::SpMat(): number of | |
| | | locations is different than number of values"); | |
| | | | |
| | | // Resize to correct number of elements. | |
| | | mem_resize(vals.n_elem); | |
| | | | |
| | | // Reset column pointers to zero. | |
| | | arrayops::inplace_set(access::rwp(col_ptrs), uword(0), n_cols + 1); | |
| | | | |
| | | bool actually_sorted = true; | |
| | | if(sort_locations == true) | |
| | | { | |
| | | // sort_index() uses std::sort() which may use quicksort... so we bette | |
| | | r | |
| | | // make sure it's not already sorted before taking an O(N^2) sort penal | |
| | | ty. | |
| | | for (uword i = 1; i < locs.n_cols; ++i) | |
| | | { | |
| | | if ((locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.at( | |
| | | 1, i - 1) && locs.at(0, i) <= locs.at(0, i - 1))) | |
| | | { | |
| | | actually_sorted = false; | |
| | | break; | |
| | | } | |
| | | } | |
| | | | |
| | | if(actually_sorted == false) | |
| | | { | |
| | | // This may not be the fastest possible implementation but it maximiz | |
| | | es code reuse. | |
| | | Col<uword> abslocs(locs.n_cols); | |
| | | | |
| | | for (uword i = 0; i < locs.n_cols; ++i) | |
| | | { | |
| | | abslocs[i] = locs.at(1, i) * n_rows + locs.at(0, i); | |
| | | } | |
| | | | |
| | | // Now we will sort with sort_index(). | |
| | | uvec sorted_indices = sort_index(abslocs); // Ascending sort. | |
| | | | |
| | | // Now we add the elements in this sorted order. | |
| | | for (uword i = 0; i < sorted_indices.n_elem; ++i) | |
| | | { | |
| | | arma_debug_check((locs.at(0, sorted_indices[i]) >= n_rows), "SpMat: | |
| | | :SpMat(): invalid row index"); | |
| | | arma_debug_check((locs.at(1, sorted_indices[i]) >= n_cols), "SpMat: | |
| | | :SpMat(): invalid column index"); | |
| | | | |
| | | access::rw(values[i]) = vals[sorted_indices[i]]; | |
| | | access::rw(row_indices[i]) = locs.at(0, sorted_indices[i]); | |
| | | | |
| | | access::rw(col_ptrs[locs.at(1, sorted_indices[i]) + 1])++; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | if( (sort_locations == false) || (actually_sorted == true) ) | |
| | | { | |
| | | // Now set the values and row indices correctly. | |
| | | // Increment the column pointers in each column (so they are column "co | |
| | | unts"). | |
| | | for (uword i = 0; i < vals.n_elem; ++i) | |
| | | { | |
| | | arma_debug_check((locs.at(0, i) >= n_rows), "SpMat::SpMat(): invalid | |
| | | row index"); | |
| | | arma_debug_check((locs.at(1, i) >= n_cols), "SpMat::SpMat(): invalid | |
| | | column index"); | |
| | | | |
| | | // Check ordering in debug mode. | |
| | | if(i > 0) | |
| | | { | |
| | | arma_debug_check | |
| | | ( | |
| | | ( (locs.at(1, i) < locs.at(1, i - 1)) || (locs.at(1, i) == locs.a | |
| | | t(1, i - 1) && locs.at(0, i) < locs.at(0, i - 1)) ), | |
| | | "SpMat::SpMat(): out of order points; either pass sort_locations | |
| | | = true or sort points in column-major ordering" | |
| | | ); | |
| | | arma_debug_check((locs.at(1, i) == locs.at(1, i - 1) && locs.at(0, | |
| | | i) == locs.at(0, i - 1)), "SpMat::SpMat(): two identical point locations in | |
| | | list"); | |
| | | } | |
| | | | |
| | | access::rw(values[i]) = vals[i]; | |
| | | access::rw(row_indices[i]) = locs.at(0, i); | |
| | | | |
| | | access::rw(col_ptrs[locs.at(1, i) + 1])++; | |
| | | } | |
| | | } | |
| | | | |
| | | // Now fix the column pointers. | |
| | | for (uword i = 0; i <= n_cols; ++i) | |
| | | { | |
| | | access::rw(col_ptrs[i + 1]) += col_ptrs[i]; | |
| | | } | |
| | | } | |
| | | | |
| /** | | /** | |
| * Simple operators with plain values. These operate on every value in the | | * Simple operators with plain values. These operate on every value in the | |
| * matrix, so a sparse matrix += 1 will turn all those zeroes into ones. B
e | | * matrix, so a sparse matrix += 1 will turn all those zeroes into ones. B
e | |
| * careful and make sure that's what you really want! | | * careful and make sure that's what you really want! | |
| */ | | */ | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| const SpMat<eT>& | | const SpMat<eT>& | |
| SpMat<eT>::operator=(const eT val) | | SpMat<eT>::operator=(const eT val) | |
| { | | { | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 279 lines changed or added | |
|
| armadillo | | armadillo | |
| | | | |
| skipping to change at line 214 | | skipping to change at line 214 | |
| #include "armadillo_bits/op_relational_bones.hpp" | | #include "armadillo_bits/op_relational_bones.hpp" | |
| #include "armadillo_bits/op_find_bones.hpp" | | #include "armadillo_bits/op_find_bones.hpp" | |
| #include "armadillo_bits/op_chol_bones.hpp" | | #include "armadillo_bits/op_chol_bones.hpp" | |
| #include "armadillo_bits/op_cx_scalar_bones.hpp" | | #include "armadillo_bits/op_cx_scalar_bones.hpp" | |
| #include "armadillo_bits/op_trimat_bones.hpp" | | #include "armadillo_bits/op_trimat_bones.hpp" | |
| #include "armadillo_bits/op_cumsum_bones.hpp" | | #include "armadillo_bits/op_cumsum_bones.hpp" | |
| #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/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 395 | | skipping to change at line 396 | |
| #include "armadillo_bits/fn_trunc_exp.hpp" | | #include "armadillo_bits/fn_trunc_exp.hpp" | |
| #include "armadillo_bits/fn_trunc_log.hpp" | | #include "armadillo_bits/fn_trunc_log.hpp" | |
| #include "armadillo_bits/fn_toeplitz.hpp" | | #include "armadillo_bits/fn_toeplitz.hpp" | |
| #include "armadillo_bits/fn_trimat.hpp" | | #include "armadillo_bits/fn_trimat.hpp" | |
| #include "armadillo_bits/fn_cumsum.hpp" | | #include "armadillo_bits/fn_cumsum.hpp" | |
| #include "armadillo_bits/fn_symmat.hpp" | | #include "armadillo_bits/fn_symmat.hpp" | |
| #include "armadillo_bits/fn_syl_lyap.hpp" | | #include "armadillo_bits/fn_syl_lyap.hpp" | |
| #include "armadillo_bits/fn_hist.hpp" | | #include "armadillo_bits/fn_hist.hpp" | |
| #include "armadillo_bits/fn_histc.hpp" | | #include "armadillo_bits/fn_histc.hpp" | |
| #include "armadillo_bits/fn_unique.hpp" | | #include "armadillo_bits/fn_unique.hpp" | |
|
| | | #include "armadillo_bits/fn_fft.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" | |
| | | | |
| // misc stuff | | // misc stuff | |
| | | | |
| #include "armadillo_bits/hdf5_misc.hpp" | | #include "armadillo_bits/hdf5_misc.hpp" | |
|
| | | #include "armadillo_bits/fft_engine.hpp" | |
| | | | |
| // | | // | |
| // class meat | | // class meat | |
| | | | |
| #include "armadillo_bits/gemv.hpp" | | #include "armadillo_bits/gemv.hpp" | |
| #include "armadillo_bits/gemm.hpp" | | #include "armadillo_bits/gemm.hpp" | |
| #include "armadillo_bits/gemm_mixed.hpp" | | #include "armadillo_bits/gemm_mixed.hpp" | |
| | | | |
| #include "armadillo_bits/eop_core_meat.hpp" | | #include "armadillo_bits/eop_core_meat.hpp" | |
| #include "armadillo_bits/eglue_core_meat.hpp" | | #include "armadillo_bits/eglue_core_meat.hpp" | |
| | | | |
| skipping to change at line 484 | | skipping to change at line 487 | |
| #include "armadillo_bits/op_relational_meat.hpp" | | #include "armadillo_bits/op_relational_meat.hpp" | |
| #include "armadillo_bits/op_find_meat.hpp" | | #include "armadillo_bits/op_find_meat.hpp" | |
| #include "armadillo_bits/op_chol_meat.hpp" | | #include "armadillo_bits/op_chol_meat.hpp" | |
| #include "armadillo_bits/op_cx_scalar_meat.hpp" | | #include "armadillo_bits/op_cx_scalar_meat.hpp" | |
| #include "armadillo_bits/op_trimat_meat.hpp" | | #include "armadillo_bits/op_trimat_meat.hpp" | |
| #include "armadillo_bits/op_cumsum_meat.hpp" | | #include "armadillo_bits/op_cumsum_meat.hpp" | |
| #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/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" | |
| | | | |
End of changes. 4 change blocks. |
| 0 lines changed or deleted | | 4 lines changed or added | |
|
| subview_bones.hpp | | subview_bones.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // Copyright (C) 2011 James Sanders | | // Copyright (C) 2011 James Sanders | |
| // | | // | |
| // 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 subview | | //! \addtogroup subview | |
| //! @{ | | //! @{ | |
| | | | |
| //! Class for storing data required to construct or apply operations to a s
ubmatrix | | //! Class for storing data required to construct or apply operations to a s
ubmatrix | |
| | | | |
| skipping to change at line 67 | | skipping to change at line 67 | |
| inline void operator%= (const subview& x); | | inline void operator%= (const subview& x); | |
| inline void operator/= (const subview& x); | | inline void operator/= (const subview& x); | |
| | | | |
| inline static void extract(Mat<eT>& out, const subview& in); | | inline static void extract(Mat<eT>& out, const subview& in); | |
| | | | |
| inline static void plus_inplace(Mat<eT>& out, const subview& in); | | inline static void plus_inplace(Mat<eT>& out, const subview& in); | |
| inline static void minus_inplace(Mat<eT>& out, const subview& in); | | inline static void minus_inplace(Mat<eT>& out, const subview& in); | |
| inline static void schur_inplace(Mat<eT>& out, const subview& in); | | inline static void schur_inplace(Mat<eT>& out, const subview& in); | |
| inline static void div_inplace(Mat<eT>& out, const subview& in); | | inline static void div_inplace(Mat<eT>& out, const subview& in); | |
| | | | |
|
| | | template<typename functor> inline void transform(functor F); | |
| | | template<typename functor> inline void imbue(functor F); | |
| | | | |
| inline void fill(const eT val); | | inline void fill(const eT val); | |
| inline void zeros(); | | inline void zeros(); | |
| inline void ones(); | | inline void ones(); | |
| inline void eye(); | | inline void eye(); | |
| | | | |
| inline eT& operator[](const uword ii); | | inline eT& operator[](const uword ii); | |
| inline eT operator[](const uword ii) const; | | inline eT operator[](const uword ii) const; | |
| | | | |
| inline eT& operator()(const uword ii); | | inline eT& operator()(const uword ii); | |
| inline eT operator()(const uword ii) const; | | inline eT operator()(const uword ii) const; | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|
| subview_cube_bones.hpp | | subview_cube_bones.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // | | // | |
| // 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 subview_cube | | //! \addtogroup subview_cube | |
| //! @{ | | //! @{ | |
| | | | |
| //! Class for storing data required to construct or apply operations to a s
ubcube | | //! Class for storing data required to construct or apply operations to a s
ubcube | |
| //! (i.e. where the subcube starts and ends as well as a reference/pointer
to the original cube), | | //! (i.e. where the subcube starts and ends as well as a reference/pointer
to the original cube), | |
| | | | |
| skipping to change at line 77 | | skipping to change at line 77 | |
| inline static void minus_inplace(Cube<eT>& out, const subview_cube& in); | | inline static void minus_inplace(Cube<eT>& out, const subview_cube& in); | |
| inline static void schur_inplace(Cube<eT>& out, const subview_cube& in); | | inline static void schur_inplace(Cube<eT>& out, const subview_cube& in); | |
| inline static void div_inplace(Cube<eT>& out, const subview_cube& in); | | inline static void div_inplace(Cube<eT>& out, const subview_cube& in); | |
| | | | |
| inline static void extract(Mat<eT>& out, const subview_cube& in); | | inline static void extract(Mat<eT>& out, const subview_cube& in); | |
| inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); | | inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); | |
| inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); | | inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); | |
| inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); | | inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); | |
| inline static void div_inplace(Mat<eT>& out, const subview_cube& in); | | inline static void div_inplace(Mat<eT>& out, const subview_cube& in); | |
| | | | |
|
| | | template<typename functor> inline void transform(functor F); | |
| | | template<typename functor> inline void imbue(functor F); | |
| | | | |
| inline void fill(const eT val); | | inline void fill(const eT val); | |
| inline void zeros(); | | inline void zeros(); | |
| inline void ones(); | | inline void ones(); | |
| | | | |
| inline eT& operator[](const uword i); | | inline eT& operator[](const uword i); | |
| inline eT operator[](const uword i) const; | | inline eT operator[](const uword i) const; | |
| | | | |
| inline eT& operator()(const uword i); | | inline eT& operator()(const uword i); | |
| inline eT operator()(const uword i) const; | | inline eT operator()(const uword i) const; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|
| subview_cube_meat.hpp | | subview_cube_meat.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // | | // | |
| // 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 subview_cube | | //! \addtogroup subview_cube | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| | | | |
| skipping to change at line 826 | | skipping to change at line 826 | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "element-wise division") )
; | | arma_stop( arma_incompat_size_string(t, x, "element-wise division") )
; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
|
| | | //! transform each element in the subview using a functor | |
| | | template<typename eT> | |
| | | template<typename functor> | |
| | | inline | |
| | | void | |
| | | subview_cube<eT>::transform(functor F) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Cube<eT>& Q = const_cast< Cube<eT>& >(m); | |
| | | | |
| | | const uword start_col = aux_col1; | |
| | | const uword start_row = aux_row1; | |
| | | const uword start_slice = aux_slice1; | |
| | | | |
| | | const uword end_col_plus1 = start_col + n_cols; | |
| | | const uword end_row_plus1 = start_row + n_rows; | |
| | | const uword end_slice_plus1 = start_slice + n_slices; | |
| | | | |
| | | for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) | |
| | | for(uword urow = start_row; urow < end_row_plus1; ++urow ) | |
| | | { | |
| | | Q.at(urow, ucol, uslice) = eT( F( Q.at(urow, ucol, uslice) ) ); | |
| | | } | |
| | | } | |
| | | | |
| | | //! imbue (fill) the subview with values provided by a functor | |
| | | template<typename eT> | |
| | | template<typename functor> | |
| | | inline | |
| | | void | |
| | | subview_cube<eT>::imbue(functor F) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | Cube<eT>& Q = const_cast< Cube<eT>& >(m); | |
| | | | |
| | | const uword start_col = aux_col1; | |
| | | const uword start_row = aux_row1; | |
| | | const uword start_slice = aux_slice1; | |
| | | | |
| | | const uword end_col_plus1 = start_col + n_cols; | |
| | | const uword end_row_plus1 = start_row + n_rows; | |
| | | const uword end_slice_plus1 = start_slice + n_slices; | |
| | | | |
| | | for(uword uslice = start_slice; uslice < end_slice_plus1; ++uslice) | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol ) | |
| | | for(uword urow = start_row; urow < end_row_plus1; ++urow ) | |
| | | { | |
| | | Q.at(urow, ucol, uslice) = eT( F() ); | |
| | | } | |
| | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview_cube<eT>::fill(const eT val) | | subview_cube<eT>::fill(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword local_n_rows = n_rows; | | const uword local_n_rows = n_rows; | |
| const uword local_n_cols = n_cols; | | const uword local_n_cols = n_cols; | |
| const uword local_n_slices = n_slices; | | const uword local_n_slices = n_slices; | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 56 lines changed or added | |
|
| subview_meat.hpp | | subview_meat.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // Copyright (C) 2011 James Sanders | | // Copyright (C) 2011 James Sanders | |
| // | | // | |
| // 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 subview | | //! \addtogroup subview | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| | | | |
| skipping to change at line 1018 | | skipping to change at line 1018 | |
| } | | } | |
| | | | |
| if(overlap) | | if(overlap) | |
| { | | { | |
| delete tmp_subview; | | delete tmp_subview; | |
| delete tmp_mat; | | delete tmp_mat; | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
|
| | | //! transform each element in the subview using a functor | |
| | | template<typename eT> | |
| | | template<typename functor> | |
| | | inline | |
| | | void | |
| | | subview<eT>::transform(functor F) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const uword local_n_cols = n_cols; | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | Mat<eT>& X = const_cast< Mat<eT>& >(m); | |
| | | | |
| | | if(local_n_rows == 1) | |
| | | { | |
| | | const uword urow = aux_row1; | |
| | | const uword start_col = aux_col1; | |
| | | const uword end_col_plus1 = start_col + local_n_cols; | |
| | | | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) | |
| | | { | |
| | | X.at(urow, ucol) = eT( F( X.at(urow, ucol) ) ); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword start_col = aux_col1; | |
| | | const uword start_row = aux_row1; | |
| | | | |
| | | const uword end_col_plus1 = start_col + local_n_cols; | |
| | | const uword end_row_plus1 = start_row + local_n_rows; | |
| | | | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) | |
| | | for(uword urow = start_row; urow < end_row_plus1; ++urow) | |
| | | { | |
| | | X.at(urow, ucol) = eT( F( X.at(urow, ucol) ) ); | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | //! imbue (fill) the subview with values provided by a functor | |
| | | template<typename eT> | |
| | | template<typename functor> | |
| | | inline | |
| | | void | |
| | | subview<eT>::imbue(functor F) | |
| | | { | |
| | | arma_extra_debug_sigprint(); | |
| | | | |
| | | const uword local_n_cols = n_cols; | |
| | | const uword local_n_rows = n_rows; | |
| | | | |
| | | Mat<eT>& X = const_cast< Mat<eT>& >(m); | |
| | | | |
| | | if(local_n_rows == 1) | |
| | | { | |
| | | const uword urow = aux_row1; | |
| | | const uword start_col = aux_col1; | |
| | | const uword end_col_plus1 = start_col + local_n_cols; | |
| | | | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) | |
| | | { | |
| | | X.at(urow, ucol) = eT( F() ); | |
| | | } | |
| | | } | |
| | | else | |
| | | { | |
| | | const uword start_col = aux_col1; | |
| | | const uword start_row = aux_row1; | |
| | | | |
| | | const uword end_col_plus1 = start_col + local_n_cols; | |
| | | const uword end_row_plus1 = start_row + local_n_rows; | |
| | | | |
| | | for(uword ucol = start_col; ucol < end_col_plus1; ++ucol) | |
| | | for(uword urow = start_row; urow < end_row_plus1; ++urow) | |
| | | { | |
| | | X.at(urow, ucol) = eT( F() ); | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| subview<eT>::fill(const eT val) | | subview<eT>::fill(const eT val) | |
| { | | { | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| const uword local_n_cols = n_cols; | | const uword local_n_cols = n_cols; | |
| const uword local_n_rows = n_rows; | | const uword local_n_rows = n_rows; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 84 lines changed or added | |
|
| traits.hpp | | traits.hpp | |
|
| // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2012 Conrad Sanderson | | // Copyright (C) 2008-2013 Conrad Sanderson | |
| // | | // | |
| // 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 traits | | //! \addtogroup traits | |
| //! @{ | | //! @{ | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct get_pod_type | | struct get_pod_type | |
| | | | |
| skipping to change at line 789 | | skipping to change at line 789 | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_double | | struct is_double | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<> | | template<> | |
| struct is_double<double> | | struct is_double<double> | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
|
| | | struct is_real | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<> | |
| | | struct is_real<float> | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<> | |
| | | struct is_real<double> | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<typename T1> | |
| struct is_not_complex | | struct is_not_complex | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| struct is_not_complex< std::complex<eT> > | | struct is_not_complex< std::complex<eT> > | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_complex | | struct is_complex | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| skipping to change at line 821 | | skipping to change at line 833 | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
| template<typename T1> | | template<typename T1> | |
| struct is_complex_double | | struct is_complex_double | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| template<> | | template<> | |
| struct is_complex_double< std::complex<double> > | | struct is_complex_double< std::complex<double> > | |
| { static const bool value = true; }; | | { static const bool value = true; }; | |
| | | | |
|
| | | template<typename T1> | |
| | | struct is_complex_strict | |
| | | { static const bool value = false; }; | |
| | | | |
| | | template<> | |
| | | struct is_complex_strict< std::complex<float> > | |
| | | { static const bool value = true; }; | |
| | | | |
| | | template<> | |
| | | struct is_complex_strict< std::complex<double> > | |
| | | { static const bool value = true; }; | |
| | | | |
| //! check for a weird implementation of the std::complex class | | //! check for a weird implementation of the std::complex class | |
| template<typename T1> | | template<typename T1> | |
| struct is_supported_complex | | struct is_supported_complex | |
| { static const bool value = false; }; | | { static const bool value = false; }; | |
| | | | |
| //template<> | | //template<> | |
| template<typename eT> | | template<typename eT> | |
| struct is_supported_complex< std::complex<eT> > | | struct is_supported_complex< std::complex<eT> > | |
| { static const bool value = ( sizeof(std::complex<eT>) == 2*sizeof(eT) );
}; | | { static const bool value = ( sizeof(std::complex<eT>) == 2*sizeof(eT) );
}; | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 26 lines changed or added | |
|