Class EpistemeLinearAlgebraBackend<E>
java.lang.Object
org.episteme.core.mathematics.linearalgebra.backends.EpistemeLinearAlgebraBackend<E>
- All Implemented Interfaces:
AutoCloseable, LinearAlgebraProvider<E>, SparseLinearAlgebraProvider<E>, AlgorithmProvider, Backend, ComputeBackend, CPUBackend, SIMDBackend
@AutoService({Backend.class,LinearAlgebraProvider.class})
public class EpistemeLinearAlgebraBackend<E>
extends Object
implements SparseLinearAlgebraProvider<E>, SIMDBackend, CPUBackend
Unified CPU backend for Episteme linear algebra.
This backend acts as a foundation (socle) and relay, delegating to optimized dense and sparse providers while ensuring a robust Java environment.
- Since:
- 1.2
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSolves Ax = b using BiCGSTAB (BiConjugate Gradient Stabilized) method.Computes the Cholesky decomposition of the specified matrix.voidclose()Solves Ax = b using Conjugate Gradient method.Creates and returns the backend instance (or returns self if it is the backend).Creates an execution context for running operations.determinant(Matrix<E> a) Computes the eigenvalue decomposition of the specified matrix.Returns the type of hardware accelerator used by this backend.Returns a description of the backend.getId()Returns the unique identifier for this backend (e.g., "javafx", "jmol", "cuda").getName()Returns the display name for UI presentation.intReturns the preferred vector width in bytes for double operations.intPriority of this provider (higher means more preferred).Returns the SIMD instruction set level available.getType()Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").Solves Ax = b using GMRES (Generalized Minimal Residual) method.booleanChecks if the provider is available in the current environment.booleanisCompatible(Ring<?> ring) Checks if this provider is compatible with the given ring.Computes the LU decomposition of the specified matrix.Computes the QR decomposition of the specified matrix.voidshutdown()Called when the provider is no longer needed (e.g., application shutdown).solve(CholeskyResult<E> cholesky, Vector<E> b) Solves Ax = b using a previously computed Cholesky decomposition.Solves Ax = b using a previously computed LU decomposition.Solves Ax = b using a previously computed QR decomposition.solveTriangular(Matrix<E> a, Vector<E> b, boolean upper, boolean transpose, boolean conjugate, boolean unit) Solves the triangular system Ax = b.Computes the Singular Value Decomposition (SVD) of the specified matrix.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AlgorithmProvider
description, getMetadataMethods inherited from interface Backend
getAlgorithmProviders, getStatusMessage, isExplicitlyDisabledMethods inherited from interface CPUBackend
supportsComplexNumbers, supportsFloatingPoint, supportsParallelOpsMethods inherited from interface LinearAlgebraProvider
acos, acosh, add, angle, asin, asinh, atan, atanh, cbrt, configure, conjugateTranspose, cos, cosh, cross, exp, getEnvironmentInfo, log, log10, normalize, pow, projection, score, sin, sinh, sqrt, subtract, tan, tanhMethods inherited from interface SparseLinearAlgebraProvider
conditionNumber, fromDense, getAlgorithmType, rank, toDense
-
Constructor Details
-
EpistemeLinearAlgebraBackend
public EpistemeLinearAlgebraBackend() -
EpistemeLinearAlgebraBackend
-
-
Method Details
-
getId
-
getName
Description copied from interface:BackendReturns the display name for UI presentation.- Specified by:
getNamein interfaceAlgorithmProvider- Specified by:
getNamein interfaceBackend- Specified by:
getNamein interfaceLinearAlgebraProvider<E>
-
getAcceleratorType
Description copied from interface:ComputeBackendReturns the type of hardware accelerator used by this backend.- Specified by:
getAcceleratorTypein interfaceComputeBackend- Specified by:
getAcceleratorTypein interfaceCPUBackend- Specified by:
getAcceleratorTypein interfaceSIMDBackend- Returns:
- the accelerator type
-
getType
Description copied from interface:BackendReturns the backend type category (e.g., "plotting", "molecular", "tensor", "math").- Specified by:
getTypein interfaceBackend- Specified by:
getTypein interfaceComputeBackend- Specified by:
getTypein interfaceCPUBackend- Specified by:
getTypein interfaceSIMDBackend
-
getDescription
Description copied from interface:BackendReturns a description of the backend.- Specified by:
getDescriptionin interfaceBackend- Specified by:
getDescriptionin interfaceComputeBackend
-
isAvailable
public boolean isAvailable()Description copied from interface:AlgorithmProviderChecks if the provider is available in the current environment.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend
-
getPriority
public int getPriority()Description copied from interface:LinearAlgebraProviderPriority of this provider (higher means more preferred). Used for automatic backend selection.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend- Specified by:
getPriorityin interfaceLinearAlgebraProvider<E>
-
isCompatible
Description copied from interface:LinearAlgebraProviderChecks if this provider is compatible with the given ring.- Specified by:
isCompatiblein interfaceLinearAlgebraProvider<E>
-
createContext
Description copied from interface:ComputeBackendCreates an execution context for running operations.The context should be used within a try-with-resources block to ensure proper cleanup of resources.
- Specified by:
createContextin interfaceComputeBackend- Returns:
- new execution context
-
createBackend
Description copied from interface:BackendCreates and returns the backend instance (or returns self if it is the backend).- Specified by:
createBackendin interfaceBackend- Specified by:
createBackendin interfaceComputeBackend- Returns:
- The backend implementation object
-
shutdown
public void shutdown()Description copied from interface:AlgorithmProviderCalled when the provider is no longer needed (e.g., application shutdown). Use this to release local resources or close native segments.- Specified by:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend
-
getSimdLevel
Description copied from interface:SIMDBackendReturns the SIMD instruction set level available.Examples: "AVX2", "AVX-512", "NEON", "SVE", "GENERIC"
- Specified by:
getSimdLevelin interfaceSIMDBackend
-
getPreferredVectorWidth
public int getPreferredVectorWidth()Description copied from interface:SIMDBackendReturns the preferred vector width in bytes for double operations.Typical values: 32 (AVX2), 64 (AVX-512), 16 (NEON)
- Specified by:
getPreferredVectorWidthin interfaceSIMDBackend
-
add
-
subtract
-
multiply
-
multiply
-
scale
-
multiply
-
dot
-
norm
-
transpose
-
trace
-
determinant
- Specified by:
determinantin interfaceLinearAlgebraProvider<E>
-
inverse
-
lu
Description copied from interface:LinearAlgebraProviderComputes the LU decomposition of the specified matrix.- Specified by:
luin interfaceLinearAlgebraProvider<E>
-
qr
Description copied from interface:LinearAlgebraProviderComputes the QR decomposition of the specified matrix.- Specified by:
qrin interfaceLinearAlgebraProvider<E>
-
cholesky
Description copied from interface:LinearAlgebraProviderComputes the Cholesky decomposition of the specified matrix.- Specified by:
choleskyin interfaceLinearAlgebraProvider<E>
-
eigen
Description copied from interface:LinearAlgebraProviderComputes the eigenvalue decomposition of the specified matrix.- Specified by:
eigenin interfaceLinearAlgebraProvider<E>
-
svd
Description copied from interface:LinearAlgebraProviderComputes the Singular Value Decomposition (SVD) of the specified matrix.- Specified by:
svdin interfaceLinearAlgebraProvider<E>
-
solve
-
solve
Description copied from interface:LinearAlgebraProviderSolves Ax = b using a previously computed LU decomposition.- Specified by:
solvein interfaceLinearAlgebraProvider<E>
-
solve
Description copied from interface:LinearAlgebraProviderSolves Ax = b using a previously computed QR decomposition.- Specified by:
solvein interfaceLinearAlgebraProvider<E>
-
solve
Description copied from interface:LinearAlgebraProviderSolves Ax = b using a previously computed Cholesky decomposition.- Specified by:
solvein interfaceLinearAlgebraProvider<E>
-
solveTriangular
public Vector<E> solveTriangular(Matrix<E> a, Vector<E> b, boolean upper, boolean transpose, boolean conjugate, boolean unit) Description copied from interface:LinearAlgebraProviderSolves the triangular system Ax = b.- Specified by:
solveTriangularin interfaceLinearAlgebraProvider<E>- Parameters:
a- the triangular matrixb- the right-hand side vectorupper- true if A is upper triangular, false if lowertranspose- true if solving A^T x = bconjugate- true if solving A^H x = b (only if transpose is true and complex)unit- true if A is unit triangular (diagonal is all ones)
-
bicgstab
-
gmres
public Vector<E> gmres(Matrix<E> a, Vector<E> b, Vector<E> x0, E tolerance, int maxIterations, int restarts) Description copied from interface:SparseLinearAlgebraProviderSolves Ax = b using GMRES (Generalized Minimal Residual) method.- Specified by:
gmresin interfaceSparseLinearAlgebraProvider<E>
-
conjugateGradient
public Vector<E> conjugateGradient(Matrix<E> a, Vector<E> b, Vector<E> x0, E tolerance, int maxIterations) Description copied from interface:SparseLinearAlgebraProviderSolves Ax = b using Conjugate Gradient method.- Specified by:
conjugateGradientin interfaceSparseLinearAlgebraProvider<E>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceLinearAlgebraProvider<E>
-