rust-num / num-complex

Complex numbers for Rust
Apache License 2.0
232 stars 50 forks source link

Improve MulAssign and DivAssign #50

Closed benruijl closed 4 years ago

benruijl commented 5 years ago

The MulAssign and DivAssign can be slightly improved by not copying the complex number, as is done here http://gcc.gnu.org/onlinedocs/gcc-4.6.2/libstdc++/api/a00812_source.html.

cuviper commented 5 years ago

Licensing point -- we need to be careful not to "derive" from a GPL source here. IANAL, so I can't specify exactly what does and does not constitute deriving in that sense, but we should probably just consider possible improvements independently.

The current impls forward to non-assign ops, like *self = self.clone() * other. I expect we could avoid some cloning if we expand that op and use some assign-ops on self.re and self.im.