I am trying use boost::qvm
with boost::multiprecision
. I built a user-defined quaternion, but I am not able to scale the quaternion. I would like to scale it by a number of type boost::multiprecision::cpp_dec_float_100
. Bellow is my code. I also tried it with the out commented code.
#include <bits/stdc++.h>
#include <boost/numeric/odeint.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/qvm.hpp>
using namespace std;
typedef boost::multiprecision::cpp_dec_float_100 fl;
struct fquat { fl a[4]; };
namespace boost { namespace qvm {
template <>
struct quat_traits<fquat>: quat_traits_defaults<fquat,fl> {
template <int I>
static inline scalar_type & write_element( fquat & q ) {
return q.a[I];
}
};
template <> struct is_scalar<fl> { static bool const value=true; };
template <> struct scalar_traits<fl>
{ BOOST_QVM_INLINE_CRITICAL static fl value( int v ) { return fl(v); }};
/*
template <>
struct deduce_quat<fquat, fl> {
typedef fquat type;
};
template <>
struct deduce_quat2<fquat, fquat, fl> {
typedef fquat type;
};
*/
} }
int main()
{
fquat q = {fl(1),fl(1),fl(1),fl(1)};
fl x = fl(3);
q *= x;
return 0;
}
The error I get is:
test2.cpp: In function ‘int main()’:
test2.cpp:48:7: error: no match for ‘operator*=’ (operand types are ‘fquat’ and ‘fl’ {aka ‘boost::multiprecision::number<boost::multiprecision::backends::cpp_dec_float<100> >’})
48 | q *= x;
| ~~^~~~