find covariance using ejml

Discussion in 'Java' started by jimgardener, May 20, 2011.

  1. jimgardener

    jimgardener Guest

    hi
    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 library?
    Any code snippet most welcom
    thanks
    jim
     
    jimgardener, May 20, 2011
    #1
    1. Advertising

  2. jimgardener

    Lew Guest

    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-librar...Mult.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
     
    Lew, May 20, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthias Kaeppler

    Parametric covariance in class hierarchies

    Matthias Kaeppler, Jan 22, 2006, in forum: Java
    Replies:
    6
    Views:
    414
    Roedy Green
    Jan 23, 2006
  2. Adam Warner

    Covariance of Java primitives

    Adam Warner, Mar 23, 2006, in forum: Java
    Replies:
    6
    Views:
    1,868
    Adam Warner
    Mar 24, 2006
  3. Dave

    Covariance

    Dave, Aug 7, 2004, in forum: C++
    Replies:
    1
    Views:
    424
    Phlip
    Aug 7, 2004
  4. Arkadiusz Stasiak

    covariance matrix

    Arkadiusz Stasiak, Jul 21, 2006, in forum: C++
    Replies:
    1
    Views:
    2,237
    mlimber
    Jul 21, 2006
  5. Replies:
    2
    Views:
    655
Loading...

Share This Page