Package mikera.arrayz

Examples of mikera.arrayz.NDArray


public class BasicNDArrayUsage {

  public static void main(String[] args) {
    // create a new 3x3x3 array
    NDArray a1=NDArray.newArray(3,3,3);
   
    // fill a slice on dimension 1 with zeros
    a1.slice(1,1).fill(2.0);
   
    // add 1.0 to the first slice (on dimension 0 by default)
    a1.slice(0).add(1);
   
    System.out.println(a1);
  }
View Full Code Here


    assertEquals(t,t2);
    assertEquals(t,m.innerProduct(v));
  }
 
  private void doNDArrayTest(AMatrix m) {
    NDArray a=NDArray.newArray(m.getShape());
    a.set(m);
    int rc=m.rowCount();
    int cc=m.columnCount();
    for (int i=0; i<rc; i++) {
      assertEquals(m.getRow(i),a.slice(i));
    }
    for (int i=0; i<cc; i++) {
      assertEquals(m.getColumn(i),a.slice(1,i));
    }

  }
View Full Code Here

TOP

Related Classes of mikera.arrayz.NDArray

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.