Package org.encog.mathutil.matrices

Examples of org.encog.mathutil.matrices.Matrix


    EncogFileSection section;
    int inputCount = 0;
    int instarCount = 0;
    int outputCount = 0;
    int winnerCount = 0;
    Matrix m1 = null;
    Matrix m2 = null;

    while ((section = in.readNextSection()) != null) {
      if (section.getSectionName().equals("CPN")
          && section.getSubSectionName().equals("PARAMS")) {
        networkParams = section.parseParams();
View Full Code Here


          + " neurons, cannot learn a pattern of size "
          + pattern.size());
    }

    // Create a row matrix from the input, convert boolean to bipolar
    final Matrix m2 = Matrix.createRowMatrix(pattern.getData());
    // Transpose the matrix and multiply by the original input matrix
    final Matrix m1 = MatrixMath.transpose(m2);
    final Matrix m3 = MatrixMath.multiply(m1, m2);

    // matrix 3 should be square by now, so create an identity
    // matrix of the same size.
    final Matrix identity = MatrixMath.identity(m3.getRows());

    // subtract the identity matrix
    final Matrix m4 = MatrixMath.subtract(m3, identity);

    // now add the calculated matrix, for this pattern, to the
    // existing weight matrix.
    convertHopfieldMatrix(m4);
  }
View Full Code Here

      final int theOutstarCount, final int theWinnerCount) {
    this.inputCount = theInputCount;
    this.instarCount = theInstarCount;
    this.outstarCount = theOutstarCount;

    this.weightsInputToInstar = new Matrix(inputCount, instarCount);
    this.weightsInstarToOutstar = new Matrix(instarCount, outstarCount);
    this.winnerCount = theWinnerCount;
  }
View Full Code Here

   */
  public ART1(final int theF1Count, final int theF2Count) {
    this.f1Count = theF1Count;
    this.f2Count = theF2Count;

    this.weightsF1toF2 = new Matrix(this.f1Count, this.f2Count);
    this.weightsF2toF1 = new Matrix(this.f2Count, this.f1Count);

    this.inhibitF2 = new boolean[this.f2Count];

    this.outputF1 = new BiPolarNeuralData(this.f1Count);
    this.outputF2 = new BiPolarNeuralData(this.f2Count);
View Full Code Here

   */
  public BAM(final int theF1Count, final int theF2Count) {
    this.f1Count = theF1Count;
    this.f2Count = theF2Count;

    this.weightsF1toF2 = new Matrix(f1Count, f2Count);
    this.weightsF2toF1 = new Matrix(f2Count, f1Count);
  }
View Full Code Here

    double m[][] = {
        {1,2,3,4},
        {5,6,7,8},
        {9,10,11,12},
        {13,14,15,16} };
    Matrix matrix = new Matrix(m);
    SingularValueDecomposition svd = new SingularValueDecomposition(matrix);
    Assert.assertEquals(2147483647, (int)(svd.cond()) );
    double[] d = svd.getSingularValues();
   
    Assert.assertEquals(4, d.length);
View Full Code Here

    double m1[][] = {
        {1,0,0,0},
        {0,1,0,0},
        {0,0,1,0},
        {0,0,0,1} };
    Matrix matrix1 = new Matrix(m1);
   
    double m2[][] = {
        {17,18,19,20},
        {21,22,23,24},
        {25,27,28,29},
        {37,33,31,30} };
    Matrix matrix2 = new Matrix(m2);
   
    CholeskyDecomposition c = new CholeskyDecomposition(matrix1);
    c.solve(matrix2);

    Matrix mx = c.getL();
   
    Assert.assertEquals(1.0, mx.get(0,0));
    Assert.assertEquals(1.0, mx.get(1,1));
    Assert.assertEquals(1.0, mx.get(2,2));
    Assert.assertEquals(4, mx.getRows());
    Assert.assertEquals(4, mx.getCols());
  }
View Full Code Here

    double m1[][] = {
        {1,0,0,0},
        {0,1,0,0},
        {0,0,1,0},
        {0,0,0,1} };
    Matrix matrix1 = new Matrix(m1);
     
    EigenvalueDecomposition e = new EigenvalueDecomposition(matrix1);
   
    double[] d1 = e.getImagEigenvalues();
    double[] d2 = e.getRealEigenvalues();
    Matrix mx = e.getV();
   
    Assert.assertEquals(1.0, mx.get(0,0));
    Assert.assertEquals(1.0, mx.get(1,1));
    Assert.assertEquals(1.0, mx.get(2,2));
    Assert.assertEquals(4, mx.getRows());
    Assert.assertEquals(4, mx.getCols());
  }
View Full Code Here

    double m1[][] = {
        {1,0,0,0},
        {0,1,0,0},
        {0,0,1,0},
        {1,0,0,1} };
    Matrix matrix1 = new Matrix(m1);
     
    EigenvalueDecomposition e = new EigenvalueDecomposition(matrix1);
   
    double[] d1 = e.getImagEigenvalues();
    double[] d2 = e.getRealEigenvalues();
    Matrix mx = e.getV();
   
    Assert.assertEquals(0.0, mx.get(0,0));
    Assert.assertEquals(0.0, mx.get(1,1));
    Assert.assertEquals(1.0, mx.get(2,2));
    Assert.assertEquals(4, mx.getRows());
    Assert.assertEquals(4, mx.getCols());
  }
View Full Code Here

    double m1[][] = {
        {1,0,0,0},
        {0,1,0,0},
        {0,0,1,0},
        {0,0,0,1} };
    Matrix matrix1 = new Matrix(m1);
   
    double m2[][] = {
        {17,18,19,20},
        {21,22,23,24},
        {25,27,28,29},
        {37,33,31,30} };
    Matrix matrix2 = new Matrix(m2);
   
    QRDecomposition c = new QRDecomposition(matrix1);
    Matrix mx = c.solve(matrix2);
   
    Assert.assertEquals(17.0, mx.get(0,0));
    Assert.assertEquals(22.0, mx.get(1,1));
    Assert.assertEquals(28.0, mx.get(2,2));
    Assert.assertEquals(4, mx.getRows());
    Assert.assertEquals(4, mx.getCols());
  }
View Full Code Here

TOP

Related Classes of org.encog.mathutil.matrices.Matrix

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.