Class AbstractDenseFieldMatrix<T extends AbstractDenseFieldMatrix<T,U,V>,U extends AbstractDenseFieldVector<U,T,V>,V extends Field<V>>
java.lang.Object
org.flag4j.arrays.backend.AbstractTensor<T,V[],V>
org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor<T,V>
org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringMatrix<T,U,V>
org.flag4j.arrays.backend.ring_arrays.AbstractDenseRingMatrix<T,U,V>
org.flag4j.arrays.backend.field_arrays.AbstractDenseFieldMatrix<T,U,V>
- All Implemented Interfaces:
Serializable
,FieldTensorMixin<T,
,T, V> TensorOverField<T,
,T, V[], V> MatrixMixin<T,
,T, U, V> RingTensorMixin<T,
,T, V> TensorOverRing<T,
,T, V[], V> SemiringTensorMixin<T,
,T, V> TensorOverSemiring<T,
T, V[], V>
- Direct Known Subclasses:
CMatrix
,FieldMatrix
public abstract class AbstractDenseFieldMatrix<T extends AbstractDenseFieldMatrix<T,U,V>,U extends AbstractDenseFieldVector<U,T,V>,V extends Field<V>>
extends AbstractDenseRingMatrix<T,U,V>
implements MatrixMixin<T,T,U,V>, FieldTensorMixin<T,T,V>
- See Also:
-
Field Summary
Fields inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringMatrix
numCols, numRows
Fields inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor
zeroElement
Fields inherited from class org.flag4j.arrays.backend.AbstractTensor
data, rank, shape
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractDenseFieldMatrix
(Shape shape, V[] data) Creates a tensor with the specified data and shape. -
Method Summary
Modifier and TypeMethodDescriptionabs()
Computes the element-wise absolute value of this tensor.boolean
Checks if all data of this matrix are 'close' as defined below.boolean
Checks if all data of this matrix are 'close' as defined below.Computes the element-wise quotient of two matrices.H()
Computes the Hermitian transpose of this matrix.boolean
isFinite()
Checks if this tensor only contains finite values.boolean
Checks if this tensor contains at least one infinite value.boolean
isNaN()
Checks if this tensor contains at least one NaN value.boolean
Checks if this matrix is unitary.abstract AbstractCsrFieldMatrix
<?, T, ?, V> makeLikeCsrMatrix
(Shape shape, V[] entries, int[] rowPointers, int[] colIndices) Constructs a sparse CSR matrix which is of a similar type as this dense matrix.sqrt()
Computes the element-wise square root of this tensor.Methods inherited from class org.flag4j.arrays.backend.ring_arrays.AbstractDenseRingMatrix
H, H, isCloseToIdentity, isHermitian, norm, sub, subEq
Methods inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringMatrix
augment, augment, dataLength, flatten, flatten, get, getCol, getDiag, getRow, getSlice, getTriL, getTriU, isI, isOrthogonal, isSymmetric, isTriL, isTriU, makeLikeCooMatrix, makeLikeVector, makeLikeVector, mult, mult, multTranspose, numCols, numRows, removeCol, removeCols, removeRow, removeRows, set, setCol, setCol, setRow, setRow, setSlice, setSliceCopy, setValues, stack, swapCols, swapRows, T, toCoo, toCoo, toCsr, toCsr, toTensor, toTensor, toVector, tr
Methods inherited from class org.flag4j.arrays.backend.semiring_arrays.AbstractDenseSemiringTensor
add, addEq, argmax, argmin, copy, elemMult, get, getZeroElement, makeLikeCooTensor, max, min, reshape, set, setZeroElement, T, T, tensorDot, tensorTr
Methods inherited from class org.flag4j.arrays.backend.AbstractTensor
getData, getRank, getShape, makeLikeTensor, reshape, sameShape, totalEntries
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.flag4j.arrays.backend.field_arrays.FieldTensorMixin
add, add, addEq, addEq, argmax, argmaxAbs, argmin, argminAbs, conj, div, div, divEq, divEq, isOnes, isZeros, makeEmptyDataArray, max, maxAbs, min, minAbs, mult, mult, multEq, multEq, norm, norm, prod, recip, sub, sub, subEq, subEq, sum
Methods inherited from interface org.flag4j.arrays.backend.MatrixMixin
accept, add, augment, augment, copy, dataLength, elemMult, fib, get, getCol, getCol, getDiag, getDiag, getRow, getRow, getShape, getSlice, getTriL, getTriL, getTriU, getTriU, isDiag, isHermitian, isI, isOrthogonal, isSquare, isSymmetric, isTri, isTriL, isTriU, isVector, mult, mult, multTranspose, numCols, numRows, removeCol, removeCols, removeRow, removeRows, set, setCol, setRow, setSliceCopy, stack, stack, sub, swapCols, swapRows, T, toVector, tr, trace, vectorType
Methods inherited from interface org.flag4j.arrays.backend.ring_arrays.TensorOverRing
H, H, sub
-
Constructor Details
-
AbstractDenseFieldMatrix
Creates a tensor with the specified data and shape.- Parameters:
shape
- Shape of this tensor.data
- Entries of this tensor. If this tensor is dense, this specifies all data within the tensor. If this tensor is sparse, this specifies only the non-zero data of the tensor.
-
-
Method Details
-
makeLikeCsrMatrix
public abstract AbstractCsrFieldMatrix<?,T, makeLikeCsrMatrix?, V> (Shape shape, V[] entries, int[] rowPointers, int[] colIndices) Constructs a sparse CSR matrix which is of a similar type as this dense matrix.- Specified by:
makeLikeCsrMatrix
in classAbstractDenseSemiringMatrix<T extends AbstractDenseFieldMatrix<T,
U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Parameters:
shape
- Shape of the CSR matrix.entries
- Non-zero data of the CSR matrix.rowPointers
- Non-zero row pointers of the CSR matrix.colIndices
- Non-zero column indices of the CSR matrix.- Returns:
- A sparse CSR matrix which is of a similar type as this dense matrix.
-
isUnitary
public boolean isUnitary()Checks if this matrix is unitary. That is, if the inverse of this matrix is approximately equal to its transpose.- Returns:
true
if this matrix it is unitary;false
otherwise.
-
abs
Computes the element-wise absolute value of this tensor. -
H
Computes the Hermitian transpose of this matrix.- Specified by:
H
in interfaceMatrixMixin<T extends AbstractDenseFieldMatrix<T,
U, V>, T extends AbstractDenseFieldMatrix<T, U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Specified by:
H
in interfaceTensorOverRing<T extends AbstractDenseFieldMatrix<T,
U, V>, T extends AbstractDenseFieldMatrix<T, U, V>, V extends Field<V>[], V extends Field<V>> - Overrides:
H
in classAbstractDenseSemiringMatrix<T extends AbstractDenseFieldMatrix<T,
U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Returns:
- The Hermitian transpose of this matrix.
- See Also:
-
div
Computes the element-wise quotient of two matrices.- Specified by:
div
in interfaceMatrixMixin<T extends AbstractDenseFieldMatrix<T,
U, V>, T extends AbstractDenseFieldMatrix<T, U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Specified by:
div
in interfaceTensorOverField<T extends AbstractDenseFieldMatrix<T,
U, V>, T extends AbstractDenseFieldMatrix<T, U, V>, V extends Field<V>[], V extends Field<V>> - Parameters:
b
- Second matrix in the element-wise quotient.- Returns:
- The element-wise quotient of this matrix and
b
.
-
sqrt
-
isFinite
public boolean isFinite()Checks if this tensor only contains finite values. -
isInfinite
public boolean isInfinite()Checks if this tensor contains at least one infinite value.- Specified by:
isInfinite
in interfaceTensorOverField<T extends AbstractDenseFieldMatrix<T,
U, V>, T extends AbstractDenseFieldMatrix<T, U, V>, V extends Field<V>[], V extends Field<V>> - Returns:
true
if this tensor contains at least one infinite value;false
otherwise.- See Also:
-
isNaN
public boolean isNaN()Checks if this tensor contains at least one NaN value. -
allClose
Checks if all data of this matrix are 'close' as defined below. Custom tolerances may be specified usingallClose(AbstractDenseFieldMatrix, double, double)
.- Overrides:
allClose
in classAbstractDenseRingMatrix<T extends AbstractDenseFieldMatrix<T,
U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Parameters:
b
- Second tensor in the comparison.- Returns:
- True if both tensors have the same shape and all data are 'close' element-wise, i.e.
elements
x
andy
at the same positions in the two tensors respectively and satisfy|x-y| <= (1E-08 + 1E-05*|y|)
. Otherwise, returns false. - See Also:
-
allClose
Checks if all data of this matrix are 'close' as defined below.- Overrides:
allClose
in classAbstractDenseRingMatrix<T extends AbstractDenseFieldMatrix<T,
U, V>, U extends AbstractDenseFieldVector<U, T, V>, V extends Field<V>> - Parameters:
b
- Second tensor in the comparison.absTol
- Absolute tolerance.- Returns:
- True if both tensors have the same length and all data are 'close' element-wise, i.e.
elements
x
andy
at the same positions in the two tensors respectively and satisfy|x-y| <= (absTol + relTol*|y|)
. Otherwise, returns false. - See Also:
-