Hi,
I've implemented a basic GSL vector wrapper and now I'm working on integrating it with the IndexedCollection. It seems to me like this adds some nice features - namely a default to-seq implementation which allows the GVector type to take advantage of the many existing Seq methods.
I've pushed this change in this branch :
https://github.com/callendorph/lbstanza-gsl/tree/issues/indexcol_gvector
This implementation seems to compile but when I try to compile the tests, I get the following errors:
$> stanza build gsl-tests
tests/GVector_tests.stanza:201.10: Ambiguous call to overloaded function sum with arguments of type
(GVector). Possibilities are:
sum: GVector -> Double at src/GVector.stanza:216.12
sum: Seqable<Double> -> Double in package core
tests/GVector_tests.stanza:220.10: Ambiguous call to overloaded function maximum with arguments of
type (GVector). Possibilities are:
maximum: GVector -> Double at src/GVector.stanza:243.12
maximum: <?V0> . Seqable<?V0&Comparable<?>> -> V0 in package core
tests/GVector_tests.stanza:225.6: Ambiguous call to overloaded function maximum with arguments of
type (GVector). Possibilities are:
maximum: GVector -> Double at src/GVector.stanza:243.12
maximum: <?V0> . Seqable<?V0&Comparable<?>> -> V0 in package core
tests/GVector_tests.stanza:233.10: Ambiguous call to overloaded function minimum with arguments of
type (GVector). Possibilities are:
minimum: GVector -> Double at src/GVector.stanza:246.12
minimum: <?V0> . Seqable<?V0&Comparable<?>> -> V0 in package core
tests/GVector_tests.stanza:238.6: Ambiguous call to overloaded function minimum with arguments of
type (GVector). Possibilities are:
minimum: GVector -> Double at src/GVector.stanza:246.12
minimum: <?V0> . Seqable<?V0&Comparable<?>> -> V0 in package core
So for the methods sum, maximum, and minimum - I have provided functions that leverage the GSL library. I think these will likely be more performant but I haven't tested this yet.
From what I can tell the sum, maximum, and minimum methods in core are defined as defn functions. If these were defmulti on some type - then I could override them from GVector with defmethod. But implemented as functions - I'm not sure how to do that. It seems like the interface is set in stone for the case where they are defn functions.
Thoughts ? Was the choice to make them defn intentional ?
Hi,
I've implemented a basic GSL vector wrapper and now I'm working on integrating it with the
IndexedCollection. It seems to me like this adds some nice features - namely a defaultto-seqimplementation which allows the GVector type to take advantage of the many existingSeqmethods.I've pushed this change in this branch :
https://github.com/callendorph/lbstanza-gsl/tree/issues/indexcol_gvector
This implementation seems to compile but when I try to compile the tests, I get the following errors:
So for the methods
sum,maximum, andminimum- I have provided functions that leverage the GSL library. I think these will likely be more performant but I haven't tested this yet.From what I can tell the
sum,maximum, andminimummethods incoreare defined asdefnfunctions. If these weredefmultion some type - then I could override them fromGVectorwithdefmethod. But implemented as functions - I'm not sure how to do that. It seems like the interface is set in stone for the case where they aredefnfunctions.Thoughts ? Was the choice to make them
defnintentional ?