Hello community, here is the log from the commit of package armadillo for openSUSE:Factory checked in at 2011-12-12 16:55:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/armadillo (Old) and /work/SRC/openSUSE:Factory/.armadillo.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "armadillo", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/armadillo/armadillo.changes 2011-12-07 14:37:18.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.armadillo.new/armadillo.changes 2011-12-12 16:56:06.000000000 +0100 @@ -1,0 +2,7 @@ +Mon Dec 5 01:02:01 UTC 2011 - badshah...@gmail.com + +- Update to version 2.4.1: + + Added .resize() + + Fix for vector initialisation + +------------------------------------------------------------------- Old: ---- armadillo-2.4.0.tar.gz New: ---- armadillo-2.4.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ armadillo.spec ++++++ --- /var/tmp/diff_new_pack.reoa0B/_old 2011-12-12 16:56:16.000000000 +0100 +++ /var/tmp/diff_new_pack.reoa0B/_new 2011-12-12 16:56:16.000000000 +0100 @@ -18,7 +18,7 @@ Name: armadillo -Version: 2.4.0 +Version: 2.4.1 Release: 1 License: LGPL-3.0+ Summary: Fast C++ matrix library with interfaces to LAPACK and ATLAS ++++++ armadillo-2.4.0.tar.gz -> armadillo-2.4.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/CMakeLists.txt new/armadillo-2.4.1/CMakeLists.txt --- old/armadillo-2.4.0/CMakeLists.txt 2011-12-05 04:04:15.000000000 +0100 +++ new/armadillo-2.4.1/CMakeLists.txt 2011-12-06 13:48:50.000000000 +0100 @@ -16,7 +16,7 @@ set(ARMA_MAJOR 2) set(ARMA_MINOR 4) -set(ARMA_PATCH 0) +set(ARMA_PATCH 1) message(STATUS "Configuring Armadillo ${ARMA_MAJOR}.${ARMA_MINOR}.${ARMA_PATCH}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/docs/index.html new/armadillo-2.4.1/docs/index.html --- old/armadillo-2.4.0/docs/index.html 2011-12-05 04:04:15.000000000 +0100 +++ new/armadillo-2.4.1/docs/index.html 2011-12-07 11:50:52.000000000 +0100 @@ -17,7 +17,7 @@ <tbody> <tr> <td style="text-align: left; vertical-align: top;"> - <font size=+2><b>Reference for Armadillo 2.4.0</b></font> + <font size=+2><b>Reference for Armadillo 2.4.1</b></font> <br> <font size=-1><b>(Loco Lounge Lizard)</b></font> </td> @@ -133,6 +133,7 @@ <a href="#randu_randn_member">randu/randn</a> · <a href="#reset">reset</a> · <a href="#reshape_member">reshape</a> · +<a href="#resize_member">resize</a> · <a href="#save_load_mat">save/load (matrices & cubes)</a> · <a href="#save_load_field">save/load (fields)</a> · <a href="#set_imag">set_imag/real</a> · @@ -216,6 +217,7 @@ <a href="#join">join rows/cols/slices</a> · <a href="#kron">kron</a> · <a href="#reshape">reshape</a> · +<a href="#resize">resize</a> · <a href="#shuffle">shuffle</a> · <a href="#sort">sort</a> · <a href="#sort_index">sort_index</a> · @@ -2169,6 +2171,7 @@ <ul> <li><a href="#shed">shed rows/columns/slices</a></li> <li><a href="#join">join rows/columns/slices</a></li> +<li><a href="#resize_member">.resize()</a></li> <li><a href="#submat">submatrix views</a></li> <li><a href="#subcube">subcube views</a></li> </ul> @@ -3262,22 +3265,28 @@ <br> <ul> <li> -Reshape the object to the specified size, while preserving elements; -the order of preservation of the elements can be either column-wise (dim=0) or row-wise (dim=1) +Recreate the object according to given size specifications, +with the elements taken from the previous version of the object, +either column-wise (dim=0) or row-wise (dim=1); +the elements in the recreated object are placed column-wise </li> <br> <li> -The new total number of elements (according to the specified size) doesn't have to be the same as the current total number of elements in the object +The layout of the elements in the recreated object will be different to the layout in the previous version of the object </li> <br> <li> -If the total number of elements in the object is less than the specified size, -the remaining elements in the reshaped object are set to zero +The new total number of elements (according to the specified size) doesn't have to be the same as the previous total number of elements in the object </li> <br> <li> -If the total number of elements in the given object is greater than the specified size, -only a subset of the elements is preserved +If the total number of elements in the previous version of the object is less than the specified size, +the extra elements in the recreated object are set to zero +</li> +<br> +<li> +If the total number of elements in the previous version of the object is greater than the specified size, +only a subset of the elements is taken </li> <br> <li> @@ -3286,6 +3295,12 @@ </li> <br> <li> +<b>Caveat:</b> +if you wish to grow/shrink the object while preserving the elements <b>as well as</b> the layout of the elements, +use <a href="#resize_member">.resize()</a> instead +</li> +<br> +<li> Examples: <ul> <pre> @@ -3297,9 +3312,79 @@ <br> <li>See also: <ul> +<li><a href="#resize_member">.resize()</a></li> +<li><a href="#set_size">.set_size()</a></li> +<li><a href="#reset">.reset()</a></li> <li><a href="#reshape">reshape()</a> (standalone function)</li> +</ul> +</li> +</ul> +<br> +<hr class="greyline"><br> + +<a name="resize_member"></a> +<table style="text-align: left; width: 100%;" border="0" cellpadding="2" cellspacing="2"> + <tbody> + <tr> + <td style="vertical-align: top;"><b>.resize(n_elem)</b></td> + <td style="vertical-align: top;"><br> + </td> + <td style="vertical-align: top;">(member function of <i>Col</i>, <i>Row</i>) + </td> + </tr> + <tr> + <td style="vertical-align: top;"><b>.resize(n_rows, n_cols)</b></td> + <td style="vertical-align: top;"><br> + </td> + <td style="vertical-align: top;">(member function of <i>Mat</i>) + </td> + </tr> + <tr> + <td style="vertical-align: top;"><b>.resize(n_rows, n_cols, n_slices)</b></td> + <td style="vertical-align: top;"><br> + </td> + <td style="vertical-align: top;">(member function of <i>Cube</i>) + </td> + </tr> + </tbody> +</table> +<br> +<ul> +<li> +Recreate the object according to given size specifications, while preserving the elements as well as the layout of the elements +</li> +<br> +<li> +Can be used for growing or shrinking an object (ie. adding/removing rows, and/or columns, and/or slices) +</li> +<br> +<li> +<b>Caveat:</b> +.resize() is slower than <a href="#set_size">.set_size()</a>, which doesn't preserve data +</li> +<br> +<li> +Examples: +<ul> +<pre> +mat A = randu<mat>(4,5); +A.resize(7,6); +</pre> +</ul> +</li> +<br> +<li> +This function was added in version 2.4.1 +</li> +<br> +<li>See also: +<ul> +<li><a href="#reshape_member">.reshape()</a></li> <li><a href="#set_size">.set_size()</a></li> <li><a href="#reset">.reset()</a></li> +<li><a href="#insert">insert rows/cols/slices</a></li> +<li><a href="#shed">shed rows/cols/slices</a></li> +<li><a href="#resize">resize()</a> (standalone function)</li> </ul> </li> </ul> @@ -3747,6 +3832,7 @@ <ul> <li><a href="#reset">.reset()</a></li> <li><a href="#reshape_member">.reshape()</a></li> +<li><a href="#resize_member">.resize()</a></li> </ul> </li> </ul> @@ -3823,6 +3909,7 @@ <ul> <li><a href="#insert">insert rows/columns/slices</a></li> <li><a href="#join">join rows/columns/slices</a></li> +<li><a href="#resize_member">.resize()</a></li> <li><a href="#submat">submatrix views</a></li> <li><a href="#subcube">subcube views</a></li> <li><a href="http://thesaurus.com/browse/shed"><i>shed</i> in thesaurus.com</a></li> @@ -5384,6 +5471,7 @@ <li><a href="#dot">dot()</a></li> <li><a href="#norm">norm()</a></li> <li><a href="#reshape">reshape()</a></li> +<li><a href="#resize">resize()</a></li> </ul> </li> <br> @@ -6052,6 +6140,7 @@ <ul> <li><a href="#as_scalar">as_scalar()</a></li> <li><a href="#reshape">reshape()</a></li> +<li><a href="#resize">resize()</a></li> <li><a href="#adv_constructors_mat">advanced constructors (matrices)</a></li> <li><a href="#adv_constructors_cube">advanced constructors (cubes)</a></li> </ul> @@ -6522,7 +6611,12 @@ <ul> <li> Generate a matrix/cube sized according to given size specifications, -whose elements are taken from the given matrix/cube, either column-wise (dim=0) or row-wise (dim=1) +whose elements are taken from the given matrix/cube, either column-wise (dim=0) or row-wise (dim=1); +the elements in the generated object are placed column-wise +</li> +<br> +<li> +The layout of the elements in the generated object will be different to the layout in the given object </li> <br> <li> @@ -6540,6 +6634,17 @@ </li> <br> <li> +<b>Caveat:</b> +reshape() is slower than <a href="#set_size">.set_size()</a>, which doesn't preserve data +</li> +<br> +<li> +<b>Caveat:</b> +if you wish to grow/shrink a matrix while preserving the elements <b>as well as</b> the layout of the elements, +use <a href="#resize">resize()</a> instead +</li> +<br> +<li> Examples: <ul> <pre> @@ -6553,6 +6658,50 @@ See also: <ul> <li><a href="#reshape_member">.reshape()</a> (member function of Mat and Cube)</li> +<li><a href="#set_size">.set_size()</a> (member function of Mat and Cube)</li> +<li><a href="#resize">resize()</a></li> +<li><a href="#as_scalar">as_scalar()</a></li> +<li><a href="#conv_to">conv_to()</a></li> +</ul> +</li> +<br> +</ul> +<hr class="greyline"><br> + +<a name="resize"></a> +<b>resize(mat, n_rows, n_cols)</b> +<br><b>resize(cube, n_rows, n_cols, n_slices)</b> +<ul> +<li> +Generate a matrix/cube sized according to given size specifications, +whose elements as well as the layout of the elements are taken from the given matrix/cube +</li> +<br> +<li> +<b>Caveat:</b> +resize() is slower than <a href="#set_size">.set_size()</a>, which doesn't preserve data +</li> +<br> +<li> +Examples: +<ul> +<pre> +mat A = randu<mat>(4, 5); +mat B = resize(A, 7, 6); +</pre> +</ul> +</li> +<br> +<li> +This function was added in version 2.4.1 +</li> +<br> +<li> +See also: +<ul> +<li><a href="#resize_member">.resize()</a> (member function of Mat and Cube)</li> +<li><a href="#set_size">.set_size()</a> (member function of Mat and Cube)</li> +<li><a href="#reshape">reshape()</a></li> <li><a href="#as_scalar">as_scalar()</a></li> <li><a href="#conv_to">conv_to()</a></li> </ul> @@ -9344,6 +9493,7 @@ <li>Added in 2.4: <ul> <li>shorter forms of transposes: <a href="#t_st_members">.t()</a> and <a href="#t_st_members">.st()</a></li> +<li><a href="#resize_member">.resize()</a> and <a href="#resize">resize()</a> (added in 2.4.1)</li> <li>optional use of 64 bit indices (allowing matrices to have more than 4 billion elements), <br>enabled via ARMA_64BIT_WORD in <i>include/armadillo_bits/config.hpp</i></li> <li>experimental support for C++11 initialiser lists, enabled via ARMA_USE_CXX11 in <i>include/armadillo_bits/config.hpp</i></li> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo new/armadillo-2.4.1/include/armadillo --- old/armadillo-2.4.0/include/armadillo 2011-11-28 04:11:35.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo 2011-12-06 13:45:01.000000000 +0100 @@ -177,6 +177,7 @@ #include "armadillo_bits/op_var_bones.hpp" #include "armadillo_bits/op_repmat_bones.hpp" #include "armadillo_bits/op_reshape_bones.hpp" + #include "armadillo_bits/op_resize_bones.hpp" #include "armadillo_bits/op_cov_bones.hpp" #include "armadillo_bits/op_cor_bones.hpp" #include "armadillo_bits/op_shuffle_bones.hpp" @@ -326,6 +327,7 @@ #include "armadillo_bits/fn_solve.hpp" #include "armadillo_bits/fn_repmat.hpp" #include "armadillo_bits/fn_reshape.hpp" + #include "armadillo_bits/fn_resize.hpp" #include "armadillo_bits/fn_cov.hpp" #include "armadillo_bits/fn_cor.hpp" #include "armadillo_bits/fn_shuffle.hpp" @@ -396,6 +398,7 @@ #include "armadillo_bits/op_var_meat.hpp" #include "armadillo_bits/op_repmat_meat.hpp" #include "armadillo_bits/op_reshape_meat.hpp" + #include "armadillo_bits/op_resize_meat.hpp" #include "armadillo_bits/op_cov_meat.hpp" #include "armadillo_bits/op_cor_meat.hpp" #include "armadillo_bits/op_shuffle_meat.hpp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Col_bones.hpp new/armadillo-2.4.1/include/armadillo_bits/Col_bones.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Col_bones.hpp 2011-11-04 15:52:26.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Col_bones.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -26,6 +26,7 @@ inline Col(); + inline Col(const Col<eT>& X); inline explicit Col(const uword n_elem); inline Col(const uword in_rows, const uword in_cols); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Col_meat.hpp new/armadillo-2.4.1/include/armadillo_bits/Col_meat.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Col_meat.hpp 2011-11-14 02:52:36.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Col_meat.hpp 2011-12-06 16:00:28.000000000 +0100 @@ -28,6 +28,20 @@ +template<typename eT> +inline +Col<eT>::Col(const Col<eT>& X) + : Mat<eT>(X.n_elem, 1) + { + arma_extra_debug_sigprint(); + + access::rw(Mat<eT>::vec_state) = 1; + + arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); + } + + + //! construct a column vector with the specified number of n_elem template<typename eT> inline diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Cube_bones.hpp new/armadillo-2.4.1/include/armadillo_bits/Cube_bones.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Cube_bones.hpp 2011-11-11 12:48:41.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Cube_bones.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -211,6 +211,7 @@ inline void set_size(const uword in_rows, const uword in_cols, const uword in_slices); inline void reshape(const uword in_rows, const uword in_cols, const uword in_slices, const uword dim = 0); + inline void resize(const uword in_rows, const uword in_cols, const uword in_slices); template<typename eT2> inline void copy_size(const Cube<eT2>& m); @@ -322,8 +323,9 @@ inline void delete_mat(); inline void create_mat(); - friend class op_reshape; friend class glue_join; + friend class op_reshape; + friend class op_resize; public: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Cube_meat.hpp new/armadillo-2.4.1/include/armadillo_bits/Cube_meat.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Cube_meat.hpp 2011-11-14 02:44:41.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Cube_meat.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -2433,6 +2433,19 @@ +//! change the cube to have user specified dimensions (data is preserved) +template<typename eT> +inline +void +Cube<eT>::resize(const uword in_rows, const uword in_cols, const uword in_slices) + { + arma_extra_debug_sigprint(); + + *this = arma::resize(*this, in_rows, in_cols, in_slices); + } + + + //! change the cube (without preserving data) to have the same dimensions as the given cube template<typename eT> template<typename eT2> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Mat_bones.hpp new/armadillo-2.4.1/include/armadillo_bits/Mat_bones.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Mat_bones.hpp 2011-11-18 10:45:25.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Mat_bones.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -305,9 +305,13 @@ template<typename eT2> inline void copy_size(const Mat<eT2>& m); - inline void set_size(const uword in_elem); - inline void set_size(const uword in_rows, const uword in_cols); - inline void reshape(const uword in_rows, const uword in_cols, const uword dim = 0); + inline void set_size(const uword in_elem); + inline void set_size(const uword in_rows, const uword in_cols); + + inline void resize(const uword in_elem); + inline void resize(const uword in_rows, const uword in_cols); + inline void reshape(const uword in_rows, const uword in_cols, const uword dim = 0); + arma_hot inline const Mat& fill(const eT val); @@ -531,6 +535,7 @@ friend class glue_join; friend class op_strans; friend class op_htrans; + friend class op_resize; public: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Mat_meat.hpp new/armadillo-2.4.1/include/armadillo_bits/Mat_meat.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Mat_meat.hpp 2011-11-26 08:02:10.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Mat_meat.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -4247,6 +4247,45 @@ template<typename eT> inline void +Mat<eT>::resize(const uword in_elem) + { + arma_extra_debug_sigprint(); + + switch(vec_state) + { + case 0: + case 1: + (*this).resize(in_elem, 1); + break; + + case 2: + (*this).resize(1, in_elem); + break; + + default: + ; + } + } + + + +//! change the matrix to have user specified dimensions (data is preserved) +template<typename eT> +inline +void +Mat<eT>::resize(const uword in_rows, const uword in_cols) + { + arma_extra_debug_sigprint(); + + *this = arma::resize(*this, in_rows, in_cols); + } + + + +//! change the matrix to have user specified dimensions (data is preserved) +template<typename eT> +inline +void Mat<eT>::reshape(const uword in_rows, const uword in_cols, const uword dim) { arma_extra_debug_sigprint(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Row_bones.hpp new/armadillo-2.4.1/include/armadillo_bits/Row_bones.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Row_bones.hpp 2011-11-04 15:52:26.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Row_bones.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -26,6 +26,7 @@ inline Row(); + inline Row(const Row<eT>& X); inline explicit Row(const uword N); inline Row(const uword in_rows, const uword in_cols); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/Row_meat.hpp new/armadillo-2.4.1/include/armadillo_bits/Row_meat.hpp --- old/armadillo-2.4.0/include/armadillo_bits/Row_meat.hpp 2011-11-14 02:52:36.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/Row_meat.hpp 2011-12-06 16:00:28.000000000 +0100 @@ -15,7 +15,7 @@ //! @{ - +//! construct an empty row vector template<typename eT> inline Row<eT>::Row() @@ -30,6 +30,21 @@ template<typename eT> inline +Row<eT>::Row(const Row<eT>& X) + : Mat<eT>(1, X.n_elem) + { + arma_extra_debug_sigprint(); + + access::rw(Mat<eT>::vec_state) = 2; + + arrayops::copy((*this).memptr(), X.memptr(), X.n_elem); + } + + + +//! construct a row vector with the specified number of n_elem +template<typename eT> +inline Row<eT>::Row(const uword in_n_elem) : Mat<eT>(1, in_n_elem) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/arma_version.hpp new/armadillo-2.4.1/include/armadillo_bits/arma_version.hpp --- old/armadillo-2.4.0/include/armadillo_bits/arma_version.hpp 2011-12-05 04:04:15.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/arma_version.hpp 2011-12-06 13:48:50.000000000 +0100 @@ -18,7 +18,7 @@ #define ARMA_VERSION_MAJOR 2 #define ARMA_VERSION_MINOR 4 -#define ARMA_VERSION_PATCH 0 +#define ARMA_VERSION_PATCH 1 #define ARMA_VERSION_NAME "Loco Lounge Lizard" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/fn_resize.hpp new/armadillo-2.4.1/include/armadillo_bits/fn_resize.hpp --- old/armadillo-2.4.0/include/armadillo_bits/fn_resize.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/fn_resize.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -0,0 +1,43 @@ +// Copyright (C) 2011 NICTA (www.nicta.com.au) +// Copyright (C) 2011 Conrad Sanderson +// +// This file is part of the Armadillo C++ library. +// It is provided without any warranty of fitness +// for any purpose. You can redistribute this file +// and/or modify it under the terms of the GNU +// Lesser General Public License (LGPL) as published +// by the Free Software Foundation, either version 3 +// of the License or (at your option) any later version. +// (see http://www.opensource.org/licenses for more info) + + +//! \addtogroup fn_resize +//! @{ + + + +template<typename T1> +inline +const Op<T1, op_resize> +resize(const Base<typename T1::elem_type,T1>& X, const uword in_n_rows, const uword in_n_cols) + { + arma_extra_debug_sigprint(); + + return Op<T1, op_resize>(X.get_ref(), in_n_rows, in_n_cols); + } + + + +template<typename T1> +inline +const OpCube<T1, op_resize> +resize(const BaseCube<typename T1::elem_type,T1>& X, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices) + { + arma_extra_debug_sigprint(); + + return OpCube<T1, op_resize>(X.get_ref(), in_n_rows, in_n_cols, in_n_slices); + } + + + +//! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/op_resize_bones.hpp new/armadillo-2.4.1/include/armadillo_bits/op_resize_bones.hpp --- old/armadillo-2.4.0/include/armadillo_bits/op_resize_bones.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/op_resize_bones.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -0,0 +1,30 @@ +// Copyright (C) 2011 NICTA (www.nicta.com.au) +// Copyright (C) 2011 Conrad Sanderson +// +// This file is part of the Armadillo C++ library. +// It is provided without any warranty of fitness +// for any purpose. You can redistribute this file +// and/or modify it under the terms of the GNU +// Lesser General Public License (LGPL) as published +// by the Free Software Foundation, either version 3 +// of the License or (at your option) any later version. +// (see http://www.opensource.org/licenses for more info) + + + +//! \addtogroup op_resize +//! @{ + + + +class op_resize + { + public: + + template<typename T1> inline static void apply( Mat<typename T1::elem_type>& out, const Op<T1,op_resize>& in); + template<typename T1> inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_resize>& in); + }; + + + +//! @} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/armadillo-2.4.0/include/armadillo_bits/op_resize_meat.hpp new/armadillo-2.4.1/include/armadillo_bits/op_resize_meat.hpp --- old/armadillo-2.4.0/include/armadillo_bits/op_resize_meat.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/armadillo-2.4.1/include/armadillo_bits/op_resize_meat.hpp 2011-12-06 13:45:01.000000000 +0100 @@ -0,0 +1,119 @@ +// Copyright (C) 2011 NICTA (www.nicta.com.au) +// Copyright (C) 2011 Conrad Sanderson +// +// This file is part of the Armadillo C++ library. +// It is provided without any warranty of fitness +// for any purpose. You can redistribute this file +// and/or modify it under the terms of the GNU +// Lesser General Public License (LGPL) as published +// by the Free Software Foundation, either version 3 +// of the License or (at your option) any later version. +// (see http://www.opensource.org/licenses for more info) + + + +//! \addtogroup op_resize +//! @{ + + + +template<typename T1> +inline +void +op_resize::apply(Mat<typename T1::elem_type>& actual_out, const Op<T1,op_resize>& in) + { + arma_extra_debug_sigprint(); + + typedef typename T1::elem_type eT; + + const uword out_n_rows = in.aux_uword_a; + const uword out_n_cols = in.aux_uword_b; + + const unwrap<T1> tmp(in.m); + const Mat<eT>& A = tmp.M; + + const uword A_n_rows = A.n_rows; + const uword A_n_cols = A.n_cols; + + Mat<eT> B; + + const bool alias = (&actual_out == &A); + + Mat<eT>& out = alias ? B : actual_out; + + out.set_size(out_n_rows, out_n_cols); + + if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) ) + { + out.zeros(); + } + + if(out.n_elem > 0) + { + const uword end_row = (std::min)(out_n_rows, A_n_rows) - 1; + const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; + + out.submat(0, 0, end_row, end_col) = A.submat(0, 0, end_row, end_col); + } + + if(alias) + { + actual_out.steal_mem(B); + } + + } + + + +template<typename T1> +inline +void +op_resize::apply(Cube<typename T1::elem_type>& actual_out, const OpCube<T1,op_resize>& in) + { + arma_extra_debug_sigprint(); + + typedef typename T1::elem_type eT; + + const uword out_n_rows = in.aux_uword_a; + const uword out_n_cols = in.aux_uword_b; + const uword out_n_slices = in.aux_uword_c; + + const unwrap_cube<T1> tmp(in.m); + const Cube<eT>& A = tmp.M; + + const uword A_n_rows = A.n_rows; + const uword A_n_cols = A.n_cols; + const uword A_n_slices = A.n_slices; + + Cube<eT> B; + + const bool alias = (&actual_out == &A); + + Cube<eT>& out = alias ? B : actual_out; + + out.set_size(out_n_rows, out_n_cols, out_n_slices); + + if( (out_n_rows > A_n_rows) || (out_n_cols > A_n_cols) || (out_n_slices > A_n_slices) ) + { + out.zeros(); + } + + if(out.n_elem > 0) + { + const uword end_row = (std::min)(out_n_rows, A_n_rows) - 1; + const uword end_col = (std::min)(out_n_cols, A_n_cols) - 1; + const uword end_slice = (std::min)(out_n_slices, A_n_slices) - 1; + + out.subcube(0, 0, 0, end_row, end_col, end_slice) = A.subcube(0, 0, 0, end_row, end_col, end_slice); + } + + if(alias) + { + actual_out.steal_mem(B); + } + + } + + + +//! @} -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org