Class SparseValidation

java.lang.Object
org.flag4j.arrays.sparse.SparseValidation

public final class SparseValidation extends Object
Utility class for validating parameters of sparse vectors, matrices, and tensors.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    validateCoo(int size, int nnz, int[] indices)
    Validates constructor parameters for sparse COO vectors.
    static void
    validateCoo(Shape shape, int nnz, int[][] indices)
    Validates constructor parameters for sparse COO tensors.
    static void
    validateCoo(Shape shape, int nnz, int[] rowIndices, int[] colIndices)
    Validates constructor parameters for sparse COO matrices.
    static void
    validateCsr(Shape shape, int nnz, int[] rowPointers, int[] colIndices)
    Validates constructor parameters for sparse CSR matrices.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SparseValidation

      public SparseValidation()
  • Method Details

    • validateCoo

      public static void validateCoo(int size, int nnz, int[] indices)
      Validates constructor parameters for sparse COO vectors.
      Parameters:
      size - Full size of the COO vector.
      nnz - Number of non-zero entries in the COO vector.
      indices - Non-zero indices of the COO vector.
      Throws:
      IllegalArgumentException - If the parameters do not specify a valid COO vector.
    • validateCoo

      public static void validateCoo(Shape shape, int nnz, int[] rowIndices, int[] colIndices)
      Validates constructor parameters for sparse COO matrices.
      Parameters:
      shape - Shape of the matrix.
      nnz - Number of non-zero values entries in the COO matrix.
      rowIndices - The non-zero row indices in the COO matrix.
      colIndices - The non-zero column indices in the COO matrix.
      Throws:
      IllegalArgumentException - If the parameters do not specify a valid COO Matrix.
    • validateCoo

      public static void validateCoo(Shape shape, int nnz, int[][] indices)
      Validates constructor parameters for sparse COO tensors.
      Parameters:
      shape - Shape of the tensor.
      nnz - Number of non-zero values entries in the COO tensor.
      indices - The non-zero indices of the COO tensor.
    • validateCsr

      public static void validateCsr(Shape shape, int nnz, int[] rowPointers, int[] colIndices)
      Validates constructor parameters for sparse CSR matrices.
      Parameters:
      shape - Shape of the matrix.
      nnz - Number of non-zero values entries in the CSR matrix.
      rowPointers - The non-zero row pointers in the CSR matrix.
      colIndices - The non-zero column indices in the CSR matrix.
      Throws:
      IllegalArgumentException - If the parameters do not specify a valid CSR Matrix.