[mlpack-svn] r11327 - mlpack/trunk/src/mlpack/core/arma_extend/sparse
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed Feb 1 13:23:17 EST 2012
Author: rcurtin
Date: 2012-02-01 13:23:16 -0500 (Wed, 01 Feb 2012)
New Revision: 11327
Modified:
mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_bones.hpp
mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_meat.hpp
Log:
Add operators for SpSubview.
Modified: mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_bones.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_bones.hpp 2012-02-01 18:17:12 UTC (rev 11326)
+++ mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_bones.hpp 2012-02-01 18:23:16 UTC (rev 11327)
@@ -1,6 +1,6 @@
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-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
@@ -16,10 +16,18 @@
inline Mat(const SpMat<eT>& m);
inline const Mat& operator=(const SpMat<eT>& m);
-inline const Mat& operator+=(const SpMat<eT>& m);
-inline const Mat& operator-=(const SpMat<eT>& m);
-inline const Mat& operator*=(const SpMat<eT>& m);
-inline const Mat& operator%=(const SpMat<eT>& m);
-inline const Mat& operator/=(const SpMat<eT>& m);
+//inline const Mat& operator+=(const SpMat<eT>& m);
+//inline const Mat& operator-=(const SpMat<eT>& m);
+//inline const Mat& operator*=(const SpMat<eT>& m);
+//inline const Mat& operator%=(const SpMat<eT>& m);
+//inline const Mat& operator/=(const SpMat<eT>& m);
+inline Mat(const SpSubview<eT>& m);
+inline const Mat& operator=(const SpSubview<eT>& m);
+//inline const Mat& operator+=(const SpSubview<eT>& m);
+//inline const Mat& operator-=(const SpSubview<eT>& m);
+//inline const Mat& operator*=(const SpSubview<eT>& m);
+//inline const Mat& operator%=(const SpSubview<eT>& m);
+//inline const Mat& operator/=(const SpSubview<eT>& m);
+
//! @}
Modified: mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_meat.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_meat.hpp 2012-02-01 18:17:12 UTC (rev 11326)
+++ mlpack/trunk/src/mlpack/core/arma_extend/sparse/Mat_extra_meat.hpp 2012-02-01 18:23:16 UTC (rev 11327)
@@ -1,6 +1,6 @@
// Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
// Copyright (C) 2008-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
@@ -57,6 +57,61 @@
{
at(it.row, it.col) = (*it);
}
+
+ return *this;
}
+
+
+template<typename eT>
+inline
+Mat<eT>::Mat(const SpSubview<eT>& m)
+ : n_rows(m.n_rows)
+ , n_cols(m.n_cols)
+ , n_elem(m.n_elem)
+ , vec_state(0)
+ , mem_state(0)
+ , mem()
+ {
+ arma_extra_debug_sigprint_this(this);
+
+ // Initializes memory.
+ init_cold();
+
+ // We don't have an iterator at the moment... so do it the hard way.
+ // Much slower than it could otherwise be, unfortunately.
+ for (uword row = 0; row < m.n_rows; ++row)
+ {
+ for (uword col = 0; col < m.n_cols; ++col)
+ {
+ at(row, col) = m.at(row, col);
+ }
+ }
+ }
+
+
+
+template<typename eT>
+inline
+const Mat<eT>&
+Mat<eT>::operator=(const SpSubview<eT>& m)
+ {
+ arma_extra_debug_sigprint();
+
+ init_warm(m.n_rows, m.n_cols);
+
+ // We don't have an iterator at the moment... so do it the hard way.
+ // Much slower than it could otherwise be, unfortunately.
+ for (uword row = 0; row < m.n_rows; ++row)
+ {
+ for (uword col = 0; col < m.n_cols; ++col)
+ {
+ at(row, col) = m.at(row, col);
+ }
+ }
+
+ return *this;
+ }
+
+
//! @}
More information about the mlpack-svn
mailing list