Package cern.colt.matrix.impl

Examples of cern.colt.matrix.impl.DenseDoubleMatrix2D


    *
    *
    */
   public MultinormalGen (NormalGen gen1, int d) {
      initMN (gen1, null, d);
      sigma = new DenseDoubleMatrix2D (d, d);
      sqrtSigma = new DenseDoubleMatrix2D (d, d);
      for (int i = 0; i < d; i++) {
         sigma.setQuick (i, i, 1.0);
         sqrtSigma.setQuick (i, i, 1.0);
      }
   }
View Full Code Here


    {@link #MultinormalGen((NormalGen, double[], DoubleMatrix2D)) MultinormalGen} <TT>(gen1, mu, new DenseDoubleMatrix2D (sigma))</TT>.
    *
    */
   protected MultinormalGen (NormalGen gen1, double[] mu, double[][] sigma)  {
      initMN (gen1, mu, -1);
      this.sigma = new DenseDoubleMatrix2D (sigma);
   }
View Full Code Here

      if (x.length != y.length)
         throw new IllegalArgumentException (
               "x and y must have the same length");
      if (x.length <= 1)
         throw new IllegalArgumentException ("At least two points are needed");
      final DoubleMatrix2D u = new DenseDoubleMatrix2D (x.length, x.length);
      for (int i = 0; i < x.length; i++) {
         double v = 1;
         for (int j = 0; j < x.length; j++) {
            u.setQuick (i, j, v);
            v *= x[i];
         }
      }
      final DoubleMatrix2D yMat = new DenseDoubleMatrix2D (x.length, 1);
      yMat.viewColumn (0).assign (y);
      final DoubleMatrix2D bMat = alg.solve (u, yMat);
      return bMat.viewColumn (0).toArray ();
   }
View Full Code Here

            if (j <= degree)
               xySums[j] += xv * y[i];
            xv *= x[i];
         }
      }
      final DoubleMatrix2D A = new DenseDoubleMatrix2D (degree + 1, degree + 1);
      final DoubleMatrix2D B = new DenseDoubleMatrix2D (degree + 1, 1);
      for (int i = 0; i <= degree; i++) {
         for (int j = 0; j <= degree; j++) {
            final int d = i + j;
            A.setQuick (i, j, xSums[d]);
         }
         B.setQuick (i, 0, xySums[i]);
      }
      final DoubleMatrix2D aVec = alg.solve (A, B);
      return aVec.viewColumn (0).toArray ();
   }
View Full Code Here

      if (sigma.length != sigma[0].length)
         throw new IllegalArgumentException ("sigma must be a square matrix");
      if (mu.length != sigma.length)
         throw new IllegalArgumentException ("mu and sigma must have the same dimension");

      sig = new DenseDoubleMatrix2D (sigma);
      inv = algebra.inverse (sig);

      double[] temp = new double[mu.length];
      for (int i = 0; i < mu.length; i++)
      {
View Full Code Here

         throw new IllegalArgumentException ("mu and sigma must have the same dimension");

      this.mu = new double[mu.length];
      this.dimension = mu.length;
      System.arraycopy(mu, 0, this.mu, 0, mu.length);
      this.sigma = new DenseDoubleMatrix2D (sigma);

      invSigma = null;
   }
View Full Code Here

   public double[][] decompPCA (double[][] sigma){
      // L'objet SingularValueDecomposition permet de recuperer la matrice
      // des valeurs propres en ordre decroissant et celle des vecteurs propres de
      // sigma (pour une matrice symetrique et definie-positive seulement).
      SingularValueDecomposition sv =
         new SingularValueDecomposition (new DenseDoubleMatrix2D (sigma));
      DoubleMatrix2D D = sv.getS ();    // diagonal
      // Calculer la racine carree des valeurs propres
      for (int i = 0; i < D.rows(); i++){
         sortedEigenvalues[i] = D.getQuick (i, i);
         D.setQuick (i, i, Math.sqrt (D.getQuick (i, i)));
View Full Code Here

    * <SPAN CLASS="MATH"><I><B>&Sigma;</B></I> = <B>V</B><I><B>&Lambda;</B></I><B>V</B><SUP>t</SUP></SPAN>. Returns
    * <SPAN CLASS="MATH"><B>A</B> = <B>V</B>()<SUP>1/2</SUP></SPAN>.
    *
    */
   public static DoubleMatrix2D decompPCA (double[][] sigma)   {
      return decompPCA (new DenseDoubleMatrix2D (sigma));
   }
View Full Code Here

    {@link #nextPoint((NormalGen, double[], DoubleMatrix2D, double[])) nextPoint}<TT>(gen1, mu, new DenseDoubleMatrix2D(sigma), p)</TT>.
    *
    */
   public static void nextPoint (NormalGen gen1, double[] mu,
                                 double[][] sigma, double[] p) {
      nextPoint(gen1, mu, new DenseDoubleMatrix2D(sigma), p);
   }
View Full Code Here

    {@link #nextPoint((NormalGen, double[], DoubleMatrix2D, double[])) nextPoint}<TT>(gen1, mu, new DenseDoubleMatrix2D(sigma), p)</TT>.
    *
    */
   public static void nextPoint (NormalGen gen1, double[] mu,
                                 double[][] sigma, double[] p) {
      nextPoint (gen1, mu, new DenseDoubleMatrix2D (sigma), p);
   }
View Full Code Here

TOP

Related Classes of cern.colt.matrix.impl.DenseDoubleMatrix2D

Copyright © 2018 www.massapicom. 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.