Examples of addMultiple()


Examples of mikera.vectorz.AVector.addMultiple()

    AVector v=Vectorz.newVector(VECTOR_SIZE/2);
    v=v.join(Vectorz.newVector(VECTOR_SIZE-v.length()));

    Vector v2=new Vector(Vectorz.createUniformRandomVector(VECTOR_SIZE));
    for (int i=0; i<runs; i++) {
      v.addMultiple(v2,0.5);
    }
  }
 
  public void timeJoinedVectorAddProduct(int runs) {
    AVector v=Vectorz.newVector(VECTOR_SIZE/2);
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

    assertEquals(14.0,j.get(4),0.0);
    assertEquals(20.0,j.get(5),0.0);
    assertEquals(31.0,j.get(6),0.0);
    assertEquals(2.0,j.get(7),0.0);
   
    j.addMultiple(4,Vector3.of(10,20,30), 10.0);
    assertEquals(2.0,j.get(2),0.0);
    assertEquals(3.0,j.get(3),0.0);
    assertEquals(114.0,j.get(4),0.0);
    assertEquals(220.0,j.get(5),0.0);
    assertEquals(331.0,j.get(6),0.0);
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

   
    v.add(w);
    v.multiply(0.5);
    assertEquals(w,v);

    w.addMultiple(v,3);
    w.multiply(0.25);
    assertEquals(v,w);
   
    w.addProduct(v,w,2);
    assertEquals(210,w.get(10),0.000);
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

 
  @Test public void testJoinedArrayVectorAddMultiple() {
    double[] d=new double[10];
    AVector v=Vector.of(1).join(Vector.of(2,3));
    AVector t=Vector.wrap(d);
    t.addMultiple(0, v, 1);
    assertEquals(Vector.of(1,2,3,0,0,0,0,0,0,0),t);
    t.addMultiple(5, v, 2);
    assertEquals(Vector.of(1,2,3,0,0,2,4,6,0,0),t);
  }
 
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

    double[] d=new double[10];
    AVector v=Vector.of(1).join(Vector.of(2,3));
    AVector t=Vector.wrap(d);
    t.addMultiple(0, v, 1);
    assertEquals(Vector.of(1,2,3,0,0,0,0,0,0,0),t);
    t.addMultiple(5, v, 2);
    assertEquals(Vector.of(1,2,3,0,0,2,4,6,0,0),t);
  }
 
  @Test public void testJoinedArrayVectorAddMultiple2() {
    AVector v=Vector.of(1).join(Vector.of(2,3));
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

  }
 
  @Test public void testJoinedArrayVectorAddMultiple2() {
    AVector v=Vector.of(1).join(Vector.of(2,3));
    AVector t=Vector.of(0,0,0,0).join(Vector.of(0,0)).join(Vector.of(0,0,0,0));
    t.addMultiple(0, v, 1);
    assertEquals(Vector.of(1,2,3,0,0,0,0,0,0,0),t);
    t.addMultiple(5, v, 2);
    assertEquals(Vector.of(1,2,3,0,0,2,4,6,0,0),t);
  }
 
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

  @Test public void testJoinedArrayVectorAddMultiple2() {
    AVector v=Vector.of(1).join(Vector.of(2,3));
    AVector t=Vector.of(0,0,0,0).join(Vector.of(0,0)).join(Vector.of(0,0,0,0));
    t.addMultiple(0, v, 1);
    assertEquals(Vector.of(1,2,3,0,0,0,0,0,0,0),t);
    t.addMultiple(5, v, 2);
    assertEquals(Vector.of(1,2,3,0,0,2,4,6,0,0),t);
  }
 
  @Test public void testJoinedRows() {
    assertEquals(Vector.class, Vectorz.join(Matrixx.createRandomMatrix(5, 5).getSlices()).getClass());
View Full Code Here

Examples of mikera.vectorz.AVector.addMultiple()

    assertEquals(jv,v);
   
    jv.add(v);
    assertEquals(100,v.get(50),0.000001);
   
    jv.addMultiple(is,-1.0);
    assertEquals(v,is);
   
    jv.addProduct(is,is,2.0);
    assertEquals(3,v.get(1),0.000001);
    assertEquals(20100,v.get(100),0.000001);
View Full Code Here

Examples of mikera.vectorz.Vector3.addMultiple()

   
    v.normalise();   
    System.out.println(v);
   
    Vector3 d=Vector3.of(10.0,0.0,0.0);   
    d.addMultiple(v, 5.0);
    System.out.println(d)
   
    Matrix33 m=Matrixx.createXAxisRotationMatrix(Math.PI);
    Vector3 rotated=m.transform(d);      // rotate 180 degrees around x axis    
    System.out.println(rotated)
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.