Class GenericMatrix

All Implemented Interfaces:
IArchive

public class GenericMatrix extends BaseMatrix<GenericMatrix>
Concrete implementation of a BaseMatrix class for general matrices.
Author:
Blaz Kranjc
  • Constructor Details

    • GenericMatrix

      public GenericMatrix(int cntRows, int cntCols)
      Instance a zero matrix of provided size.
      Parameters:
      cntRows - Number of rows.
      cntCols - Number of columns.
      See Also:
    • GenericMatrix

      public GenericMatrix(double[][] arr)
      Instance a matrix with elements provided in an array.
      Parameters:
      arr - Array containing the elements of matrix.
      See Also:
      • BaseMatrix#BaseMatrix(int, int, double[][])
    • GenericMatrix

      public GenericMatrix(BaseMatrix<M> mat)
      Deep copy of any matrix to GenericMatrix.
      Parameters:
      mat - Matrix object.
  • Method Details

    • createSquare

      public static GenericSquareMatrix createSquare(BaseMatrix<?> m)
      Create a copy of provided matrix as a square matrix.
      Parameters:
      m - Generic matrix to be transformed to a square matrix
    • clone

      public GenericMatrix clone()
      Description copied from class: BaseMatrix
      Base classes must override the clone operation in order to make deep copies of the current object. This operation cannot be done without the exact type.
      Specified by:
      clone in class BaseMatrix<GenericMatrix>
      See Also:
    • newInstance

      protected GenericMatrix newInstance(int row, int cnt)
      Description copied from class: BaseMatrix

      Creates a new, uninitialized instance of this matrix type.

      NOTE: · This method was made abstract by Ivo List. Rather than use reflection to instantiate new objects, this function is now delegated to the concrete classes. This architecture is more robust and allows the compiler to do more error checking.

      Specified by:
      newInstance in class BaseMatrix<GenericMatrix>
      Parameters:
      row - Number of rows.
      cnt - Number of columns.
      Returns:
      uninitialized matrix object of type M
      See Also:
      • BaseMatrix#newInstance()