[mlpack] 02/37: Remove row_col_iterator because it isn't done quite yet.
Barak A. Pearlmutter
barak+git at pearlmutter.net
Mon Feb 15 19:35:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to tag mlpack-1.0.10
in repository mlpack.
commit 5429881969228b371a8e6a3130506c6b0745c617
Author: Ryan Curtin <ryan at ratml.org>
Date: Sat Jul 26 15:36:57 2014 +0000
Remove row_col_iterator because it isn't done quite yet.
---
src/mlpack/core/arma_extend/CMakeLists.txt | 2 -
src/mlpack/core/arma_extend/Mat_extra_bones.hpp | 136 ---------
src/mlpack/core/arma_extend/Mat_extra_meat.hpp | 378 ------------------------
src/mlpack/core/arma_extend/arma_extend.hpp | 4 -
src/mlpack/tests/arma_extend_test.cpp | 42 ---
5 files changed, 562 deletions(-)
diff --git a/src/mlpack/core/arma_extend/CMakeLists.txt b/src/mlpack/core/arma_extend/CMakeLists.txt
index 50b3cad..9098cd0 100644
--- a/src/mlpack/core/arma_extend/CMakeLists.txt
+++ b/src/mlpack/core/arma_extend/CMakeLists.txt
@@ -14,8 +14,6 @@ set(SOURCES
typedef.hpp
SpMat_extra_bones.hpp
SpMat_extra_meat.hpp
- Mat_extra_bones.hpp
- Mat_extra_meat.hpp
)
# add directory name to sources
diff --git a/src/mlpack/core/arma_extend/Mat_extra_bones.hpp b/src/mlpack/core/arma_extend/Mat_extra_bones.hpp
deleted file mode 100644
index fb307fc..0000000
--- a/src/mlpack/core/arma_extend/Mat_extra_bones.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Add row_col_iterator and row_col_const_iterator to arma::Mat.
- */
-
-/*
- * row_col_iterator for Mat<eT>. This iterator can return row and column index
- * of the entry its pointing too. The functionality of this iterator is similar
- * to sparse matrix iterators.
- */
-
-class row_col_iterator;
-
-class const_row_col_iterator
-{
-public:
- // empty constructor
- inline const_row_col_iterator();
- // constructs const iterator from other iterators
- inline const_row_col_iterator(const row_col_iterator& it);
- inline const_row_col_iterator(const const_row_iterator& it);
- inline const_row_col_iterator(const row_iterator& it);
- // constructs iterator with given row and col index
- inline const_row_col_iterator(const Mat<eT>& in_M, const uword row = 0, const uword col = 0);
-
- /*
- * Returns the value of the current position.
- */
- inline arma_hot const eT& operator*() const { return *current_pos; }
-
- /*
- * Increment and decrement operators for this iterator.
- */
- inline arma_hot const_row_col_iterator& operator++();
- inline arma_hot const_row_col_iterator operator++(int);
- inline arma_hot const_row_col_iterator& operator--();
- inline arma_hot const_row_col_iterator operator--(int);
-
- /*
- * Comparison operator with itself and other relevant iterators.
- */
- inline arma_hot bool operator==(const const_row_col_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_row_col_iterator& rhs) const;
- inline arma_hot bool operator==(const row_col_iterator& rhs) const;
- inline arma_hot bool operator!=(const row_col_iterator& rhs) const;
- inline arma_hot bool operator==(const const_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_iterator& rhs) const;
- inline arma_hot bool operator==(const iterator& rhs) const;
- inline arma_hot bool operator!=(const iterator& rhs) const;
- inline arma_hot bool operator==(const const_row_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_row_iterator& rhs) const;
- inline arma_hot bool operator==(const row_iterator& rhs) const;
- inline arma_hot bool operator!=(const row_iterator& rhs) const;
-
- arma_inline uword row() const { return internal_row; }
- arma_inline uword col() const { return internal_col; }
-
- // So that we satisfy the STL iterator types.
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef eT value_type;
- typedef uword difference_type; // not certain on this one
- typedef const eT* pointer;
- typedef const eT& reference;
-
- arma_aligned const Mat<eT>* M;
-
- arma_aligned const eT* current_pos;
- arma_aligned uword internal_col;
- arma_aligned uword internal_row;
-};
-
-class row_col_iterator
-{
-public:
- // empty constructor
- inline row_col_iterator();
- // constructs const iterator from other iterators
- inline row_col_iterator(const row_iterator& it);
- // constructs iterator with given row and col index
- inline row_col_iterator(Mat<eT>& in_M, const uword row = 0, const uword col = 0);
-
- /*
- * Returns the value of the current position.
- */
- inline arma_hot eT& operator*() const { return *current_pos; }
-
- /*
- * Increment and decrement operators for this iterator.
- */
- inline arma_hot row_col_iterator& operator++();
- inline arma_hot row_col_iterator operator++(int);
- inline arma_hot row_col_iterator& operator--();
- inline arma_hot row_col_iterator operator--(int);
-
- /*
- * Comparison operator with itself and other relevant iterators.
- */
- inline arma_hot bool operator==(const const_row_col_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_row_col_iterator& rhs) const;
- inline arma_hot bool operator==(const row_col_iterator& rhs) const;
- inline arma_hot bool operator!=(const row_col_iterator& rhs) const;
- inline arma_hot bool operator==(const const_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_iterator& rhs) const;
- inline arma_hot bool operator==(const iterator& rhs) const;
- inline arma_hot bool operator!=(const iterator& rhs) const;
- inline arma_hot bool operator==(const const_row_iterator& rhs) const;
- inline arma_hot bool operator!=(const const_row_iterator& rhs) const;
- inline arma_hot bool operator==(const row_iterator& rhs) const;
- inline arma_hot bool operator!=(const row_iterator& rhs) const;
-
- arma_inline uword row() const { return internal_row; }
- arma_inline uword col() const { return internal_col; }
-
- // So that we satisfy the STL iterator types.
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef eT value_type;
- typedef uword difference_type; // not certain on this one
- typedef const eT* pointer;
- typedef const eT& reference;
-
- arma_aligned const Mat<eT>* M;
-
- arma_aligned eT* current_pos;
- arma_aligned uword internal_col;
- arma_aligned uword internal_row;
-};
-
-/*
- * Extra functions for Mat<eT>
- */
-// begin for iterator row_col_iterator
-inline const_row_col_iterator begin_row_col() const;
-inline row_col_iterator begin_row_col();
-
-// end for iterator row_col_iterator
-inline const_row_col_iterator end_row_col() const;
-inline row_col_iterator end_row_col();
diff --git a/src/mlpack/core/arma_extend/Mat_extra_meat.hpp b/src/mlpack/core/arma_extend/Mat_extra_meat.hpp
deleted file mode 100644
index a828e33..0000000
--- a/src/mlpack/core/arma_extend/Mat_extra_meat.hpp
+++ /dev/null
@@ -1,378 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// Mat::const_row_col_iterator implementation //
-///////////////////////////////////////////////////////////////////////////////
-
-template<typename eT>
-inline
-Mat<eT>::const_row_col_iterator::const_row_col_iterator()
- : M(NULL), current_pos(NULL), internal_row(0), internal_col(0)
-{
- // Technically this iterator is invalid (it may not point to a real element)
-}
-
-template<typename eT>
-inline
-Mat<eT>::const_row_col_iterator::const_row_col_iterator(const row_col_iterator& it)
- : M(it.M), current_pos(it.current_pos), internal_col(it.col()), internal_row(it.row())
-{
- // Nothing to do.
-}
-
-template<typename eT>
-inline
-Mat<eT>::const_row_col_iterator::const_row_col_iterator(const const_row_iterator& it)
- : M(&it.M), current_pos(&it.M(it.row, it.col)), internal_col(it.col), internal_row(it.row)
-{
- // Nothing to do.
-}
-
-template<typename eT>
-inline
-Mat<eT>::const_row_col_iterator::const_row_col_iterator(const row_iterator& it)
- : M(&it.M), current_pos(&it.M(it.row, it.col)), internal_col(it.col), internal_row(it.row)
-{
- // Nothing to do.
-}
-
-
-template<typename eT>
-inline
-Mat<eT>::const_row_col_iterator::const_row_col_iterator(const Mat<eT>& in_M, const uword row, const uword col)
- : M(&in_M), current_pos(&in_M(row,col)), internal_row(row), internal_col(col)
-{
- // Nothing to do.
-}
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator&
-Mat<eT>::const_row_col_iterator::operator++()
-{
- current_pos++;
- internal_row++;
-
- // Check to see if we moved a column.
- if(internal_row == M->n_rows)
- {
- internal_col++;
- internal_row = 0;
- }
-}
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator
-Mat<eT>::const_row_col_iterator::operator++(int)
-{
- typename Mat<eT>::const_row_col_iterator temp(*this);
-
- ++(*this);
-
- return temp;
-}
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator&
-Mat<eT>::const_row_col_iterator::operator--()
-{
- current_pos--;
- internal_row--;
-
- // Check to see if we moved a column.
- if(internal_row == -1)
- {
- internal_col--;
- internal_row = M->n_rows - 1;
- }
-}
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator
-Mat<eT>::const_row_col_iterator::operator--(int)
-{
- typename Mat<eT>::const_row_col_iterator temp(*this);
-
- --(*this);
-
- return temp;
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const const_row_col_iterator& rhs) const
-{
- return (rhs.current_pos == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const const_row_col_iterator& rhs) const
-{
- return (rhs.current_pos != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const row_col_iterator& rhs) const
-{
- return (rhs.current_pos == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const row_col_iterator& rhs) const
-{
- return (rhs.current_pos != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const const_iterator& rhs) const
-{
- return (rhs == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const const_iterator& rhs) const
-{
- return (rhs != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const iterator& rhs) const
-{
- return (rhs == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const iterator& rhs) const
-{
- return (rhs != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const const_row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const const_row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator==(const row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::const_row_col_iterator::operator!=(const row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) != current_pos);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Mat::row_col_iterator implementation //
-///////////////////////////////////////////////////////////////////////////////
-
-template<typename eT>
-inline
-Mat<eT>::row_col_iterator::row_col_iterator()
- : M(NULL), current_pos(NULL), internal_row(0), internal_col(0)
-{
- // Technically this iterator is invalid (it may not point to a real element)
-}
-
-template<typename eT>
-inline
-Mat<eT>::row_col_iterator::row_col_iterator(const row_iterator& it)
- : M(&it.M), current_pos(&it.M(it.row, it.col)), internal_col(it.col), internal_row(it.row)
-{
- // Nothing to do.
-}
-
-
-template<typename eT>
-inline
-Mat<eT>::row_col_iterator::row_col_iterator(Mat<eT>& in_M, const uword row, const uword col)
- : M(&in_M), current_pos(&in_M(row,col)), internal_row(row), internal_col(col)
-{
- // Nothing to do.
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator&
-Mat<eT>::row_col_iterator::operator++()
-{
- current_pos++;
- internal_row++;
-
- // Check to see if we moved a column.
- if(internal_row == M->n_rows)
- {
- internal_col++;
- internal_row = 0;
- }
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator
-Mat<eT>::row_col_iterator::operator++(int)
-{
- typename Mat<eT>::row_col_iterator temp(*this);
-
- ++(*this);
-
- return temp;
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator&
-Mat<eT>::row_col_iterator::operator--()
-{
- current_pos--;
- internal_row--;
-
- // Check to see if we moved a column.
- if(internal_row == -1)
- {
- internal_col--;
- internal_row = M->n_rows - 1;
- }
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator
-Mat<eT>::row_col_iterator::operator--(int)
-{
- typename Mat<eT>::const_row_col_iterator temp(*this);
-
- --(*this);
-
- return temp;
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const const_row_col_iterator& rhs) const
-{
- return (rhs.current_pos == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const const_row_col_iterator& rhs) const
-{
- return (rhs.current_pos != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const row_col_iterator& rhs) const
-{
- return (rhs.current_pos == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const row_col_iterator& rhs) const
-{
- return (rhs.current_pos != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const const_iterator& rhs) const
-{
- return (rhs == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const const_iterator& rhs) const
-{
- return (rhs != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const iterator& rhs) const
-{
- return (rhs == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const iterator& rhs) const
-{
- return (rhs != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const const_row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const const_row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) != current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator==(const row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) == current_pos);
-}
-
-template<typename eT>
-inline bool
-Mat<eT>::row_col_iterator::operator!=(const row_iterator& rhs) const
-{
- return (&rhs.M(rhs.row, rhs.col) != current_pos);
-}
-
-
-///////////////////////////////////////////////////////////////////////////////
-// extended Mat functionality implementation //
-///////////////////////////////////////////////////////////////////////////////
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator
-Mat<eT>::begin_row_col() const
-{
- return const_row_col_iterator(*this);
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator
-Mat<eT>::begin_row_col()
-{
- return row_col_iterator(*this);
-}
-
-template<typename eT>
-inline typename Mat<eT>::const_row_col_iterator
-Mat<eT>::end_row_col() const
-{
- return ++const_row_col_iterator(*this, n_rows - 1, n_cols - 1);
-}
-
-template<typename eT>
-inline typename Mat<eT>::row_col_iterator
-Mat<eT>::end_row_col()
-{
- return ++row_col_iterator(*this, n_rows - 1, n_cols - 1);
-}
diff --git a/src/mlpack/core/arma_extend/arma_extend.hpp b/src/mlpack/core/arma_extend/arma_extend.hpp
index 54f79f3..1765ee4 100644
--- a/src/mlpack/core/arma_extend/arma_extend.hpp
+++ b/src/mlpack/core/arma_extend/arma_extend.hpp
@@ -16,10 +16,6 @@
#define ARMA_EXTRA_SPMAT_PROTO mlpack/core/arma_extend/SpMat_extra_bones.hpp
#define ARMA_EXTRA_SPMAT_MEAT mlpack/core/arma_extend/SpMat_extra_meat.hpp
-// add row_col_iterator and row_col_const_iterator for Mat
-#define ARMA_EXTRA_MAT_PROTO mlpack/core/arma_extend/Mat_extra_bones.hpp
-#define ARMA_EXTRA_MAT_MEAT mlpack/core/arma_extend/Mat_extra_meat.hpp
-
#include <armadillo>
namespace arma {
diff --git a/src/mlpack/tests/arma_extend_test.cpp b/src/mlpack/tests/arma_extend_test.cpp
index dd0b0b3..31eff70 100644
--- a/src/mlpack/tests/arma_extend_test.cpp
+++ b/src/mlpack/tests/arma_extend_test.cpp
@@ -48,46 +48,4 @@ BOOST_AUTO_TEST_CASE(InplaceReshapeMatrixTest)
BOOST_REQUIRE_CLOSE(X[i], oldX[i], 1e-5); // Order should be preserved.
}
-/**
- * Test const_row_col_iterator for basic functionality.
- */
-BOOST_AUTO_TEST_CASE(ConstRowColIteratorTest)
-{
- mat X;
- X.ones(2, 2);
- // make sure default costructor works okay
- mat::const_row_col_iterator it;
- // make sure ++ operator, operator* and comparison operators work fine
- size_t count = 0;
- for(it = X.begin_row_col();it != X.end_row_col();it++)
- {
- count++;
- BOOST_REQUIRE_EQUAL(*it, 1);
- }
- BOOST_REQUIRE_EQUAL(count, 4);
- // make sure it can be constructed from row_iterator
- it = X.begin_row(0);
-}
-
-/**
- * Test row_col_iterator for basic functionality.
- */
-BOOST_AUTO_TEST_CASE(RowColIteratorTest)
-{
- mat X;
- X.ones(2, 2);
- // make sure default costructor works okay
- mat::row_col_iterator it;
- // make sure ++ operator, operator* and comparison operators work fine
- size_t count = 0;
- for(it = X.begin_row_col();it != X.end_row_col();it++)
- {
- count++;
- BOOST_REQUIRE_EQUAL(*it, 1);
- }
- BOOST_REQUIRE_EQUAL(count, 4);
- // make sure it can be constructed from row_iterator
- it = X.begin_row(0);
-}
-
BOOST_AUTO_TEST_SUITE_END();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list