Class JBlasBackend<E>
java.lang.Object
org.episteme.core.mathematics.linearalgebra.backends.JBlasBackend<E>
- All Implemented Interfaces:
AutoCloseable, LinearAlgebraProvider<E>, AlgorithmProvider, Backend, ComputeBackend, CPUBackend
@AutoService({Backend.class,CPUBackend.class,LinearAlgebraProvider.class})
public class JBlasBackend<E>
extends Object
implements CPUBackend, LinearAlgebraProvider<E>
CPU compute backend for JBlas (Java BLAS).
JBlas provides linear algebra for Java based on native BLAS/LAPACK libraries, offering high performance for dense matrix operations. This backend wraps the JBlas linear algebra provider and integrates it into the Episteme backend discovery system.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the angle between two vectors in radians.Computes the Cholesky decomposition of the specified matrix.Creates and returns the backend instance (or returns self if it is the backend).Creates an execution context for running operations.Returns the cross product of two 3D vectors.determinant(Matrix<E> a) Computes the eigenvalue decomposition of the specified matrix.Computes the matrix exponential e^A.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 priority for auto-selection (higher = preferred).getType()Returns the backend type category (e.g., "plotting", "molecular", "tensor", "math").booleanChecks if this backend is currently available (libraries loaded, etc.).booleanisCompatible(Ring<?> ring) Checks if this provider is compatible with the given ring.Computes the LU decomposition of the specified matrix.Returns the normalized vector (unit vector).projection(Vector<E> a, Vector<E> b) Returns the projection of vector a onto vector b.Computes the QR decomposition of the specified matrix.doublescore(OperationContext context) Scores this provider for a specific operation context.voidshutdown()Called when the application is shutting down or the backend is being replaced.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
getAcceleratorType, supportsComplexNumbers, supportsFloatingPoint, supportsParallelOpsMethods inherited from interface LinearAlgebraProvider
close, conditionNumber, configure, conjugateTranspose, getAlgorithmType, getEnvironmentInfo, rank, solve, solve, solve
-
Constructor Details
-
JBlasBackend
public JBlasBackend() -
JBlasBackend
-
-
Method Details
-
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
-
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>
-
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:BackendChecks if this backend is currently available (libraries loaded, etc.).Default implementation checks
Backend.isExplicitlyDisabled()and returns false if it is.- Specified by:
isAvailablein interfaceAlgorithmProvider- Specified by:
isAvailablein interfaceBackend
-
getPriority
public int getPriority()Description copied from interface:BackendReturns the priority for auto-selection (higher = preferred). Used when multiple backends are available.- Specified by:
getPriorityin interfaceAlgorithmProvider- Specified by:
getPriorityin interfaceBackend- Specified by:
getPriorityin interfaceLinearAlgebraProvider<E>
-
score
Description copied from interface:AlgorithmProviderScores this provider for a specific operation context.Higher scores indicate better suitability. Used by
ProviderSelectorfor context-aware selection.Default implementation returns
AlgorithmProvider.getPriority(), so existing providers behave identically without changes.- Specified by:
scorein interfaceAlgorithmProvider- Specified by:
scorein interfaceLinearAlgebraProvider<E>- Parameters:
context- the operation context (data size, hints, etc.)- Returns:
- suitability score (higher = better)
-
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
-
isCompatible
Description copied from interface:LinearAlgebraProviderChecks if this provider is compatible with the given ring.- Specified by:
isCompatiblein interfaceLinearAlgebraProvider<E>
-
shutdown
public void shutdown()Description copied from interface:BackendCalled when the application is shutting down or the backend is being replaced. Use this to release hardware resources, close file handles, or stop background threads.- Specified by:
shutdownin interfaceAlgorithmProvider- Specified by:
shutdownin interfaceBackend
-
add
-
subtract
-
multiply
-
dot
-
add
-
subtract
-
multiply
-
multiply
-
inverse
-
determinant
- Specified by:
determinantin interfaceLinearAlgebraProvider<E>
-
solve
-
transpose
-
scale
-
norm
-
lu
Description copied from interface:LinearAlgebraProviderComputes the LU decomposition of the specified matrix.- Specified by:
luin interfaceLinearAlgebraProvider<E>
-
eigen
Description copied from interface:LinearAlgebraProviderComputes the eigenvalue decomposition of the specified matrix.- Specified by:
eigenin interfaceLinearAlgebraProvider<E>
-
qr
Description copied from interface:LinearAlgebraProviderComputes the QR decomposition of the specified matrix.- Specified by:
qrin interfaceLinearAlgebraProvider<E>
-
svd
Description copied from interface:LinearAlgebraProviderComputes the Singular Value Decomposition (SVD) of the specified matrix.- Specified by:
svdin interfaceLinearAlgebraProvider<E>
-
cholesky
Description copied from interface:LinearAlgebraProviderComputes the Cholesky decomposition of the specified matrix.- Specified by:
choleskyin interfaceLinearAlgebraProvider<E>
-
trace
-
exp
Description copied from interface:LinearAlgebraProviderComputes the matrix exponential e^A.- Specified by:
expin interfaceLinearAlgebraProvider<E>
-
log
-
sin
-
cos
-
tan
-
asin
-
acos
-
atan
-
sinh
-
cosh
-
tanh
-
asinh
-
acosh
-
atanh
-
sqrt
-
cbrt
-
log10
-
pow
-
normalize
Description copied from interface:LinearAlgebraProviderReturns the normalized vector (unit vector).- Specified by:
normalizein interfaceLinearAlgebraProvider<E>
-
cross
Description copied from interface:LinearAlgebraProviderReturns the cross product of two 3D vectors.- Specified by:
crossin interfaceLinearAlgebraProvider<E>
-
projection
Description copied from interface:LinearAlgebraProviderReturns the projection of vector a onto vector b.- Specified by:
projectionin 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)
-
angle
Description copied from interface:LinearAlgebraProviderReturns the angle between two vectors in radians.- Specified by:
anglein interfaceLinearAlgebraProvider<E>
-