Examples of Matrix


Examples of org.jquantlib.math.matrixutilities.Matrix

        // because it is too slow and too inefficient.
        // This method is useful for testing and R&D.
        // Please overload the method within derived classes.
        QL.require(!x.empty() , "can not handle given x here"); // QA:[RG]::verified // TODO: message

        final Matrix tmp = new Matrix(size_, size_);
        for (int i = 0; i < size_; ++i) {
            for (int j = 0; j <= i; ++j) {
                final Var_Helper helper = new Var_Helper(this, i, j);
                final GaussKronrodAdaptive integrator = new GaussKronrodAdaptive(1e-10, 10000);
                for(int k = 0; k<64; ++k) {
                    tmp.set(i, j, tmp.get(i, j)+integrator.op(helper, k*t/64.0,(k+1)*t/64.0));
                }
                tmp.set(j,i, tmp.get(i, j));
            }
        }

        return tmp;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Matrix

            this.j_ = j;
            this.param_ = param;
        }

        public double op(final double t) {
            final Matrix m = param_.diffusion(t);
            return m.constRangeRow(i_).innerProduct(m.constRangeRow(j_));
        }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Matrix

        return sqrtCorrelation_;
    }

    @Override
    public Matrix covariance(final /*@Time*/ double t0, final Array x0, final /*@Time*/ double dt)  {
        final Matrix tmp = stdDeviation(t0, x0, dt);
        return tmp.mul(tmp.transpose());
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Matrix

        }
        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);
                    } else {
                        correlation.set(i, j, correlation.get(i, j) * 1.0 / Math.sqrt(variances.get(i) * variances.get(j)));
                    }
                } else if (variances.get(i) == 0.0 && variances.get(j) == 0) {
                    correlation.set(i, j, 1.0);
                } else if (variances.get(i) == 0.0 || variances.get(j) == 0.0) {
                    correlation.set(i, j, 1.0);
                } else {
                    correlation.set(i, j, correlation.get(i, j) * 1.0 / Math.sqrt(variances.get(i) * variances.get(j)));
                }
        }

        return correlation;
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Matrix

        } else {
            dimension_ = dimension;
            stats_ = new Statistics[dimension];
            results_ = new double[dimension];
        }
        quadraticSum_ = new Matrix(dimension_, dimension_);
    }
View Full Code Here

Examples of org.jquantlib.math.matrixutilities.Matrix

  public TreeLattice2D(final T tree1, final T tree2, final double correlation) {

    super(tree1.timeGrid(), T.branches.getValue() * T.branches.getValue());
    this.tree1 = tree1;
    this.tree2 = tree2;
    this.m = new Matrix(T.branches.getValue(), T.branches.getValue());
    rho = Math.abs(correlation);
    // what happens here?
    if (correlation < 0.0 && T.branches.getValue() == 3) {
      m.set(0, 0, -1.0);
      m.set(0, 1, -4.0);
View Full Code Here

Examples of org.matrix.Matrix

        myMatrix.clear();
        assertTrue(myMatrix.isZero());
    }
    @Test
    public void cloneAndEqualMatrixes() {
        Matrix myMatrix = new Matrix(2, 2);
        myMatrix.set(0, 0, 1.0);
        myMatrix.set(0, 1, 2.0);
        myMatrix.set(1, 0, 3.0);
        myMatrix.set(1, 1, 4.0);
        Matrix myClonedMatrix = myMatrix.clone();
        assertTrue(myMatrix.equals(myClonedMatrix));
        assertEquals(2, myClonedMatrix.getRows());
        assertEquals(2, myClonedMatrix.getColumns());
    }
View Full Code Here

Examples of org.molgenis.model.elements.Matrix

      logger.error(message);
      throw new MolgenisModelException(message);
    }

    // create the matrix object and put it in the model
    Matrix matrix = new Matrix(element.getAttribute("name"), model.getDatabase());
    matrix.setCol(element.getAttribute("col"));
    matrix.setRow(element.getAttribute("row"));
    matrix.setContentEntity(element.getAttribute("content_entity"));
    matrix.setContainer(element.getAttribute("container"));
    matrix.setColEntityName(element.getAttribute("col_entity"));
    matrix.setRowEntityName(element.getAttribute("row_entity"));
    matrix.setContent(element.getAttribute("content"));

    logger.debug("read: " + matrix.toString());
  }
View Full Code Here

Examples of org.mt4j.util.math.Matrix

   
    this.p3d = ((PGraphics3D)pa.g);
    this.dirty = true;
    this.cameraMat       = new PMatrix3D();
    this.cameraInvMat     = new PMatrix3D();
    this.cameraMatrix     = new Matrix();
    this.cameraInvMatrix   = new Matrix();
  }
View Full Code Here

Examples of org.opengis.referencing.operation.Matrix

            start("wcs:GridCRS");
            element("wcs:GridBaseCRS", urnIdentifier(ci.getCRS()));
            element("wcs:GridType", GridType.GT2dGridIn2dCrs.getXmlConstant());
            // TODO: go back to using the metadata once they can be trusted
            final LinearTransform tx = (LinearTransform) ci.getGrid().getGridToCRS();
            final Matrix matrix = tx.getMatrix();
            // origin
            StringBuffer origins = new StringBuffer();
            for (int i = 0; i < matrix.getNumRow() - 1; i++) {
                origins.append(matrix.getElement(i, matrix.getNumCol() - 1));
                if (i < matrix.getNumRow() - 2)
                    origins.append(" ");
            }
            element("wcs:GridOrigin", origins.toString());
            // offsets
            StringBuffer offsets = new StringBuffer();
            for (int i = 0; i < matrix.getNumRow() - 1; i++) {
                for (int j = 0; j < matrix.getNumCol() - 1; j++) {
                    offsets.append(matrix.getElement(i, j));
                    if (j < matrix.getNumCol() - 2)
                        offsets.append(" ");
                }
                if (i < matrix.getNumRow() - 2)
                    offsets.append(" ");

            }
            element("wcs:GridOffsets", offsets.toString());
            element("wcs:GridCS", "urn:ogc:def:cs:OGC:0.0:Grid2dSquareCS");
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.