arma_version.hpp | arma_version.hpp | |||
---|---|---|---|---|
skipping to change at line 18 | skipping to change at line 18 | |||
// 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) | |||
//! \addtogroup arma_version | //! \addtogroup arma_version | |||
//! @{ | //! @{ | |||
#define ARMA_VERSION_MAJOR 3 | #define ARMA_VERSION_MAJOR 3 | |||
#define ARMA_VERSION_MINOR 4 | #define ARMA_VERSION_MINOR 4 | |||
#define ARMA_VERSION_PATCH 2 | #define ARMA_VERSION_PATCH 3 | |||
#define ARMA_VERSION_NAME "Ku De Ta" | #define ARMA_VERSION_NAME "Ku De Ta" | |||
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_diagmat.hpp | fn_diagmat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2010 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | |||
// Copyright (C) 2008-2010 Conrad Sanderson | // Copyright (C) 2008-2012 Conrad Sanderson | |||
// | // | |||
// 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) | |||
//! \addtogroup fn_diagmat | //! \addtogroup fn_diagmat | |||
//! @{ | //! @{ | |||
//! interpret a matrix or a vector as a diagonal matrix (i.e. off-diagonal entries are zero) | //! interpret a matrix or a vector as a diagonal matrix (i.e. off-diagonal entries are zero) | |||
template<typename T1> | template<typename T1> | |||
arma_inline | arma_inline | |||
const Op<T1, op_diagmat> | typename | |||
diagmat(const Base<typename T1::elem_type,T1>& X) | enable_if2 | |||
< | ||||
is_arma_type<T1>::value, | ||||
const Op<T1, op_diagmat> | ||||
>::result | ||||
diagmat(const T1& X) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
return Op<T1, op_diagmat>(X.get_ref()); | return Op<T1, op_diagmat>(X); | |||
} | } | |||
// TODO: | // TODO: | |||
// create "op_diagmat2", to allow placement of vector onto a sub- or super- diagonal. | // create "op_diagmat2", to allow placement of vector onto a sub- or super- diagonal. | |||
// op_diagmat2 is required, as other code assumes that op_diagmat indicates only the main diagonal) | // op_diagmat2 is required, as other code assumes that op_diagmat indicates only the main diagonal) | |||
//! @} | //! @} | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 10 lines changed or added | |||
fn_speye.hpp | fn_speye.hpp | |||
---|---|---|---|---|
// Copyright (C) 2012 Conrad Sanderson | // Copyright (C) 2012 Conrad Sanderson | |||
// Copyright (C) 2012 Ryan Curtin | ||||
// | // | |||
// 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) | |||
//! \addtogroup fn_speye | //! \addtogroup fn_speye | |||
//! @{ | //! @{ | |||
//! Generate a sparse matrix with the values along the main diagonal set to one | //! Generate a sparse matrix with the values along the main diagonal set to one | |||
template<typename eT> | template<typename obj_type> | |||
inline | inline | |||
SpMat<eT> | obj_type | |||
speye(const uword n_rows, const uword n_cols) | speye(const uword n_rows, const uword n_cols, const typename arma_SpMat_SpC | |||
ol_SpRow_only<obj_type>::result* junk = NULL) | ||||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
arma_ignore(junk); | ||||
SpMat<eT> out; | obj_type out; | |||
out.eye(n_rows, n_cols); | out.eye(n_rows, n_cols); | |||
return out; | return out; | |||
} | } | |||
// Convenience shortcut method (no template parameter necessary) | ||||
inline | inline | |||
sp_mat | sp_mat | |||
speye(const uword n_rows, const uword n_cols) | speye(const uword n_rows, const uword n_cols) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
sp_mat out; | sp_mat out; | |||
out.eye(n_rows, n_cols); | out.eye(n_rows, n_cols); | |||
End of changes. 6 change blocks. | ||||
4 lines changed or deleted | 8 lines changed or added | |||
op_diagmat_meat.hpp | op_diagmat_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 100 | skipping to change at line 100 | |||
for(uword i=0; i < N; ++i) { tmp_mem[i] = P.at(i,0); } | for(uword i=0; i < N; ++i) { tmp_mem[i] = P.at(i,0); } | |||
} | } | |||
} | } | |||
out.zeros(N, N); | out.zeros(N, N); | |||
for(uword i=0; i < N; ++i) { out.at(i,i) = tmp_mem[i]; } | for(uword i=0; i < N; ++i) { out.at(i,i) = tmp_mem[i]; } | |||
} | } | |||
else // generate a diagonal matrix out of a matrix | else // generate a diagonal matrix out of a matrix | |||
{ | { | |||
// NOTE: we're assuming that the output matrix is the same as the mat | ||||
rix provided by the Proxy, | ||||
// NOTE: and the alias is not due to a matrix using auxiliary memory; | ||||
// NOTE: this assumption is currently valid for matrices, but not for | ||||
vectors; | ||||
// NOTE: as we've checked that at this point in code we're dealing wi | ||||
th a matrix, | ||||
// NOTE: the assumption is thus currently valid | ||||
arma_debug_check( (n_rows != n_cols), "diagmat(): given matrix is not square" ); | arma_debug_check( (n_rows != n_cols), "diagmat(): given matrix is not square" ); | |||
for(uword i=0; i < n_rows; ++i) | if( (Proxy<T1>::has_subview == false) && (Proxy<T1>::fake_mat == fals | |||
e) ) | ||||
{ | ||||
// NOTE: we have aliasing and it's not due to a subview, hence we'r | ||||
e assuming that the output matrix already has the correct size | ||||
for(uword i=0; i < n_rows; ++i) | ||||
{ | ||||
const eT val = P.at(i,i); | ||||
arrayops::inplace_set(out.colptr(i), eT(0), n_rows); | ||||
out.at(i,i) = val; | ||||
} | ||||
} | ||||
else | ||||
{ | { | |||
eT* colptr = out.colptr(i); | podarray<eT> tmp(n_rows); | |||
eT* tmp_mem = tmp.memptr(); | ||||
for(uword i=0; i < n_rows; ++i) { tmp_mem[i] = P.at(i,i); } | ||||
// clear above the diagonal | out.zeros(n_rows, n_rows); | |||
arrayops::inplace_set(colptr, eT(0), i); | ||||
// clear below the diagonal | for(uword i=0; i < n_rows; ++i) { out.at(i,i) = tmp_mem[i]; } | |||
arrayops::inplace_set(colptr+(i+1), eT(0), n_rows-1-i); | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 5 change blocks. | ||||
15 lines changed or deleted | 22 lines changed or added | |||