I think the right strategy is to make a separate complex array implementation library ("core.matrix.complex"?). In terms of dependencies, it would only need to depend depend upon "core.matrix" and "complex".
The array representation could simply be a deftype which uses two underlying arrays for the real and complex parts of the array respectively. This world: - use Complex values for array elements (mget etc.) - allow the use of arbitrary underlying implementations (vectorz-clj, Clatrix etc.) - implement all the relevant core.matrix protocols for Complex scalar values - implement all the relevant core.matrix protocols for Complex arrays - maybe add some special functions for complex-specific tasks - as an added bonus, act as a proof point that the core.matrix protocols work for non-real valued arrays (which I think they do, but would be nice to confirm...) The implementation should be fairly straightforward, but if anyone wants I can create a repo and bang out a bare-bones implementation in an hour or so that people can build upon. On Monday, 1 June 2015 08:49:22 UTC+1, Christopher Small wrote: > > Are these operations (*, +, etc) interoperable with core.matrix > operations? That may end up being pretty key for a lot of numerical users. > > Chris > > > On Sunday, May 31, 2015 at 3:55:46 PM UTC-7, Alan Forrester wrote: >> >> https://clojars.org/complex >> >> https://github.com/alanforr/complex >> >> Complex is a Clojure library for doing complex number calculations >> that wraps the Java commons-math3 Complex library. >> >> complex >> >> A Clojure library for doing calculations with complex numbers. Wraps >> the Java commons-math3 Complex library. >> >> Usage >> >> A complex number can be created by invoking the complex number >> function. With one argument the function produces a complex number in >> which only the real component is non-zero. With two arguments, the >> first argument is the real part, the second argument is the imaginary >> part: >> >> => (complex-number 1) >> >> Complex (1.0, 0.0) >> >> => (complex-number 1 2) >> >> Complex (1.0, 2.0). >> >> The library can be used to do complex arithmetic. The + function can >> have any number of real or complex arguments but always produces a >> complex result. >> >> => (+ 1 (complex-number 3 4)) >> >> Complex (4.0, 4.0). >> >> The same is true of the other arithmetical operations *,-,/. The >> arithmetical functions are fastest on a per number basis when used on >> only two arguments. They are also faster when their arguments are >> complex. >> >> The library also provides other functions, such as (pow a b), which >> raises a to the power b, (sin a) which calculates the sine of a, and >> several other functions. For details, see the docs. >> >> Alan >> > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.