Package org.flag4j.core
Interface ComplexTensorMixin<T,Y>
- Type Parameters:
T
- Tensor type.Y
- Real tensor type.
- All Known Implementing Classes:
CMatrix
,ComplexDenseTensorBase
,ComplexSparseTensorBase
,CooCMatrix
,CooCTensor
,CooCVector
,CsrCMatrix
,CTensor
,CVector
public interface ComplexTensorMixin<T,Y>
This interface specifies methods which any complex tensor should implement.
-
Method Summary
Modifier and TypeMethodDescriptionconj()
Computes the complex conjugate of a tensor.H()
Computes the conjugate transpose of this tensor.default T
Computes the conjugate transpose of this tensor.boolean
Checks if this tensor contains at least one complex entry.boolean
isReal()
Checks if this tensor has only real valued entries.Sets an index of this tensor to a specified value.toReal()
Converts a complex tensor to a real tensor.Converts a complex tensor to a real matrix safely.
-
Method Details
-
isReal
boolean isReal()Checks if this tensor has only real valued entries.- Returns:
- True if this tensor contains NO complex entries. Otherwise, returns false.
-
isComplex
boolean isComplex()Checks if this tensor contains at least one complex entry.- Returns:
- True if this tensor contains at least one complex entry. Otherwise, returns false.
-
conj
-
toReal
Y toReal()Converts a complex tensor to a real tensor. The imaginary component of any complex value will be ignored.- Returns:
- A tensor of the same size containing only the real components of this tensor.
- See Also:
-
toRealSafe
Y toRealSafe()Converts a complex tensor to a real matrix safely. That is, first checks if the tensor only contains real values and then converts to a real tensor. However, if non-real value exist, then an error is thrown.- Returns:
- A tensor of the same size containing only the real components of this tensor.
- Throws:
RuntimeException
- If this tensor contains at least one non-real value.- See Also:
-
hermTranspose
-
H
T H()Computes the conjugate transpose of this tensor. In the context of a tensor, this swaps the first and last axes and takes the complex conjugate of the elements along these axes. Same ashermTranspose()
.- Returns:
- The complex transpose of this tensor.
-
set
Sets an index of this tensor to a specified value.- Parameters:
value
- Value to set.indices
- The indices of this tensor for which to set the value.- Returns:
- A reference to this tensor.
- Throws:
IllegalArgumentException
- If the number of indices is not equal to the rank of this tensor.IndexOutOfBoundsException
- If any of the indices are not within this tensor.
-