Package org.jquantlib.math.matrixutilities

Examples of org.jquantlib.math.matrixutilities.Matrix.diagonal()


        return results_;
    }

    public Matrix correlation() {
        final Matrix correlation = covariance();
        final Array variances = correlation.diagonal();
        for (int i = 0; i < dimension_; i++) {
            for (int j = 0; j < dimension_; j++)
                if (i == j) {
                    if (variances.get(i) == 0.0) {
                        correlation.set(i, j, 1.0);
View Full Code Here


  /**
   * returns the correlation Matrix
   */
  public Matrix correlation() /*@ReadOnly*/ {
    final Matrix corr = covariance();
    final Array v = corr.diagonal();
    for (/*@Size*/ int i=0; i<dimension_; i++){
      for (/*@Size*/ int j=0; j<dimension_; j++){
        if (i==j) {
          if (v.$[v._(i)]==0.0) {
            corr.$[corr._(i,j)] = 1.0;
View Full Code Here

                { 9.0, 9.0, 9.0, 4.0 },
        }, flagsA);

        final Array aA = new Array(new double[] { 1.0, 2.0, 3.0, 4.0 }, flagsB);

        if (!ArrayTest.equals(mA.diagonal(), aA)) {
            fail("'diagonal' failed");
        }
    }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.