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 3 | #define ARMA_VERSION_MAJOR 3 | |||
#define ARMA_VERSION_MINOR 920 | #define ARMA_VERSION_MINOR 920 | |||
#define ARMA_VERSION_PATCH 3 | #define ARMA_VERSION_PATCH 4 | |||
#define ARMA_VERSION_NAME "Agencia Nacional Stasi" | #define ARMA_VERSION_NAME "Agencia Nacional Stasi" | |||
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 | |||
fn_shuffle.hpp | fn_shuffle.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2010 Conrad Sanderson | // Copyright (C) 2009-2013 Conrad Sanderson | |||
// Copyright (C) 2009-2010 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2013 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// This Source Code Form is subject to the terms of the Mozilla Public | // This Source Code Form is subject to the terms of the Mozilla Public | |||
// License, v. 2.0. If a copy of the MPL was not distributed with this | // License, v. 2.0. If a copy of the MPL was not distributed with this | |||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |||
//! \addtogroup fn_shuffle | //! \addtogroup fn_shuffle | |||
//! @{ | //! @{ | |||
//! \brief | //! \brief | |||
//! Shuffle the rows or the columns of a matrix or vector in random fashion . | //! Shuffle the rows or the columns of a matrix or vector in random fashion . | |||
//! If dim = 0, shuffle the columns (default operation). | //! If dim = 0, shuffle the columns (default operation). | |||
//! If dim = 1, shuffle the rows. | //! If dim = 1, shuffle the rows. | |||
template<typename T1> | template<typename T1> | |||
inline | arma_inline | |||
const Op<T1, op_shuffle> | const Op<T1, op_shuffle> | |||
shuffle(const Base<typename T1::elem_type,T1>& X, const uword dim = 0) | shuffle | |||
( | ||||
const T1& X, | ||||
const uword dim = 0, | ||||
const typename enable_if< is_arma_type<T1>::value == true >::resul | ||||
t* junk1 = 0, | ||||
const typename enable_if< resolves_to_vector<T1>::value == false >::resul | ||||
t* junk2 = 0 | ||||
) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk1); | ||||
arma_ignore(junk2); | ||||
arma_debug_check( (dim > 1), "shuffle(): dim must be 0 or 1"); | return Op<T1, op_shuffle>(X, dim, 0); | |||
} | ||||
template<typename T1> | ||||
arma_inline | ||||
const Op<T1, op_shuffle> | ||||
shuffle | ||||
( | ||||
const T1& X, | ||||
const uword dim, | ||||
const typename enable_if<resolves_to_vector<T1>::value == true>::result* | ||||
junk = 0 | ||||
) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
arma_ignore(junk); | ||||
return Op<T1, op_shuffle>(X, dim, 0); | ||||
} | ||||
template<typename T1> | ||||
arma_inline | ||||
const Op<T1, op_shuffle> | ||||
shuffle | ||||
( | ||||
const T1& X, | ||||
const arma_empty_class junk1 = arma_empty_class(), | ||||
const typename enable_if<resolves_to_vector<T1>::value == true>::result* | ||||
junk2 = 0 | ||||
) | ||||
{ | ||||
arma_extra_debug_sigprint(); | ||||
arma_ignore(junk1); | ||||
arma_ignore(junk2); | ||||
return Op<T1, op_shuffle>(X.get_ref(), dim, 0); | return T1::is_row ? Op<T1, op_shuffle>(X, 1, 0) : Op<T1, op_shuffle>(X, 0 , 0); | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 6 change blocks. | ||||
6 lines changed or deleted | 49 lines changed or added | |||
op_shuffle_meat.hpp | op_shuffle_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2009-2012 Conrad Sanderson | // Copyright (C) 2009-2013 Conrad Sanderson | |||
// Copyright (C) 2009-2012 NICTA (www.nicta.com.au) | // Copyright (C) 2009-2013 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2009-2010 Dimitrios Bouzas | // Copyright (C) 2009-2010 Dimitrios Bouzas | |||
// | // | |||
// 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 op_shuffle | //! \addtogroup op_shuffle | |||
//! @{ | //! @{ | |||
template<typename T1> | template<typename T1> | |||
skipping to change at line 27 | skipping to change at line 27 | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::elem_type eT; | typedef typename T1::elem_type eT; | |||
const unwrap<T1> tmp(in.m); | const unwrap<T1> tmp(in.m); | |||
const Mat<eT>& X = tmp.M; | const Mat<eT>& X = tmp.M; | |||
if(X.is_empty()) { out.copy_size(X); return; } | if(X.is_empty()) { out.copy_size(X); return; } | |||
const uword dim = in.aux_uword_a; | const uword dim = in.aux_uword_a; | |||
const uword N = (dim == 0) ? X.n_rows : X.n_cols; | ||||
arma_debug_check( (dim > 1), "shuffle(): dim must be 0 or 1" ); | ||||
const uword N = (dim == 0) ? X.n_rows : X.n_cols; | ||||
// see "fn_sort_index.hpp" for the definition of "arma_sort_index_packet" | // see "fn_sort_index.hpp" for the definition of "arma_sort_index_packet" | |||
// and the associated comparison functor | // and the associated comparison functor | |||
std::vector< arma_sort_index_packet<int,uword> > packet_vec(N); | std::vector< arma_sort_index_packet<int,uword> > packet_vec(N); | |||
for(uword i=0; i<N; ++i) | for(uword i=0; i<N; ++i) | |||
{ | { | |||
packet_vec[i].val = std::rand(); | packet_vec[i].val = std::rand(); | |||
packet_vec[i].index = i; | packet_vec[i].index = i; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 6 lines changed or added | |||