That did it, thanks! Thought I tried primitives earlier, but apparently not...
Change to double instead of Double.
On 03/01/2016 20:50, Daniel Price wrote:
Sorry, code sample:
import org.apache.commons.math3.stat.correlation.Covarianceimport org.apache.commons.math3.stat.descriptive.DescriptiveStatisticsimport org.apache.commons.math3.util.*
Double dblArray1 = [0.00995630918100443,0.00425329233495364,-0.01227651365617033,0.015574186166315451] as DoubleDouble dblArray2 = [0.004630842339633734,0.003451971610807014,-0.008004809261582091,0.04068026756946197] as Doubledef cov = new Covariance().covariance(dblArray1, dblArray2)
println "cov: $cov"
Result:Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: org.apache.commons.math3.stat.correlation.Covariance.covariance() is applicable for argument types: ([Ljava.lang.Double;, [Ljava.lang.Double;) values: [[0.00995630918100443, 0.00425329233495364,...
Possible solutions: covariance([D, [D), covariance([D, [D, boolean)
So, how would I create the proper array argument: [D,[D ? Some Apache Commons Math type I need to cast my java.lang.Double to?
Any suggestions much appreciated!D
On Sun, Jan 3, 2016 at 10:43 AM, Eric MacAdie <email@example.com> wrote:
Could you give a code sample?= Eric MacAdie
On Sun, Jan 3, 2016 at 11:37 AM, Daniel Price <firstname.lastname@example.org> wrote:
Got this 2.4.5 Groovy error trying to perform a covariance calc:
groovy.lang.MissingMethodException: No signature of method: org.apache.commons.math3.stat.correlation.Covariance.covariance() is applicable for argument types: ([Ljava.lang.Double;, [Ljava.lang.Double;)
covariance() requires two double arrays, and that's what I provided, so what gives?
Do I need to cast the Groovy/Java array into another type?
Any advice is much appreciated!
-- Schalk W. Cronjé Twitter / Ello / Toeter : @ysb33r