TensorFactory_F64 { public static Tensor_F64 zeros( Random rand, int ...shape ) { Tensor_F64 out = new Tensor_F64(); if( rand != null ) { out.subtensor = true; out.startIndex = rand.nextInt(20)+1; } out.d = new double[ out.startIndex + TensorOps.tensorLength(shape)]; out.reshape(shape); return out; }  static Tensor_F64 zeros( Random rand, int ...shape ); static Tensor_F64 random(Random rand , boolean subTensor , int ...shape ); static Tensor_F64 randomMM( Random rand , boolean subTensor , double min , double max , int ...shape ); static List<Tensor_F64> randomMM(Random rand , boolean subTensor , double min , double max , List<int[]> shapes ); static void randomMM( Random rand , double min , double max , Tensor_F64 tensor );  }
@Test public void zeros() { Tensor_F64 tensor = TensorFactory_F64.zeros(null,4,3,2); assertEquals(4,tensor.length(0)); assertEquals(3,tensor.length(1)); assertEquals(2,tensor.length(2)); assertFalse(tensor.isSub()); int N = tensor.length(); for (int i = 0; i < N; i++) { assertEquals(0.0,tensor.getAtIndex(i), DeepBoofConstants.TEST_TOL_F64); } tensor = TensorFactory_F64.zeros(rand,4,3,2); assertEquals(4,tensor.length(0)); assertEquals(3,tensor.length(1)); assertEquals(2,tensor.length(2)); assertTrue(tensor.isSub()); for (int i = 0; i < N; i++) { assertEquals(0.0,tensor.getAtIndex(i), DeepBoofConstants.TEST_TOL_F64); } }