Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error when Scalar is Eigen::half and not float #346

Open
hamlatzis opened this issue Oct 12, 2023 · 0 comments
Open

Compilation error when Scalar is Eigen::half and not float #346

hamlatzis opened this issue Oct 12, 2023 · 0 comments

Comments

@hamlatzis
Copy link

Since class Matrix is templatized

template <typename Scalar>
class Matrix final {
......
 private:
...........
  // The zero_point, i.e. which Scalar value is to be interpreted as zero.
  // When Scalar is floating-point, this must be 0.
  Scalar zero_point_ = 0;
};

I could have something like: Matrix<Eigen::half> myMatrix;

but then at compilation I get error: no viable conversion from 'int' to 'Eigen::half' Scalar zero_point_ = 0; since the zero isn't templatized

integer 0 and float zero are interchangeable so the above code works; but it's not the generic case for templates. I believe an implementation like Scalar zero_point_ = Scalar{0}; is more generic

Similar fixes to other classes and parts of the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant