Class GenericFieldMatrix<F extends Field<F>>
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.generic.matrixtype.GenericFieldMatrix<F>
-
- Type Parameters:
F
- the numberField
- All Implemented Interfaces:
GenericMatrix<GenericFieldMatrix<F>,F>
,GenericMatrixAccess<F>
,AbelianGroup<GenericFieldMatrix<F>>
,Monoid<GenericFieldMatrix<F>>
,Ring<GenericFieldMatrix<F>>
,VectorSpace<GenericFieldMatrix<F>,F>
,Table
public class GenericFieldMatrix<F extends Field<F>> extends Object implements GenericMatrix<GenericFieldMatrix<F>,F>
This is a generic matrix over aField
.
-
-
Constructor Summary
Constructors Constructor Description GenericFieldMatrix(int nRows, int nCols, F init)
Construct a matrix over a field.GenericFieldMatrix(F[][] data)
Construct a matrix over a field.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericFieldMatrix<F>
add(GenericFieldMatrix<F> that)
+ : G × G → Gboolean
equals(Object obj)
F
get(int row, int col)
Get the matrix entry at [i,j].int
hashCode()
GenericFieldMatrix<F>
minus(GenericFieldMatrix<F> that)
- : G × G → GGenericFieldMatrix<F>
multiply(GenericFieldMatrix<F> that)
× : G × G → Gint
nCols()
Gets the number of columns.int
nRows()
Gets the number of rows.GenericFieldMatrix<F>
ONE()
The multiplicative element 1 in the group such that for any elements a in the group, the equation 1 × a = a × 1 = a holds.GenericFieldMatrix<F>
opposite()
For each a in G, there exists an element b in G such that a + b = b + a = 0.GenericFieldMatrix<F>
scaled(F scalar)
× : F × V → Vvoid
set(int row, int col, F value)
Set the matrix entry at [i,j] to a value.String
toString()
GenericFieldMatrix<F>
ZERO()
The additive element 0 in the group, such that for all elements a in the group, the equation 0 + a = a + 0 = a holds.
-
-
-
Constructor Detail
-
GenericFieldMatrix
public GenericFieldMatrix(int nRows, int nCols, F init)
Construct a matrix over a field.- Parameters:
nRows
- the number of rowsnCols
- the number of columnsinit
- an initial value for the entries, e.g., 0
-
GenericFieldMatrix
public GenericFieldMatrix(F[][] data)
Construct a matrix over a field.- Parameters:
data
- the matrix entries
-
-
Method Detail
-
nRows
public int nRows()
Description copied from interface:Table
Gets the number of rows. Rows count from 1.
-
nCols
public int nCols()
Description copied from interface:Table
Gets the number of columns. Columns count from 1.
-
set
public void set(int row, int col, F value) throws MatrixAccessException
Description copied from interface:GenericMatrixAccess
Set the matrix entry at [i,j] to a value. This is the only method that may change a matrix.- Specified by:
set
in interfaceGenericMatrixAccess<F extends Field<F>>
- Parameters:
row
- the row indexcol
- the column indexvalue
- the value to set A[i,j] to- Throws:
MatrixAccessException
- if i or j is out of range
-
get
public F get(int row, int col) throws MatrixAccessException
Description copied from interface:GenericMatrixAccess
Get the matrix entry at [i,j].- Specified by:
get
in interfaceGenericMatrixAccess<F extends Field<F>>
- Parameters:
row
- the row indexcol
- the column index- Returns:
- A[i,j]
- Throws:
MatrixAccessException
- if i or j is out of range
-
add
public GenericFieldMatrix<F> add(GenericFieldMatrix<F> that)
Description copied from interface:AbelianGroup
+ : G × G → G- Specified by:
add
in interfaceAbelianGroup<F extends Field<F>>
- Parameters:
that
- the object to be added- Returns:
- this + that
-
minus
public GenericFieldMatrix<F> minus(GenericFieldMatrix<F> that)
Description copied from interface:AbelianGroup
- : G × G → G The operation "-" is not in the definition of of an additive group but can be deduced. This function is provided for convenience purpose. It is equivalent to
.this.add(that.opposite())
- Specified by:
minus
in interfaceAbelianGroup<F extends Field<F>>
- Parameters:
that
- the object to be subtracted (subtrahend)- Returns:
- this - that
-
multiply
public GenericFieldMatrix<F> multiply(GenericFieldMatrix<F> that)
Description copied from interface:Monoid
× : G × G → G
-
scaled
public GenericFieldMatrix<F> scaled(F scalar)
Description copied from interface:VectorSpace
× : F × V → V The result of applying this function to a scalar, c, in F and v in V is denoted cv.- Specified by:
scaled
in interfaceVectorSpace<GenericFieldMatrix<F extends Field<F>>,F extends Field<F>>
- Parameters:
scalar
- a multiplier- Returns:
- c * this
- See Also:
- Wikipedia: Scalar multiplication
-
opposite
public GenericFieldMatrix<F> opposite()
Description copied from interface:AbelianGroup
For each a in G, there exists an element b in G such that a + b = b + a = 0. That is, it is the object such asthis.add(this.opposite()) == this.ZERO
- Specified by:
opposite
in interfaceAbelianGroup<F extends Field<F>>
- Returns:
- -this, the additive opposite
- See Also:
- Wikipedia: Additive inverse
-
ZERO
public GenericFieldMatrix<F> ZERO()
Description copied from interface:AbelianGroup
The additive element 0 in the group, such that for all elements a in the group, the equation 0 + a = a + 0 = a holds.- Specified by:
ZERO
in interfaceAbelianGroup<F extends Field<F>>
- Returns:
- 0, the additive identity
-
ONE
public GenericFieldMatrix<F> ONE()
Description copied from interface:Monoid
The multiplicative element 1 in the group such that for any elements a in the group, the equation 1 × a = a × 1 = a holds.
-
-