@Test public void getNonZeroIndicesOfRow() { testTensor1.setEntry(0.5d, 0, 0, 0); testTensor1.setEntry(1.0d, 0, 1, 0); testTensor1.setEntry(0.5d, 1, 0, 0); testTensor1.setEntry(1.0d, 1, 1, 1); Collection<Integer> indices = new ArrayList<>(); indices.add(0); indices.add(1); Assert.assertEquals(indices, testTensor1.getNonZeroIndicesOfRow(0, 0)); indices.clear(); indices.add(0); Assert.assertEquals(indices, testTensor1.getNonZeroIndicesOfRow(1, 0)); }
public Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3) { NonZeroVectorProcedure nz = new NonZeroVectorProcedure(); slices.get(x3).eachNonZeroInRow(x1, nz); return nz.getNonZeroIndices(); }
ThirdOrderSparseTensor { public Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3) { NonZeroVectorProcedure nz = new NonZeroVectorProcedure(); slices.get(x3).eachNonZeroInRow(x1, nz); return nz.getNonZeroIndices(); } }
ThirdOrderSparseTensor { public Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3) { NonZeroVectorProcedure nz = new NonZeroVectorProcedure(); slices.get(x3).eachNonZeroInRow(x1, nz); return nz.getNonZeroIndices(); } ThirdOrderSparseTensor(int dimX1, int dimX2); }
ThirdOrderSparseTensor { public Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3) { NonZeroVectorProcedure nz = new NonZeroVectorProcedure(); slices.get(x3).eachNonZeroInRow(x1, nz); return nz.getNonZeroIndices(); } ThirdOrderSparseTensor(int dimX1, int dimX2); void resize(int dimX1, int dimX2); void setEntry(double value, int x1, int x2, int x3); double getEntry(int x1, int x2, int x3); int getNonZeroEntries(int dimX3); int[] getDimensions(); void writeSliceToFile(String fileName, int slice); Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3); boolean hasNonZeroEntryInRow(int x1, int x3); }
ThirdOrderSparseTensor { public Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3) { NonZeroVectorProcedure nz = new NonZeroVectorProcedure(); slices.get(x3).eachNonZeroInRow(x1, nz); return nz.getNonZeroIndices(); } ThirdOrderSparseTensor(int dimX1, int dimX2); void resize(int dimX1, int dimX2); void setEntry(double value, int x1, int x2, int x3); double getEntry(int x1, int x2, int x3); int getNonZeroEntries(int dimX3); int[] getDimensions(); void writeSliceToFile(String fileName, int slice); Collection<Integer> getNonZeroIndicesOfRow(int x1, int x3); boolean hasNonZeroEntryInRow(int x1, int x3);  }