Examples of innerProduct()


Examples of mikera.matrixx.AMatrix.innerProduct()

 
  @Test public void testBigIdentity() {
    AMatrix m=IdentityMatrix.create(2000000);
    m=m.sparse();
   
    assertEquals(m,m.innerProduct(m));
    assertEquals(m.rowCount(),m.nonZeroCount());
  }
 
 
  @Test public void testSparseSet() {
View Full Code Here

Examples of mikera.matrixx.Matrix.innerProduct()

  @Test public void testInnerProduct() {
    Matrix m=Matrixx.createYAxisRotationMatrix(2.0).toMatrix();
   
    NDArray a=NDArray.wrap(m);
   
    assertEquals(a.innerProduct(a),m.innerProduct(m));
  }
 
  @Test public void testSlice() {
    Matrix22 m1=new Matrix22(1,2,3,4);
    Matrix22 m2=new Matrix22(5,6,7,8);
View Full Code Here

Examples of mikera.matrixx.Matrix33.innerProduct()

    double angle=0.5*Math.PI;
   
    Matrix33 rotM = Matrixx.createRotationMatrix(axis, angle);
    Vector4 rotQ = Quaternions.axisAngle(axis, angle);
   
    Vector3 mv=rotM.innerProduct(v);
    Vector3 qv=Quaternions.rotate(rotQ, v);
   
    assertEquals(mv,qv);
    assertTrue(mv.epsilonEquals(qv));
  }
View Full Code Here

Examples of mikera.matrixx.impl.PermutationMatrix.innerProduct()

  @Test
  public void testPermutationMatrix() {
    PermutationMatrix p = PermutationMatrix.createRandomPermutation(10);

    assertTrue(p.innerProduct(p.getTranspose()).isIdentity());

    try {
      p = PermutationMatrix.create(0, 1, 2, 2, 4);
      fail("Should not be able to create PermutationMatrix with invalid permutation");
    } catch (Throwable t) {
View Full Code Here

Examples of mikera.matrixx.impl.SparseColumnMatrix.innerProduct()

    SparseRowMatrix N = SparseRowMatrix.create(3,3);
    v=Vector.of(4,5,6);
    N.replaceRow(1, v);

    assertEquals(10, M.innerProduct(N).get(1,1), 0.01);
    assertEquals(90, M.innerProduct(N).elementSum(), 0.01);
  }

  @Test public void testConversionAndEquals() {
        int SSIZE = 100, DSIZE = 20;
View Full Code Here

Examples of mikera.matrixx.impl.SparseColumnMatrix.innerProduct()

    SparseRowMatrix N = SparseRowMatrix.create(3,3);
    v=Vector.of(4,5,6);
    N.replaceRow(1, v);

    assertEquals(10, M.innerProduct(N).get(1,1), 0.01);
    assertEquals(90, M.innerProduct(N).elementSum(), 0.01);
  }

  @Test public void testConversionAndEquals() {
        int SSIZE = 100, DSIZE = 20;
    SparseColumnMatrix M=SparseColumnMatrix.create(SSIZE,SSIZE);
View Full Code Here

Examples of mikera.matrixx.impl.SparseRowMatrix.innerProduct()

    // Finally compute the innerProduct (matrix multiplication) of
    // sparse matrix with dense matrix
   
    startTimer();
   
    AMatrix result=m.innerProduct(t);
   
    printTime("Multiply with dense matrix: ");
   
    System.out.println("Result element sum = "+result.elementSum());
    // if this demo is working, the element sum should be roughly the same before and after transformation
View Full Code Here

Examples of mikera.matrixx.impl.SparseRowMatrix.innerProduct()

 
  public static void main(String[] args) {
    SparseRowMatrix sm=createMatrix();
    System.out.println(sm.nonZeroCount() +" elements are non-zero out of " + sm.elementCount()+" total elements");
   
    AMatrix smm=sm.innerProduct(sm);
    System.out.println(smm.nonZeroCount() +" elements are non-zero in the product.");
  }

}
View Full Code Here

Examples of mikera.vectorz.AVector.innerProduct()

  public AMatrix multiplyCopy(double a) {
    AVector[] ndata=new AVector[lineCount()];
    for (int i = 0; i < lineCount(); ++i) {
            AVector v = unsafeGetVec(i);
            if (v != null)
                ndata[i] = v.innerProduct(a);
    }
    return wrap(ndata,rows,cols);
  }
 
  @Override
View Full Code Here

Examples of mikera.vectorz.AVector.innerProduct()

  public AMatrix multiplyCopy(double a) {
    AVector[] ndata=new AVector[lineCount()];
    for (int i = 0; i < lineCount(); ++i) {
            AVector v = unsafeGetVec(i);
            if (v != null)
                ndata[i] = v.innerProduct(a);
    }
    return wrap(ndata,rows,cols);
  }

  @Override
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.