Hello! I am trying to integrate FloatX into the Eigen library. One particular portion (Eigen::HouseholderQR matrix) is giving me some trouble. In particular, I'm getting the following error, which I think is the key to figuring out this compilation error:
error: conversion from 'long int' to 'const flx::floatx<8,23>' is ambiguous
Do you have an idea of how to address this? Thanks!
Here is a simple example:
#include <iostream>
#include <Eigen/Eigen>
#include "floatx.hpp"
using fx = flx::floatx<8,23>;
// support for eigen library
namespace Eigen {
template<int E, int M>
struct NumTraits<flx::floatx<E,M>> : NumTraits<double>
{
typedef flx::floatx<E,M> Real;
typedef flx::floatx<E,M> NonInteger;
typedef flx::floatx<E,M> Nested;
enum {
IsComplex = 0,
IsInteger = 0,
IsSigned = 1,
RequireInitialization = 0,
ReadCost = 1,
AddCost = 3,
MulCost = 3
};
};
}
int main() {
Eigen::Matrix<fx,3,3> m;
m << fx(1), fx(2), fx(3),
fx(4), fx(5), fx(6),
fx(7), fx(8), fx(9);
Eigen::Matrix<fx,3,1> v;
v << fx(1), fx(2), fx(3);
Eigen::Matrix<fx,3,1> m2 = m * v;
Eigen::HouseholderQR<Eigen::Matrix<fx,Eigen::Dynamic,Eigen::Dynamic>> qr(m);
Eigen::Matrix<fx,Eigen::Dynamic,Eigen::Dynamic> Q = qr.householderQ();
std::cout << m << std::endl;
std::cout << m2 << std::endl;
std::cout << Q << std::endl;
}
I also had to make the following adjustments to floatx.hpp in the floatx class:
Hello! I am trying to integrate FloatX into the Eigen library. One particular portion (
Eigen::HouseholderQR
matrix) is giving me some trouble. In particular, I'm getting the following error, which I think is the key to figuring out this compilation error:Do you have an idea of how to address this? Thanks!
Here is a simple example:
I also had to make the following adjustments to
floatx.hpp
in thefloatx
class: