[mlpack-svn] r10745 - mlpack/trunk/src/mlpack/core/arma_extend/sparse

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Dec 13 06:17:35 EST 2011


Author: rcurtin
Date: 2011-12-13 06:17:34 -0500 (Tue, 13 Dec 2011)
New Revision: 10745

Modified:
   mlpack/trunk/src/mlpack/core/arma_extend/sparse/Proxy.hpp
Log:
Support SpSubview proxies.


Modified: mlpack/trunk/src/mlpack/core/arma_extend/sparse/Proxy.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/arma_extend/sparse/Proxy.hpp	2011-12-13 10:47:12 UTC (rev 10744)
+++ mlpack/trunk/src/mlpack/core/arma_extend/sparse/Proxy.hpp	2011-12-13 11:17:34 UTC (rev 10745)
@@ -113,4 +113,38 @@
   arma_inline bool    is_alias(const Mat<eT>& X) const { return false;      }
   };
 
+
+
+template<typename eT>
+class Proxy< SpSubview<eT> >
+  {
+  public:
+
+  typedef eT                                       elem_type;
+  typedef typename get_pod_type<elem_type>::result pod_type;
+  typedef SpSubview<eT>                            stored_type;
+  typedef const SpSubview<eT>&                     ea_type;
+
+  static const bool prefer_at_accessor = true;
+  static const bool has_subview        = true;
+
+  arma_aligned const SpSubview<eT>& Q;
+
+  inline explicit Proxy(const SpSubview<eT>& A)
+    : Q(A)
+    {
+    arma_extra_debug_sigprint();
+    }
+
+  arma_inline uword get_n_rows() const { return Q.n_rows; }
+  arma_inline uword get_n_cols() const { return Q.n_cols; }
+  arma_inline uword get_n_elem() const { return Q.n_elem; }
+
+  arma_inline elem_type operator[] (const uword i)                    const { return Q[i];           }
+  arma_inline elem_type at         (const uword row, const uword col) const { return Q.at(row, col); }
+
+  arma_inline ea_type get_ea()                     const { return Q;              }
+  arma_inline bool    is_alias(const SpMat<eT>& X) const { return (&(Q.m) == &X); }
+  };
+
 //! @}




More information about the mlpack-svn mailing list