convexbrain / Totsu

First-order conic solver for convex optimization problems
https://crates.io/crates/totsu/
The Unlicense
47 stars 4 forks source link

Using any float-like type for the field #20

Closed benruijl closed 3 years ago

benruijl commented 5 years ago

I'd like to use Totsu over any num_traits::Float type, like f128 floats or perhaps even dual numbers. Is this possible?

convexbrain commented 5 years ago

Hi benruijl,

It's possible to make Mat generic using num_traits::Float, but its implementation will take a little time, I think. Not to make it generic but to use just f128, modifying FP, FP_EPSILON and FP_MINPOS in matgen.rs to those of f128 maybe works.

As for dual numbers, you need to re-write an optimization problem by using dual numbers' element-wise real number vectors and matrices. It's because the base algorithm I used is based on $R^n$.

convexbrain commented 3 years ago

At version https://github.com/convexbrain/Totsu/releases/tag/rust_conic_v0.6.0, num::Float is employed overall.