E
- Type of an individual element.
Subclasses should implement the methods addEle(Object, Object)
to add elements
of the base field.
public abstract class GenericMatrixField<E> extends java.lang.Object implements MatrixFieldI
addEle(Object, Object)
etc.Modifier and Type | Field and Description |
---|---|
protected GenericMatrixFactory<E> |
mf |
Constructor and Description |
---|
GenericMatrixField(GenericMatrixFactory<E> mf)
Standard constructor.
|
GenericMatrixField(GenericMatrixFactory<E> mf,
boolean skipElements)
Constructor where operations on the base field can be switched off.
|
Modifier and Type | Method and Description |
---|---|
protected GenericMatrix<E> |
add(GenericMatrix<E> lm,
GenericMatrix<E> rm) |
protected GenericVector<E> |
add(GenericVector<E> lv,
GenericVector<E> rv) |
java.lang.Object |
add(java.lang.Object l,
java.lang.Object r)
Add two members of the field.
|
protected abstract E |
addEle(E l,
E r)
Adds two elements of the vector/matrix
|
java.lang.Boolean |
and(java.lang.Object l,
java.lang.Object r)
Logical and.
|
protected abstract java.lang.Boolean |
andEle(E l,
E r) |
protected E |
calcSize(E ele)
Get the current "size" of an element
|
protected boolean |
cmpSize(E size,
E max)
Compare current "size" to maximum.
|
java.lang.Object |
cross(GenericVector<E> lv,
GenericVector<E> rv) |
java.lang.Object |
cross(java.lang.Object l,
java.lang.Object r)
The cross product of two vectors
|
protected E |
det(GenericMatrix<E> l) |
java.lang.Object |
det(java.lang.Object l)
The determinant of a matrix
|
protected GenericMatrix<E> |
div(GenericMatrix<E> lm,
java.lang.Object r) |
protected GenericVector<E> |
div(GenericVector<E> lv,
java.lang.Object r) |
java.lang.Object |
div(java.lang.Object l,
java.lang.Object r)
Divides two members of the field.
|
protected abstract E |
divEle(E l,
E r) |
protected E |
dot(GenericVector<E> lv,
GenericVector<E> rv) |
java.lang.Object |
dot(java.lang.Object l,
java.lang.Object r)
The dot product of two vectors
|
protected boolean |
eq(GenericMatrix<E> lm,
GenericMatrix<E> rm) |
protected boolean |
eq(GenericVector<E> lv,
GenericVector<E> rv) |
java.lang.Boolean |
eq(java.lang.Object l,
java.lang.Object r)
Equals
|
protected abstract java.lang.Boolean |
eqEle(E l,
E r) |
java.lang.Boolean |
ge(java.lang.Object l,
java.lang.Object r)
Greater or equal to
|
protected abstract java.lang.Boolean |
geEle(E l,
E r) |
JepComponent |
getLightWeightInstance()
Gets a light-weight instance suitable for using in multiple threads.
|
abstract E |
getOne()
Get the multiplicative identity for this field.
|
abstract E |
getZero()
Get the additive identity for this field
|
java.lang.Boolean |
gt(java.lang.Object l,
java.lang.Object r)
Greater than
|
protected abstract java.lang.Boolean |
gtEle(E l,
E r) |
void |
init(Jep jep)
Initialize the component.
|
java.lang.Object |
inv(java.lang.Object l)
Returns the inverse of a square matrix.
|
protected GenericMatrix<E> |
invMat(GenericMatrix<E> mat) |
java.lang.Boolean |
le(java.lang.Object l,
java.lang.Object r)
Less than or equals to
|
protected abstract java.lang.Boolean |
leEle(E l,
E r) |
java.lang.Boolean |
lt(java.lang.Object l,
java.lang.Object r)
Less than
|
protected abstract java.lang.Boolean |
ltEle(E l,
E r) |
protected GenericMatrix<E> |
minor(GenericMatrix<E> l,
int row,
int col)
Creates the matrix of minors by excluding one row and one column
|
java.lang.Object |
mod(java.lang.Object l,
java.lang.Object r)
Mod operation not defined for matrices
|
protected abstract E |
modEle(E l,
E r) |
protected GenericMatrix<E> |
mul(GenericMatrix<E> lm,
GenericMatrix<E> rm) |
protected GenericVector<E> |
mul(GenericMatrix<E> lm,
GenericVector<E> rv) |
protected GenericMatrix<E> |
mul(GenericMatrix<E> lm,
java.lang.Object r) |
protected GenericVector<E> |
mul(GenericVector<E> lv,
GenericMatrix<E> rm) |
protected GenericMatrix<E> |
mul(GenericVector<E> lv,
GenericVector<E> rv) |
protected GenericVector<E> |
mul(GenericVector<E> lv,
java.lang.Object r) |
java.lang.Object |
mul(java.lang.Object l,
java.lang.Object r)
Multiplies two members of the field.
|
protected abstract E |
mulEle(E l,
E r) |
java.lang.Boolean |
ne(java.lang.Object l,
java.lang.Object r)
Not Equals
|
protected abstract java.lang.Boolean |
neEle(E l,
E r) |
protected GenericMatrix<E> |
neg(GenericMatrix<E> lm) |
protected GenericVector<E> |
neg(GenericVector<E> lv) |
java.lang.Object |
neg(java.lang.Object l)
The negation -x of an element.
|
protected abstract E |
negEle(E l) |
java.lang.Boolean |
not(java.lang.Object l)
Logical not.
|
protected abstract java.lang.Boolean |
notEle(E l) |
java.lang.Boolean |
or(java.lang.Object l,
java.lang.Object r)
Logical or.
|
protected abstract java.lang.Boolean |
orEle(E l,
E r) |
java.lang.Object |
pow(java.lang.Object l,
java.lang.Object r)
Pow operation not defined for matrices
|
protected abstract E |
powEle(E l,
E r) |
java.lang.Object |
solve(java.lang.Object A,
java.lang.Object B)
Solve equation A * X = B
|
protected MatrixI |
solveMM(GenericMatrix<E> A,
GenericMatrix<E> b) |
protected VectorI |
solveMV(GenericMatrix<E> A,
GenericVector<E> b) |
protected GenericMatrix<E> |
sub(GenericMatrix<E> lm,
GenericMatrix<E> rm) |
protected GenericVector<E> |
sub(GenericVector<E> lv,
GenericVector<E> rv) |
java.lang.Object |
sub(java.lang.Object l,
java.lang.Object r)
Subtract two members of the field.
|
protected abstract E |
subEle(E l,
E r) |
protected void |
subtractMul(GenericMatrix<E> m,
int targetRow,
int sourceRow,
E mul)
Subtract a multiply of the source row from the target
m(t,j) = m(t,j) - mul * m(s,j) |
protected void |
swapRows(MatrixI m,
int i,
int j)
In place swap of two rows
|
java.lang.Object |
trace(GenericMatrix<E> l) |
java.lang.Object |
trace(java.lang.Object l)
Returns the trace of a matrix.
|
protected GenericMatrix<E> |
trans(GenericMatrix<E> l) |
java.lang.Object |
trans(java.lang.Object l)
Transpose of a matrix
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
convertFromInt, convertToInt
protected GenericMatrixFactory<E> mf
public GenericMatrixField(GenericMatrixFactory<E> mf)
mf
- The factory used to generate matricespublic GenericMatrixField(GenericMatrixFactory<E> mf, boolean skipElements)
mf
- The factory used to generate matricesskipElements
- whether to skip operations on the base elementsprotected abstract E addEle(E l, E r) throws EvaluationException
l
- lhs elementr
- rhs elementEvaluationException
protected abstract E subEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract E negEle(E l) throws EvaluationException
EvaluationException
protected abstract E mulEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract E modEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract E divEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract E powEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean eqEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean neEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean ltEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean leEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean gtEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean geEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean andEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean orEle(E l, E r) throws EvaluationException
EvaluationException
protected abstract java.lang.Boolean notEle(E l) throws EvaluationException
EvaluationException
public java.lang.Object add(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
add
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorprotected GenericVector<E> add(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
protected GenericMatrix<E> add(GenericMatrix<E> lm, GenericMatrix<E> rm) throws EvaluationException
EvaluationException
public java.lang.Object sub(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
sub
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorprotected GenericMatrix<E> sub(GenericMatrix<E> lm, GenericMatrix<E> rm) throws EvaluationException
EvaluationException
protected GenericVector<E> sub(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
public java.lang.Object neg(java.lang.Object l) throws EvaluationException
FieldI
neg
in interface FieldI
l
- the argumentEvaluationException
- on errorprotected GenericMatrix<E> neg(GenericMatrix<E> lm) throws EvaluationException
EvaluationException
protected GenericVector<E> neg(GenericVector<E> lv) throws EvaluationException
EvaluationException
public java.lang.Object mul(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
mul
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorprotected GenericMatrix<E> mul(GenericMatrix<E> lm, GenericMatrix<E> rm) throws EvaluationException
EvaluationException
protected GenericVector<E> mul(GenericMatrix<E> lm, GenericVector<E> rv) throws EvaluationException
EvaluationException
protected GenericVector<E> mul(GenericVector<E> lv, GenericMatrix<E> rm) throws EvaluationException
EvaluationException
protected GenericMatrix<E> mul(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
protected GenericMatrix<E> mul(GenericMatrix<E> lm, java.lang.Object r) throws EvaluationException
EvaluationException
protected GenericVector<E> mul(GenericVector<E> lv, java.lang.Object r) throws EvaluationException
EvaluationException
public java.lang.Object div(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
div
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorprotected GenericVector<E> div(GenericVector<E> lv, java.lang.Object r) throws EvaluationException
EvaluationException
protected GenericMatrix<E> div(GenericMatrix<E> lm, java.lang.Object r) throws EvaluationException
EvaluationException
public java.lang.Object mod(java.lang.Object l, java.lang.Object r) throws EvaluationException
mod
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
public java.lang.Object pow(java.lang.Object l, java.lang.Object r) throws EvaluationException
pow
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
public java.lang.Boolean eq(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
eq
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean ne(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
ne
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorprotected boolean eq(GenericMatrix<E> lm, GenericMatrix<E> rm) throws EvaluationException
EvaluationException
protected boolean eq(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
public java.lang.Boolean gt(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
gt
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean ge(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
ge
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean lt(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
lt
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean le(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
le
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean and(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
and
in interface FieldI
l
- left hand argument implimentationr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean or(java.lang.Object l, java.lang.Object r) throws EvaluationException
FieldI
or
in interface FieldI
l
- left hand argumentr
- right hand argumentEvaluationException
- on errorpublic java.lang.Boolean not(java.lang.Object l) throws EvaluationException
FieldI
not
in interface FieldI
l
- argumentEvaluationException
- on errorpublic java.lang.Object det(java.lang.Object l) throws EvaluationException
MatrixFieldI
det
in interface MatrixFieldI
EvaluationException
protected E det(GenericMatrix<E> l) throws EvaluationException
EvaluationException
public java.lang.Object trace(java.lang.Object l) throws EvaluationException
MatrixFieldI
trace
in interface MatrixFieldI
l
- the matrixEvaluationException
public java.lang.Object trace(GenericMatrix<E> l) throws EvaluationException
EvaluationException
protected GenericMatrix<E> minor(GenericMatrix<E> l, int row, int col) throws EvaluationException
l
- row
- the row to excludecol
- the column to excludeEvaluationException
public java.lang.Object trans(java.lang.Object l) throws EvaluationException
MatrixFieldI
trans
in interface MatrixFieldI
l
- the matrixEvaluationException
protected GenericMatrix<E> trans(GenericMatrix<E> l)
public java.lang.Object dot(java.lang.Object l, java.lang.Object r) throws EvaluationException
MatrixFieldI
dot
in interface MatrixFieldI
EvaluationException
protected E dot(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
public java.lang.Object cross(java.lang.Object l, java.lang.Object r) throws EvaluationException
MatrixFieldI
cross
in interface MatrixFieldI
EvaluationException
- if either vectors not of length 3public java.lang.Object cross(GenericVector<E> lv, GenericVector<E> rv) throws EvaluationException
EvaluationException
protected void swapRows(MatrixI m, int i, int j) throws EvaluationException
m
- matrixi
- index of first rowj
- index of second rowEvaluationException
protected void subtractMul(GenericMatrix<E> m, int targetRow, int sourceRow, E mul) throws EvaluationException
m(t,j) = m(t,j) - mul * m(s,j)
m
- targetRow
- sourceRow
- mul
- EvaluationException
public abstract E getZero()
FieldI
public abstract E getOne()
FieldI
protected GenericMatrix<E> invMat(GenericMatrix<E> mat) throws EvaluationException
EvaluationException
protected E calcSize(E ele) throws EvaluationException
ele
- EvaluationException
protected boolean cmpSize(E size, E max) throws EvaluationException
size
- currentmax
- maximumEvaluationException
public java.lang.Object inv(java.lang.Object l) throws EvaluationException
MatrixFieldI
inv
in interface MatrixFieldI
l
- the matrixEvaluationException
- if matrix is not square or is singularprotected MatrixI solveMM(GenericMatrix<E> A, GenericMatrix<E> b) throws EvaluationException
EvaluationException
protected VectorI solveMV(GenericMatrix<E> A, GenericVector<E> b) throws EvaluationException
EvaluationException
public java.lang.Object solve(java.lang.Object A, java.lang.Object B) throws EvaluationException
MatrixFieldI
solve
in interface MatrixFieldI
A
- a square matrixB
- either a vector or matrix with same number of rows as AEvaluationException
- if matrix is not square or is singularpublic void init(Jep jep)
JepComponent
init
in interface JepComponent
jep
- the current Jep instancepublic JepComponent getLightWeightInstance()
JepComponent
getLightWeightInstance
in interface JepComponent
Copyright © 2018 Singular Systems http://www.singularsys.com/jep