Class SymmMatrix

java.lang.Object
smile.tensor.SymmMatrix
All Implemented Interfaces:
Serializable, Matrix, Tensor

public abstract class SymmMatrix extends Object implements Matrix, Serializable
The symmetric matrix in packed storage.
See Also:
  • Method Details

    • zeros

      public static SymmMatrix zeros(ScalarType scalarType, UPLO uplo, int n)
      Returns a zero matrix.
      Parameters:
      uplo - the symmetric matrix stores the upper or lower triangle.
      n - the dimension of matrix.
      Returns:
      the packed symmetric matrix.
    • of

      public static SymmMatrix of(DenseMatrix A)
      Returns a symmetric matrix from a dense matrix.
      Parameters:
      A - the dense symmetric matrix.
      Returns:
      the packed symmetric matrix.
    • of

      public static SymmMatrix of(UPLO uplo, double[][] AP)
      Returns a symmetric matrix from a two-dimensional array.
      Parameters:
      uplo - the symmetric matrix stores the upper or lower triangle.
      AP - the symmetric matrix.
      Returns:
      the packed symmetric matrix.
    • of

      public static SymmMatrix of(UPLO uplo, float[][] AP)
      Returns a symmetric matrix from a two-dimensional array.
      Parameters:
      uplo - the symmetric matrix stores the upper or lower triangle.
      AP - the symmetric matrix.
      Returns:
      the packed symmetric matrix.
    • nrow

      public int nrow()
      Description copied from interface: Matrix
      Returns the number of rows.
      Specified by:
      nrow in interface Matrix
      Returns:
      the number of rows.
    • ncol

      public int ncol()
      Description copied from interface: Matrix
      Returns the number of columns.
      Specified by:
      ncol in interface Matrix
      Returns:
      the number of columns.
    • scale

      public SymmMatrix scale(double alpha)
      Description copied from interface: Matrix
      A *= alpha
      Specified by:
      scale in interface Matrix
      Parameters:
      alpha - the scaling factor.
      Returns:
      this matrix.
    • copy

      public abstract SymmMatrix copy()
      Description copied from interface: Matrix
      Returns a deep copy of matrix.
      Specified by:
      copy in interface Matrix
      Returns:
      a deep copy of matrix.
    • transpose

      public SymmMatrix transpose()
      Description copied from interface: Matrix
      Returns the transpose of matrix. The transpose may share the storage with this matrix.
      Specified by:
      transpose in interface Matrix
      Returns:
      the transpose of matrix.
    • order

      public Order order()
      Returns the matrix layout.
      Returns:
      the matrix layout.
    • uplo

      public UPLO uplo()
      Gets the format of packed matrix.
      Returns:
      the format of packed matrix.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • mv

      public void mv(Transpose trans, double alpha, Vector x, double beta, Vector y)
      Description copied from interface: Matrix
      Matrix-vector multiplication.
          y = alpha * A * x + beta * y
      
      Specified by:
      mv in interface Matrix
      Parameters:
      trans - normal, transpose, or conjugate transpose operation on the matrix.
      alpha - the scalar alpha.
      x - the input vector.
      beta - the scalar beta. When beta is supplied as zero, y need not be set on input.
      y - the input and output vector.
    • solve

      public Vector solve(double[] b)
      Solve A * x = b.
      Parameters:
      b - the right hand side of linear systems.
      Returns:
      the solution vector.
      Throws:
      RuntimeException - when the matrix is singular.
    • solve

      public Vector solve(float[] b)
      Solve A * x = b.
      Parameters:
      b - the right hand side of linear systems.
      Returns:
      the solution vector.
      Throws:
      RuntimeException - when the matrix is singular.
    • solve

      public void solve(DenseMatrix B)
      Solves the linear system A * X = B.
      Parameters:
      B - the right hand side of linear systems. On output, B will be overwritten with the solution matrix.