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 900 | #define ARMA_VERSION_MINOR 900 | |||
#define ARMA_VERSION_PATCH 6 | #define ARMA_VERSION_PATCH 7 | |||
#define ARMA_VERSION_NAME "Bavarian Sunflower" | #define ARMA_VERSION_NAME "Bavarian Sunflower" | |||
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_reshape_meat.hpp | op_reshape_meat.hpp | |||
---|---|---|---|---|
// Copyright (C) 2008-2012 NICTA (www.nicta.com.au) | // Copyright (C) 2008-2013 Conrad Sanderson | |||
// Copyright (C) 2008-2012 Conrad Sanderson | // Copyright (C) 2008-2013 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_reshape | //! \addtogroup op_reshape | |||
//! @{ | //! @{ | |||
template<typename T1> | template<typename T1> | |||
inline | inline | |||
skipping to change at line 42 | skipping to change at line 42 | |||
{ | { | |||
if(in_dim == 0) | if(in_dim == 0) | |||
{ | { | |||
if(is_alias == false) | if(is_alias == false) | |||
{ | { | |||
out.set_size(in_n_rows, in_n_cols); | out.set_size(in_n_rows, in_n_cols); | |||
arrayops::copy( out.memptr(), A.memptr(), out.n_elem ); | arrayops::copy( out.memptr(), A.memptr(), out.n_elem ); | |||
} | } | |||
else // &out == &A, i.e. inplace resize | else // &out == &A, i.e. inplace resize | |||
{ | { | |||
const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = | out.set_size(in_n_rows, in_n_cols); | |||
= in_n_cols) ); | // set_size() doesn't destroy data as long as the number of element | |||
s in the matrix remains the same | ||||
if(same_size == false) | ||||
{ | ||||
arma_debug_check | ||||
( | ||||
(out.mem_state == 3), | ||||
"reshape(): size can't be changed as template based size specif | ||||
ication is in use" | ||||
); | ||||
access::rw(out.n_rows) = in_n_rows; | ||||
access::rw(out.n_cols) = in_n_cols; | ||||
} | ||||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
unwrap_check< Mat<eT> > B_tmp(A, is_alias); | unwrap_check< Mat<eT> > B_tmp(A, is_alias); | |||
const Mat<eT>& B = B_tmp.M; | const Mat<eT>& B = B_tmp.M; | |||
out.set_size(in_n_rows, in_n_cols); | out.set_size(in_n_rows, in_n_cols); | |||
eT* out_mem = out.memptr(); | eT* out_mem = out.memptr(); | |||
uword i = 0; | ||||
const uword B_n_rows = B.n_rows; | const uword B_n_rows = B.n_rows; | |||
const uword B_n_cols = B.n_cols; | const uword B_n_cols = B.n_cols; | |||
for(uword row=0; row<B_n_rows; ++row) | for(uword row=0; row<B_n_rows; ++row) | |||
for(uword col=0; col<B_n_cols; ++col) | for(uword col=0; col<B_n_cols; ++col) | |||
{ | { | |||
out_mem[i] = B.at(row,col); | *out_mem = B.at(row,col); | |||
++i; | out_mem++; | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
const unwrap_check< Mat<eT> > B_tmp(A, is_alias); | const unwrap_check< Mat<eT> > B_tmp(A, is_alias); | |||
const Mat<eT>& B = B_tmp.M; | const Mat<eT>& B = B_tmp.M; | |||
const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | |||
skipping to change at line 152 | skipping to change at line 140 | |||
{ | { | |||
if(in_dim == 0) | if(in_dim == 0) | |||
{ | { | |||
if(&out != &A) | if(&out != &A) | |||
{ | { | |||
out.set_size(in_n_rows, in_n_cols, in_n_slices); | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |||
arrayops::copy( out.memptr(), A.memptr(), out.n_elem ); | arrayops::copy( out.memptr(), A.memptr(), out.n_elem ); | |||
} | } | |||
else // &out == &A, i.e. inplace resize | else // &out == &A, i.e. inplace resize | |||
{ | { | |||
const bool same_size = ( (out.n_rows == in_n_rows) && (out.n_cols = | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |||
= in_n_cols) && (out.n_slices == in_n_slices) ); | // set_size() doesn't destroy data as long as the number of element | |||
s in the cube remains the same | ||||
if(same_size == false) | ||||
{ | ||||
arma_debug_check | ||||
( | ||||
(out.mem_state == 3), | ||||
"reshape(): size can't be changed as template based size specif | ||||
ication is in use" | ||||
); | ||||
out.delete_mat(); | ||||
access::rw(out.n_rows) = in_n_rows; | ||||
access::rw(out.n_cols) = in_n_cols; | ||||
access::rw(out.n_elem_slice) = in_n_rows * in_n_cols; | ||||
access::rw(out.n_slices) = in_n_slices; | ||||
out.create_mat(); | ||||
} | ||||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
unwrap_cube_check< Cube<eT> > B_tmp(A, out); | unwrap_cube_check< Cube<eT> > B_tmp(A, out); | |||
const Cube<eT>& B = B_tmp.M; | const Cube<eT>& B = B_tmp.M; | |||
out.set_size(in_n_rows, in_n_cols, in_n_slices); | out.set_size(in_n_rows, in_n_cols, in_n_slices); | |||
eT* out_mem = out.memptr(); | eT* out_mem = out.memptr(); | |||
uword i = 0; | ||||
const uword B_n_rows = B.n_rows; | const uword B_n_rows = B.n_rows; | |||
const uword B_n_cols = B.n_cols; | const uword B_n_cols = B.n_cols; | |||
const uword B_n_slices = B.n_slices; | const uword B_n_slices = B.n_slices; | |||
for(uword slice=0; slice<B_n_slices; ++slice) | for(uword slice = 0; slice < B_n_slices; ++slice) | |||
for(uword row=0; row<B_n_rows; ++row) | for(uword row = 0; row < B_n_rows; ++row ) | |||
for(uword col=0; col<B_n_cols; ++col) | for(uword col = 0; col < B_n_cols; ++col ) | |||
{ | { | |||
out_mem[i] = B.at(row,col,slice); | *out_mem = B.at(row,col,slice); | |||
++i; | out_mem++; | |||
} | } | |||
} | } | |||
} | } | |||
else | else | |||
{ | { | |||
const unwrap_cube_check< Cube<eT> > B_tmp(A, out); | const unwrap_cube_check< Cube<eT> > B_tmp(A, out); | |||
const Cube<eT>& B = B_tmp.M; | const Cube<eT>& B = B_tmp.M; | |||
const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | const uword n_elem_to_copy = (std::min)(B.n_elem, in_n_elem); | |||
End of changes. 8 change blocks. | ||||
47 lines changed or deleted | 15 lines changed or added | |||