Class AtA

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

public class AtA extends Object implements Matrix
The square matrix of A' * A or A * A', whichever is smaller. For SVD, we compute eigenvalue decomposition of A' * A when m >= n, or that of A * A' when m < n.
  • Constructor Details

    • AtA

      public AtA(Matrix A)
      Constructor.
      Parameters:
      A - the base matrix.
  • Method Details

    • scalarType

      public ScalarType scalarType()
      Description copied from interface: Tensor
      Returns the element data type.
      Specified by:
      scalarType in interface Tensor
      Returns:
      the element data type.
    • 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.
    • length

      public long length()
      Description copied from interface: Tensor
      Returns the number of tensor elements. For tensors with packed storage (e.g., BandMatrix, SparseMatrix, SymmMatrix), it returns the number of non-zero elements.
      Specified by:
      length in interface Matrix
      Specified by:
      length in interface Tensor
      Returns:
      the number of tensor elements.
    • get

      public double get(int i, int j)
      Description copied from interface: Matrix
      Returns A[i,j].
      Specified by:
      get in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      Returns:
      the matrix element value.
    • set

      public void set(int i, int j, double x)
      Description copied from interface: Matrix
      Sets A[i,j] = x.
      Specified by:
      set in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      x - the matrix element value.
    • add

      public void add(int i, int j, double x)
      Description copied from interface: Matrix
      Sets A[i,j] += x.
      Specified by:
      add in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      x - the operand.
    • sub

      public void sub(int i, int j, double x)
      Description copied from interface: Matrix
      Sets A[i,j] -= x.
      Specified by:
      sub in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      x - the operand.
    • mul

      public void mul(int i, int j, double x)
      Description copied from interface: Matrix
      Sets A[i,j] *= x.
      Specified by:
      mul in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      x - the operand.
    • div

      public void div(int i, int j, double x)
      Description copied from interface: Matrix
      Sets A[i,j] /= x.
      Specified by:
      div in interface Matrix
      Parameters:
      i - the row index.
      j - the column index.
      x - the operand.
    • scale

      public Matrix 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 Matrix 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 Matrix 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.
    • 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.
    • mv

      public void mv(Vector work, int inputOffset, int outputOffset)
      Description copied from interface: Matrix
      Matrix-vector multiplication A * x.
      Specified by:
      mv in interface Matrix
      Parameters:
      work - the workspace for both input and output vector.
      inputOffset - the offset of input vector in workspace.
      outputOffset - the offset of output vector in workspace.
    • tv

      public void tv(Vector work, int inputOffset, int outputOffset)
      Description copied from interface: Matrix
      Matrix-vector multiplication A' * x.
      Specified by:
      tv in interface Matrix
      Parameters:
      work - the workspace for both input and output vector.
      inputOffset - the offset of input vector in workspace.
      outputOffset - the offset of output vector in workspace.