Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #4363

Re: find covariance using ejml

From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: find covariance using ejml
Date 2011-05-20 13:00 -0400
Organization albasani.net
Message-ID <ir66ml$ek4$1@news.albasani.net> (permalink)
References <fc798e81-6839-4506-8ee9-d070c1916d41@d19g2000prh.googlegroups.com>

Show all headers | View raw


jimgardener wrote:
> I have two double arrays as below
> double[] x=new double[]{2.5,0.5,2.2,1.9,3.1,2.3,2.0,1.0,1.5,1.1};
> double[] y=new double[]{2.4,0.7,2.9,2.2,3.0,2.7,1.6,1.1,1.6,0.9};
>
> How do you find the covariance between them using ejml [sic] library?
> Any code snippet most welcom

I've never used EJML, but the formula for matrix covariance
<http://stattrek.com/matrix-algebra/variance.aspx>
looks like it can be implemented using
<http://efficient-java-matrix-library.googlecode.com/svn/javadoc/ver0.16/org/ejml/alg/dense/mult/VectorVectorMult.html#innerProd(org.ejml.data.D1Matrix64F, 
org.ejml.data.D1Matrix64F)>

or some higher-level method, given that that particular method warns, "These 
functions are often used inside of highly optimized code and therefor sanity 
checks are kept to a minimum. It is not recommended that any of these 
functions be used directly."

I just snooped around the EJML Javadocs for a minute.  You can likely do better.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar


Thread

find covariance using ejml jimgardener <jimgardener@gmail.com> - 2011-05-19 22:56 -0700
  Re: find covariance using ejml Lew <noone@lewscanon.com> - 2011-05-20 13:00 -0400

csiph-web