org.spaceroots.mantissa.linalg
Class GeneralMatrix
- java.lang.Object
-
- org.spaceroots.mantissa.linalg.Matrix
-
- org.spaceroots.mantissa.linalg.GeneralMatrix
-
- All Implemented Interfaces:
- java.io.Serializable
public class GeneralMatrix extends Matrix
This class represents matrices of the most general type.This class is the basic implementation of matrices to use when nothing special is known about the structure of the matrix.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description GeneralMatrix(int rows, int columns)Simple constructor.GeneralMatrix(int rows, int columns, double[] data)Simple constructor.GeneralMatrix(Matrix m)Copy constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description Matrixduplicate()Polymorphic copy operator.voidselfAdd(Matrix m)Add a matrix to the instance.voidselfSub(Matrix m)Substract a matrix from the instance.-
Methods inherited from class org.spaceroots.mantissa.linalg.Matrix
add, getColumns, getElement, getRows, getTranspose, mul, mul, selfMul, setElement, sub, toString
-
-
-
-
Constructor Detail
-
GeneralMatrix
public GeneralMatrix(int rows, int columns)Simple constructor. Build a matrix with null elements.- Parameters:
rows- number of rows of the matrixcolumns- number of columns of the matrix
-
GeneralMatrix
public GeneralMatrix(int rows, int columns, double[] data)Simple constructor. Build a matrix with specified elements.- Parameters:
rows- number of rows of the matrixcolumns- number of columns of the matrixdata- table of the matrix elements (stored row after row)
-
GeneralMatrix
public GeneralMatrix(Matrix m)
Copy constructor.- Parameters:
m- matrix to copy
-
-
Method Detail
-
duplicate
public Matrix duplicate()
Description copied from class:MatrixPolymorphic copy operator. This method build a new object of the same type of the instance. It is somewhat similar to theObject.clone()method, except that it has public access, it doesn't throw any specific exception and it returns a Matrix.
-
selfAdd
public void selfAdd(Matrix m)
Add a matrix to the instance. This method adds a matrix to the instance. It does modify the instance.- Parameters:
m- matrix to add- Throws:
java.lang.IllegalArgumentException- if there is a dimension mismatch
-
selfSub
public void selfSub(Matrix m)
Substract a matrix from the instance. This method substracts a matrix from the instance. It does modify the instance.- Parameters:
m- matrix to substract- Throws:
java.lang.IllegalArgumentException- if there is a dimension mismatch
-
-
DataMelt 3.0 © DataMelt by jWork.ORG