novacrazy / dual_num

Dual Number library for Rust
https://docs.rs/dual_num/
17 stars 4 forks source link

Move future work to a `hyperdual` crate? #20

Open novacrazy opened 5 years ago

novacrazy commented 5 years ago

With the addition of #17, I don't think the name dual_num does this crate enough justice anymore.

I propose that we move future work with hyperduals to a hyperdual crate, and then dual_num will simply add hyperdual as a dependency and re-export Dual<T>. This would effectively deprecate the dual_name crate but still leave it functional.

This repo would be renamed to hyperdual and would contain both crates.

Thoughts?

ChristopherRabotin commented 5 years ago

It seems that cargo does not support multiple crates in a single repo: https://internals.rust-lang.org/t/multiple-libraries-in-a-cargo-project/8259/6 . So if I read this correctly, in order to keep the standard skeleton of a Rust library repo, we would need to create a separate hyperdual repo which would have the current code, and the dual_num repo would only re-export the Dual<T> struct.

novacrazy commented 5 years ago

Sure it does! They just need separate Cargo.toml files and directories. Cargo doesn't care about the structure of the repo itself, so long as each crate is separate.

hyperdual repo
    hyperdual/
        Cargo.toml
        src/
            lib.rs
            ...
    dual_num/
        Cargo.toml
        src/
            lib.rs

Additionally, a short non-crate Cargo.toml file can be added to the top to create a Cargo workspace.

ChristopherRabotin commented 5 years ago

Oh awesome! I'm open to this change then ;-)

novacrazy commented 5 years ago

Can the differentiate function work with any hyperdual number or just regular dual numbers? Would all the dual parts simple need to be set to one?

Nevermind, there really isn't much of a point in using a differentiate function if you already know how they work, anyway. So I'll just leave the simple one for the common use case.

ChristopherRabotin commented 5 years ago

FYI, I'll be republishing this crate as hyperdual. I have a dependency for another project on version 0.3.0, and it hasn't been published yet. So it's just easier, for now at least, if I republish it.

I've put it on my Gitlab account here: https://gitlab.com/chrisrabotin/hyperdual/issues/28