0
) mpfr_t 요소의 행렬로 작동하는 클래스가 필요합니다. STL 벡터는 내가 원하는만큼 동적으로 할당하는 것이 좋겠다고 생각했지만 여기서 오류가 발생합니다.동적으로 할당 된 mpfr_t 행렬 (표준 :
#ifndef GMPMATRIX_H
#define GMPMATRIX_H
#include <vector>
#include <mpfr.h>
typedef std::vector<mpfr_t> mpVector;
typedef std::vector<mpVector> mpMatrix;
class GmpMatrix
{
private:
int n;
int m;
mpMatrix elements;
public:
GmpMatrix() {}
GmpMatrix(int n, int m)
{
this->n = n;
this->m = m;
for (int i = 0; i < n; ++i)
{
mpVector e_push(m);
for (int j = 0; j < m; ++j)
{
mpfr_t e;
mpfr_init(e);
e_push.push_back(e);
}
}
}
~GmpMatrix() {}
};
#endif // GMPMATRIX_H
오류는 다음과 같습니다 정말 이것으로 검토 한 나는 그것을 알아낼 수 없습니다
/usr/include/c++/5/ext/new_allocator.h:120:4: error: parenthesized initializer in array new [-fpermissive]
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^
/usr/include/c++/5/ext/new_allocator.h:120:4: error: no matching function for call to ‘__mpfr_struct::__mpfr_struct(const __mpfr_struct [1])’
. vector< vector<mpfr_t> >
을 만드는 방법이 있습니까? 아무도 무슨 일이 일어나고 있는지 알고 있습니까?
래퍼가 이미 있습니다. - https://bitbucket.org/advanpix/mpreal –
고마워요! 이것은 랩퍼를 사용하여 컴파일합니다. – p0licat