update boost on linux
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#ifndef BOOST_UBLAS_MATRIX_VECTOR_HPP
|
||||
#define BOOST_UBLAS_MATRIX_VECTOR_HPP
|
||||
|
||||
#include <boost/numeric/ublas/matrix_proxy.hpp>//for matrix_row, matrix_column and matrix_expression
|
||||
#include <boost/numeric/ublas/matrix_proxy.hpp> //for matrix_row, matrix_column and matrix_expression
|
||||
#include <boost/numeric/ublas/vector.hpp>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
@@ -43,10 +43,12 @@ public:
|
||||
matrix_vector_iterator(){}
|
||||
|
||||
///\brief constructs a matrix_vector_iterator as pointing to the i-th proxy
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_vector_iterator(Matrix& matrix, std::size_t position)
|
||||
: matrix_(&matrix),position_(position) {}
|
||||
|
||||
template<class M, class R>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_vector_iterator(matrix_vector_iterator<M,R> const& other)
|
||||
: matrix_(other.matrix_),position_(other.position_) {}
|
||||
|
||||
@@ -54,28 +56,36 @@ private:
|
||||
friend class boost::iterator_core_access;
|
||||
template <class M,class R> friend class matrix_vector_iterator;
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
void increment() {
|
||||
++position_;
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
void decrement() {
|
||||
--position_;
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
void advance(std::ptrdiff_t n){
|
||||
position_ += n;
|
||||
}
|
||||
|
||||
template<class M,class R>
|
||||
BOOST_UBLAS_INLINE
|
||||
std::ptrdiff_t distance_to(matrix_vector_iterator<M,R> const& other) const{
|
||||
BOOST_UBLAS_CHECK (matrix_ == other.matrix_, external_logic ());
|
||||
return (std::ptrdiff_t)other.position_ - (std::ptrdiff_t)position_;
|
||||
}
|
||||
|
||||
template<class M,class R>
|
||||
BOOST_UBLAS_INLINE
|
||||
bool equal(matrix_vector_iterator<M,R> const& other) const{
|
||||
BOOST_UBLAS_CHECK (matrix_ == other.matrix_, external_logic ());
|
||||
return (position_ == other.position_);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
Reference dereference() const {
|
||||
return Reference(*matrix_,position_);
|
||||
}
|
||||
@@ -109,81 +119,103 @@ public:
|
||||
typedef typename boost::iterator_difference<iterator>::type difference_type;
|
||||
typedef typename Matrix::size_type size_type;
|
||||
|
||||
matrix_row_vector(Matrix& matrix) :
|
||||
matrix_(matrix) {
|
||||
BOOST_UBLAS_INLINE
|
||||
explicit matrix_row_vector(Matrix& matrix) :
|
||||
matrix_(&matrix) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator begin(){
|
||||
return iterator(matrix_, 0);
|
||||
return iterator(*matrix_, 0);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator begin() const {
|
||||
return const_iterator(matrix_, 0);
|
||||
return const_iterator(*matrix_, 0);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator cbegin() const {
|
||||
return begin();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator end() {
|
||||
return iterator(matrix_, matrix_.size1());
|
||||
return iterator(*matrix_, matrix_->size1());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator end() const {
|
||||
return const_iterator(matrix_, matrix_.size1());
|
||||
return const_iterator(*matrix_, matrix_->size1());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator cend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator crbegin() const {
|
||||
return rbegin();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator crend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
value_type operator()(difference_type index) const {
|
||||
return value_type(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type operator()(size_type index) {
|
||||
return value_type(*matrix_, index);
|
||||
}
|
||||
|
||||
reference operator[](difference_type index){
|
||||
return reference(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type operator()(size_type index) const {
|
||||
return value_type(*matrix_, index);
|
||||
}
|
||||
|
||||
const_reference operator[](difference_type index) const {
|
||||
return const_reference(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
reference operator[](size_type index){
|
||||
return (*this) (index);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reference operator[](size_type index) const {
|
||||
return (*this) (index);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type size() const {
|
||||
return matrix_.size1();
|
||||
return matrix_->size1();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
void resize(size_type size, bool preserve = true) {
|
||||
matrix_.resize(size, matrix_.size2(), preserve);
|
||||
matrix_->resize(size, matrix_->size2(), preserve);
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix& matrix_;
|
||||
Matrix* matrix_;
|
||||
};
|
||||
|
||||
|
||||
@@ -196,6 +228,7 @@ private:
|
||||
* \tparam Matrix the type of matrix that \c matrix_row_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_row_vector<Matrix> make_row_vector(matrix_expression<Matrix>& matrix){
|
||||
return matrix_row_vector<Matrix>(matrix());
|
||||
}
|
||||
@@ -210,6 +243,7 @@ matrix_row_vector<Matrix> make_row_vector(matrix_expression<Matrix>& matrix){
|
||||
* \tparam Matrix the type of matrix that \c matrix_row_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_row_vector<Matrix const> make_row_vector(matrix_expression<Matrix> const& matrix){
|
||||
return matrix_row_vector<Matrix const>(matrix());
|
||||
}
|
||||
@@ -224,8 +258,7 @@ matrix_row_vector<Matrix const> make_row_vector(matrix_expression<Matrix> const&
|
||||
* the underlaying matrix.
|
||||
*/
|
||||
template<class Matrix>
|
||||
class matrix_column_vector
|
||||
{
|
||||
class matrix_column_vector {
|
||||
public:
|
||||
typedef ublas::matrix_column<Matrix> value_type;
|
||||
typedef ublas::matrix_column<Matrix> reference;
|
||||
@@ -239,80 +272,103 @@ public:
|
||||
typedef typename boost::iterator_difference<iterator>::type difference_type;
|
||||
typedef typename Matrix::size_type size_type;
|
||||
|
||||
matrix_column_vector(Matrix& matrix) :
|
||||
matrix_(matrix){
|
||||
BOOST_UBLAS_INLINE
|
||||
explicit matrix_column_vector(Matrix& matrix) :
|
||||
matrix_(&matrix){
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator begin() {
|
||||
return iterator(matrix_, 0);
|
||||
return iterator(*matrix_, 0);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator begin() const {
|
||||
return const_iterator(matrix_, 0);
|
||||
return const_iterator(*matrix_, 0);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator cbegin() const {
|
||||
return begin();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
iterator end() {
|
||||
return iterator(matrix_, matrix_.size2());
|
||||
return iterator(*matrix_, matrix_->size2());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator end() const {
|
||||
return const_iterator(matrix_, matrix_.size2());
|
||||
return const_iterator(*matrix_, matrix_->size2());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_iterator cend() const {
|
||||
return end();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
reverse_iterator rbegin() {
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator rbegin() const {
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator crbegin() const {
|
||||
return rbegin();
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
reverse_iterator rend() {
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator rend() const {
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reverse_iterator crend() const {
|
||||
return rend();
|
||||
}
|
||||
|
||||
value_type operator()(difference_type index) const {
|
||||
return value_type(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type operator()(size_type index) {
|
||||
return value_type(*matrix_, index);
|
||||
}
|
||||
|
||||
reference operator[](difference_type index) {
|
||||
return reference(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
value_type operator()(size_type index) const {
|
||||
return value_type(*matrix_, index);
|
||||
}
|
||||
|
||||
const_reference operator[](difference_type index) const {
|
||||
return const_reference(matrix_, index);
|
||||
BOOST_UBLAS_INLINE
|
||||
reference operator[](size_type index) {
|
||||
return (*this) (index);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
const_reference operator[](size_type index) const {
|
||||
return (*this) (index);
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
size_type size() const {
|
||||
return matrix_.size2();
|
||||
return matrix_->size2();
|
||||
}
|
||||
|
||||
BOOST_UBLAS_INLINE
|
||||
void resize(size_type size, bool preserve = true) {
|
||||
matrix_.resize(matrix_.size1(), size, preserve);
|
||||
matrix_->resize(matrix_->size1(), size, preserve);
|
||||
}
|
||||
|
||||
private:
|
||||
Matrix& matrix_;
|
||||
Matrix* matrix_;
|
||||
};
|
||||
|
||||
|
||||
@@ -325,6 +381,7 @@ private:
|
||||
* \tparam Matrix the type of matrix that \c matrix_column_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_column_vector<Matrix> make_column_vector(matrix_expression<Matrix>& matrix){
|
||||
return matrix_column_vector<Matrix>(matrix());
|
||||
}
|
||||
@@ -339,6 +396,7 @@ matrix_column_vector<Matrix> make_column_vector(matrix_expression<Matrix>& matri
|
||||
* \tparam Matrix the type of matrix that \c matrix_column_vector is referring.
|
||||
*/
|
||||
template<class Matrix>
|
||||
BOOST_UBLAS_INLINE
|
||||
matrix_column_vector<Matrix const> make_column_vector(matrix_expression<Matrix> const& matrix){
|
||||
return matrix_column_vector<Matrix const>(matrix());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user