Mat_bones.hpp | Mat_bones.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2013 Conrad Sanderson | // Copyright (C) 2008-2014 Conrad Sanderson | |||
// Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2014 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2012 Ryan Curtin | // Copyright (C) 2012 Ryan Curtin | |||
// | // | |||
// 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 Mat | //! \addtogroup Mat | |||
//! @{ | //! @{ | |||
//! Dense matrix class | //! Dense matrix class | |||
skipping to change at line 500 | skipping to change at line 500 | |||
inline const_row_iterator end_row (const uword row_num) const; | inline const_row_iterator end_row (const uword row_num) const; | |||
inline void clear(); | inline void clear(); | |||
inline bool empty() const; | inline bool empty() const; | |||
inline uword size() const; | inline uword size() const; | |||
inline void swap(Mat& B); | inline void swap(Mat& B); | |||
inline void steal_mem(Mat& X); //!< don't use this unless you're writing code internal to Armadillo | inline void steal_mem(Mat& X); //!< don't use this unless you're writing code internal to Armadillo | |||
inline void steal_mem_col(Mat& X, const uword max_n_rows); | ||||
template<uword fixed_n_rows, uword fixed_n_cols> class fixed; | template<uword fixed_n_rows, uword fixed_n_cols> class fixed; | |||
protected: | protected: | |||
inline void init_cold(); | inline void init_cold(); | |||
inline void init_warm(uword in_rows, uword in_cols); | inline void init_warm(uword in_rows, uword in_cols); | |||
inline void init(const std::string& text); | inline void init(const std::string& text); | |||
#if defined(ARMA_USE_CXX11) | #if defined(ARMA_USE_CXX11) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 4 lines changed or added | |||
Mat_meat.hpp | Mat_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2013 Conrad Sanderson | // Copyright (C) 2008-2014 Conrad Sanderson | |||
// Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2014 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2012 Ryan Curtin | // Copyright (C) 2012 Ryan Curtin | |||
// | // | |||
// 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 Mat | //! \addtogroup Mat | |||
//! @{ | //! @{ | |||
template<typename eT> | template<typename eT> | |||
skipping to change at line 950 | skipping to change at line 950 | |||
access::rw(x.mem_state) = 0; | access::rw(x.mem_state) = 0; | |||
access::rw(x.mem) = 0; | access::rw(x.mem) = 0; | |||
} | } | |||
else | else | |||
{ | { | |||
(*this).operator=(x); | (*this).operator=(x); | |||
} | } | |||
} | } | |||
} | } | |||
template<typename eT> | ||||
inline | ||||
void | ||||
Mat<eT>::steal_mem_col(Mat<eT>& x, const uword max_n_rows) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
const uword x_n_elem = x.n_elem; | ||||
const uword x_mem_state = x.mem_state; | ||||
const uword t_vec_state = vec_state; | ||||
const uword t_mem_state = mem_state; | ||||
const uword alt_n_rows = (std::min)(x.n_rows, max_n_rows); | ||||
if((x_n_elem == 0) || (alt_n_rows == 0)) | ||||
{ | ||||
(*this).set_size(0,1); | ||||
return; | ||||
} | ||||
if( (this != &x) && (t_vec_state <= 1) && (t_mem_state <= 1) && (x_mem_st | ||||
ate <= 1) ) | ||||
{ | ||||
if( (x_mem_state == 0) && ((x_n_elem <= arma_config::mat_prealloc) || ( | ||||
alt_n_rows <= arma_config::mat_prealloc)) ) | ||||
{ | ||||
(*this).set_size(alt_n_rows, uword(1)); | ||||
arrayops::copy( (*this).memptr(), x.memptr(), alt_n_rows ); | ||||
} | ||||
else | ||||
{ | ||||
reset(); | ||||
access::rw(n_rows) = alt_n_rows; | ||||
access::rw(n_cols) = 1; | ||||
access::rw(n_elem) = alt_n_rows; | ||||
access::rw(mem_state) = x_mem_state; | ||||
access::rw(mem) = x.mem; | ||||
access::rw(x.n_rows) = 0; | ||||
access::rw(x.n_cols) = 0; | ||||
access::rw(x.n_elem) = 0; | ||||
access::rw(x.mem_state) = 0; | ||||
access::rw(x.mem) = 0; | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
Mat<eT> tmp(alt_n_rows, 1); | ||||
arrayops::copy( tmp.memptr(), x.memptr(), alt_n_rows ); | ||||
steal_mem(tmp); | ||||
} | ||||
} | ||||
//! construct a matrix from a given auxiliary array of eTs. | //! construct a matrix from a given auxiliary array of eTs. | |||
//! if copy_aux_mem is true, new memory is allocated and the array is copie d. | //! if copy_aux_mem is true, new memory is allocated and the array is copie d. | |||
//! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). | //! if copy_aux_mem is false, the auxiliary array is used directly (without allocating memory and copying). | |||
//! the default is to copy the array. | //! the default is to copy the array. | |||
template<typename eT> | template<typename eT> | |||
inline | inline | |||
Mat<eT>::Mat(eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, c onst bool copy_aux_mem, const bool strict) | Mat<eT>::Mat(eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, c onst bool copy_aux_mem, const bool strict) | |||
: n_rows ( aux_n_rows ) | : n_rows ( aux_n_rows ) | |||
, n_cols ( aux_n_cols ) | , n_cols ( aux_n_cols ) | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 61 lines changed or added | |||
arma_version.hpp | arma_version.hpp | |||
---|---|---|---|---|
skipping to change at line 13 | skipping to change at line 13 | |||
// | // | |||
// 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 arma_version | //! \addtogroup arma_version | |||
//! @{ | //! @{ | |||
#define ARMA_VERSION_MAJOR 4 | #define ARMA_VERSION_MAJOR 4 | |||
#define ARMA_VERSION_MINOR 300 | #define ARMA_VERSION_MINOR 300 | |||
#define ARMA_VERSION_PATCH 0 | #define ARMA_VERSION_PATCH 2 | |||
#define ARMA_VERSION_NAME "Medieval Cornea Scraper" | #define ARMA_VERSION_NAME "Medieval Cornea Scraper" | |||
struct arma_version | struct arma_version | |||
{ | { | |||
static const unsigned int major = ARMA_VERSION_MAJOR; | static const unsigned int major = ARMA_VERSION_MAJOR; | |||
static const unsigned int minor = ARMA_VERSION_MINOR; | static const unsigned int minor = ARMA_VERSION_MINOR; | |||
static const unsigned int patch = ARMA_VERSION_PATCH; | static const unsigned int patch = ARMA_VERSION_PATCH; | |||
static | static | |||
inline | inline | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
op_find_meat.hpp | op_find_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 435 | skipping to change at line 435 | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_find_simple::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_simple >& X) | op_find_simple::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_simple >& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
Mat<uword> indices; | Mat<uword> indices; | |||
const uword n_nz = op_find::helper(indices, X.m); | const uword n_nz = op_find::helper(indices, X.m); | |||
if(n_nz > 0) | out.steal_mem_col(indices, n_nz); | |||
{ | ||||
if(n_nz == indices.n_elem) | ||||
{ | ||||
out.steal_mem(indices); | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(n_nz, 1); | ||||
arrayops::copy( out.memptr(), indices.memptr(), n_nz ); | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(0,1); | ||||
} | ||||
} | } | |||
// | // | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_find_finite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_finite >& X) | op_find_finite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_finite >& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
skipping to change at line 496 | skipping to change at line 481 | |||
for(uword col=0; col<n_cols; ++col) | for(uword col=0; col<n_cols; ++col) | |||
for(uword row=0; row<n_rows; ++row) | for(uword row=0; row<n_rows; ++row) | |||
{ | { | |||
if( arma_isfinite(P.at(row,col)) ) { indices_mem[count] = i; count++ ; } | if( arma_isfinite(P.at(row,col)) ) { indices_mem[count] = i; count++ ; } | |||
i++; | i++; | |||
} | } | |||
} | } | |||
if(count > 0) | out.steal_mem_col(indices, count); | |||
{ | ||||
if(count == n_elem) | ||||
{ | ||||
out.steal_mem(indices); | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(count,1); | ||||
arrayops::copy( out.memptr(), indices.memptr(), count ); | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(0,1); | ||||
} | ||||
} | } | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
void | void | |||
op_find_nonfinite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_non finite>& X) | op_find_nonfinite::apply(Mat<uword>& out, const mtOp<uword, T1, op_find_non finite>& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
const Proxy<T1> P(X.m); | const Proxy<T1> P(X.m); | |||
skipping to change at line 555 | skipping to change at line 525 | |||
for(uword col=0; col<n_cols; ++col) | for(uword col=0; col<n_cols; ++col) | |||
for(uword row=0; row<n_rows; ++row) | for(uword row=0; row<n_rows; ++row) | |||
{ | { | |||
if( arma_isfinite(P.at(row,col)) == false ) { indices_mem[count] = i ; count++; } | if( arma_isfinite(P.at(row,col)) == false ) { indices_mem[count] = i ; count++; } | |||
i++; | i++; | |||
} | } | |||
} | } | |||
if(count > 0) | out.steal_mem_col(indices, count); | |||
{ | ||||
if(count == n_elem) | ||||
{ | ||||
out.steal_mem(indices); | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(count,1); | ||||
arrayops::copy( out.memptr(), indices.memptr(), count ); | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
out.set_size(0,1); | ||||
} | ||||
} | } | |||
//! @} | //! @} | |||
End of changes. 3 change blocks. | ||||
48 lines changed or deleted | 3 lines changed or added | |||