1

对于一般信息,我使用 boost 1.46。自此版本以来,ublas lib 没有任何变化。

我使用gcc4.6 版本进行编译。

所以现在我的问题。我有一个非常基本的类,它应该适合 boost 矩阵类到自定义接口。该类如下所示:

template< typename TYPE >
class BoostCoordinateMatrix: public MatrixInterface<TYPE> ,
    public boost::numeric::ublas::coordinate_matrix<TYPE> {
public:
BoostCoordinateMatrix() :
    boost::numeric::ublas::coordinate_matrix<TYPE>() {
}

BoostCoordinateMatrix(int rows, int columns) :
    boost::numeric::ublas::coordinate_matrix<TYPE>(rows, columns) {
}

int rows() const {
    return this->size1();
}

int columns() const {
    return this->size2();
}

virtual void set(int row, int column, TYPE value) {
    (*this)(row, column) = value;
}

TYPE& operator()(int i, int j) {
    return this->boost::numeric::ublas::coordinate_matrix<TYPE>::operator()(
            i, j).ref();
}

TYPE operator()(int i, int j) const {
    return this->boost::numeric::ublas::coordinate_matrix<TYPE>::operator()(
            i, j);
}

};

编译此类时,两个运算符(int i,int j)都出现编译器错误:

./inc/boost_coordinate_matrix.h:38:15: 从 'TYPE BoostCoordinateMatrix::operator()(int, int) const [with TYPE = double]' 实例化 ./inc/flow_field_matrix_free_interface_impl.h:697:1: 从这里实例化/usr/include/c++/4.6/bits/stl_tempbuf.h:257:6: 错误:'boost::numeric::ublas::index_triple, boost::numeric::ublas: :unbounded_array, boost::numeric::ublas::unbounded_array > > >&' 来自 'boost::numeric::ublas::indexed_iterator, boost::numeric::ublas::unbounded_array, boost::numeric 类型的右值::ublas::unbounded_array >>, std::random_access_iterator_tag>::reference {aka boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas:: unbounded_array > > >}' /usr/include/c++/4.6/bits/stl_tempbuf.h:232:5: 错误:在传递 'void std::__uninitialized_construct_buf(_ForwardIterator, _ForwardIterator, _Tp&) 的参数 3 [with _ForwardIterator = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric:: ublas::unbounded_array > > >*, _Tp = boost::numeric::ublas::index_triple, boost::numeric::ublas::unbounded_array, boost::numeric::ublas::unbounded_array > > >]'</ p>

我希望有人可以帮助我。

4

1 回答 1

0

好的,我想我发现了问题:

http://boost.2283326.n4.nabble.com/example-usage-of-coordinate-matrix-fails-on-Ubuntu-11-04-amd-64-td3580407.html

我刚刚测试了最新的 boost 版本,这个也没有编译。

于 2012-03-04T13:33:43.263 回答