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 600 | #define ARMA_VERSION_MINOR 600 | |||
#define ARMA_VERSION_PATCH 1 | #define ARMA_VERSION_PATCH 2 | |||
#define ARMA_VERSION_NAME "Off The Reservation" | #define ARMA_VERSION_NAME "Off The Reservation" | |||
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 | |||
glue_times_meat.hpp | glue_times_meat.hpp | |||
---|---|---|---|---|
skipping to change at line 402 | skipping to change at line 402 | |||
} | } | |||
template<typename T1> | template<typename T1> | |||
arma_hot | arma_hot | |||
inline | inline | |||
void | void | |||
glue_times::apply_inplace(Mat<typename T1::elem_type>& out, const T1& X) | glue_times::apply_inplace(Mat<typename T1::elem_type>& out, const T1& X) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
typedef typename T1::elem_type eT; | out = out * X; | |||
const unwrap_check<T1> B_tmp(X, out); | ||||
const Mat<eT>& B = B_tmp.M; | ||||
arma_debug_assert_mul_size(out, B, "matrix multiplication"); | ||||
const uword out_n_rows = out.n_rows; | ||||
const uword out_n_cols = out.n_cols; | ||||
if(out_n_cols == B.n_cols) | ||||
{ | ||||
// size of resulting matrix is the same as 'out' | ||||
podarray<eT> tmp(out_n_cols); | ||||
eT* tmp_rowdata = tmp.memptr(); | ||||
for(uword row=0; row < out_n_rows; ++row) | ||||
{ | ||||
tmp.copy_row(out, row); | ||||
for(uword col=0; col < out_n_cols; ++col) | ||||
{ | ||||
out.at(row,col) = op_dot::direct_dot( out_n_cols, tmp_rowdata, B.co | ||||
lptr(col) ); | ||||
} | ||||
} | ||||
} | ||||
else | ||||
{ | ||||
const Mat<eT> tmp(out); | ||||
glue_times::apply<eT, false, false, false>(out, tmp, B, eT(1)); | ||||
} | ||||
} | } | |||
template<typename T1, typename T2> | template<typename T1, typename T2> | |||
arma_hot | arma_hot | |||
inline | inline | |||
void | void | |||
glue_times::apply_inplace_plus(Mat<typename T1::elem_type>& out, const Glue <T1, T2, glue_times>& X, const sword sign) | glue_times::apply_inplace_plus(Mat<typename T1::elem_type>& out, const Glue <T1, T2, glue_times>& X, const sword sign) | |||
{ | { | |||
arma_extra_debug_sigprint(); | arma_extra_debug_sigprint(); | |||
End of changes. 1 change blocks. | ||||
37 lines changed or deleted | 1 lines changed or added | |||
op_sum_meat.hpp | op_sum_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2013 Conrad Sanderson | // Copyright (C) 2008-2015 Conrad Sanderson | |||
// Copyright (C) 2008-2013 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2015 NICTA (www.nicta.com.au) | |||
// | // | |||
// 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_sum | //! \addtogroup op_sum | |||
//! @{ | //! @{ | |||
//! \brief | //! \brief | |||
//! Immediate sum of elements of a matrix along a specified dimension (eith er rows or columns). | //! Immediate sum of elements of a matrix along a specified dimension (eith er rows or columns). | |||
skipping to change at line 62 | skipping to change at line 62 | |||
} | } | |||
} | } | |||
else // traverse across columns (i.e. find the sum in each row) | else // traverse across columns (i.e. find the sum in each row) | |||
{ | { | |||
out.set_size(X_n_rows, 1); | out.set_size(X_n_rows, 1); | |||
eT* out_mem = out.memptr(); | eT* out_mem = out.memptr(); | |||
for(uword row=0; row < X_n_rows; ++row) | for(uword row=0; row < X_n_rows; ++row) | |||
{ | { | |||
eT val = eT(0); | eT val1 = eT(0); | |||
eT val2 = eT(0); | ||||
uword i,j; | const eT* rowptr = &(X.at(row,0)); | |||
for(i=0, j=1; j < X_n_cols; i+=2, j+=2) | ||||
uword j; | ||||
for(j=1; j < X_n_cols; j+=2) | ||||
{ | { | |||
val += X.at(row,i); | val1 += (*rowptr); rowptr += X_n_rows; | |||
val += X.at(row,j); | val2 += (*rowptr); rowptr += X_n_rows; | |||
} | } | |||
if(i < X_n_cols) | if((j-1) < X_n_cols) | |||
{ | { | |||
val += X.at(row,i); | val1 += (*rowptr); | |||
} | } | |||
out_mem[row] = val; | out_mem[row] = (val1 + val2); | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
const uword P_n_rows = P.get_n_rows(); | const uword P_n_rows = P.get_n_rows(); | |||
const uword P_n_cols = P.get_n_cols(); | const uword P_n_cols = P.get_n_cols(); | |||
if(dim == 0) // traverse across rows (i.e. find the sum in each column ) | if(dim == 0) // traverse across rows (i.e. find the sum in each column ) | |||
{ | { | |||
out.set_size(1, P_n_cols); | out.set_size(1, P_n_cols); | |||
eT* out_mem = out.memptr(); | eT* out_mem = out.memptr(); | |||
for(uword col=0; col < P_n_cols; ++col) | for(uword col=0; col < P_n_cols; ++col) | |||
{ | { | |||
eT val = eT(0); | eT val1 = eT(0); | |||
eT val2 = eT(0); | ||||
uword i,j; | uword i,j; | |||
for(i=0, j=1; j < P_n_rows; i+=2, j+=2) | for(i=0, j=1; j < P_n_rows; i+=2, j+=2) | |||
{ | { | |||
val += P.at(i,col); | val1 += P.at(i,col); | |||
val += P.at(j,col); | val2 += P.at(j,col); | |||
} | } | |||
if(i < P_n_rows) | if(i < P_n_rows) | |||
{ | { | |||
val += P.at(i,col); | val1 += P.at(i,col); | |||
} | } | |||
out_mem[col] = val; | out_mem[col] = (val1 + val2); | |||
} | } | |||
} | } | |||
else // traverse across columns (i.e. find the sum in each row) | else // traverse across columns (i.e. find the sum in each row) | |||
{ | { | |||
out.set_size(P_n_rows, 1); | out.set_size(P_n_rows, 1); | |||
eT* out_mem = out.memptr(); | eT* out_mem = out.memptr(); | |||
for(uword row=0; row < P_n_rows; ++row) | for(uword row=0; row < P_n_rows; ++row) | |||
{ | { | |||
eT val = eT(0); | eT val1 = eT(0); | |||
eT val2 = eT(0); | ||||
uword i,j; | uword i,j; | |||
for(i=0, j=1; j < P_n_cols; i+=2, j+=2) | for(i=0, j=1; j < P_n_cols; i+=2, j+=2) | |||
{ | { | |||
val += P.at(row,i); | val1 += P.at(row,i); | |||
val += P.at(row,j); | val2 += P.at(row,j); | |||
} | } | |||
if(i < P_n_cols) | if(i < P_n_cols) | |||
{ | { | |||
val += P.at(row,i); | val1 += P.at(row,i); | |||
} | } | |||
out_mem[row] = val; | out_mem[row] = (val1 + val2); | |||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
//! @} | //! @} | |||
End of changes. 15 change blocks. | ||||
20 lines changed or deleted | 25 lines changed or added | |||