rust-kmedoids icon indicating copy to clipboard operation
rust-kmedoids copied to clipboard

Arbitrary precision distances: could Copy be replaced with Clone?

Open sleemans opened this issue 10 months ago • 1 comments

Thanks for the cool library!

For my use case, I need to work with distances of arbitrary precision. These distances can be so small, that the built-in types of Rust may not suffice. The fasterpam function, to my benefit, requires traits that are mostly compatible with unlimited-precision fraction libraries, such as fraction::BigFraction or num_rational. However, the only exception is the Copy trait, which, if I understand the documentation correctly, indicates that a bitwise copy is possible. I suspect it may not be possible to implement Copy for any arbitrary-precision fraction struct, as such a struct would need some kind of grow-shrink storage, and hence some bookkeeping that would be inherently incompatible with Copy.

Therefore my question: would it be possible to use the Clone trait instead of the Copy trait for the N and L type parameters in the function fasterpam? I'm fairly new to Rust programming, so please forgive me if this is not possible at all.

sleemans avatar Apr 24 '24 15:04 sleemans