Contains global backend pool, ensuring backends are only loaded if actually required.
get_backend()
detect the return relevant backend from the input
BackendRegistry$get_backend(tensor)
tensor
any supported tensor-like class
A singleton instance of a EinopsBackend()
object
get_backend_from_type()
Get a backend instance for a specific tensor type. If the backend is not loaded, it will be instantiated.
BackendRegistry$get_backend_from_type(tensor_class)
tensor_class
A string representing the tensor type.
An instance of the backend class for the specified tensor type.
register_backend()
Register a new backend singleton
BackendRegistry$register_backend(
tensor_type,
backend_class_thunk,
dependencies = character(0),
testing = FALSE,
aliases = character(0)
)
tensor_type
a string with the tensor type the backend supports
backend_class_thunk
a thunk()
'ed EinopsBackend subclass generator
dependencies
a character vector of required package names
testing
logical flag indicating if this is a testing-only backend
aliases
a character vector of aliases for the tensor type
this object
unregister_backend()
Unregister a backend for a specific tensor type.
BackendRegistry$unregister_backend(tensor_type)
tensor_type
a string with the tensor type
this object
add_backend_alias()
Add an alias for a backend type.
BackendRegistry$add_backend_alias(alias, tensor_type)
alias
a string with the alias name
tensor_type
a string with the canonical tensor type
this object
clear_testing_backends()
Clear all testing-only backends.
BackendRegistry$clear_testing_backends()
this object
get_supported_types()
Get a list of all registered backend types.
BackendRegistry$get_supported_types()
A character vector of backend types.
get_dependencies()
given a tensor type, return the required packages
BackendRegistry$get_dependencies(tensor_type)
tensor_type
a string with the tensor type
a character vector with required packages. Length 0 if no packages are required.
is_loadable()
Check if a tensor type is truly loadable, i.e., if it is registered and has no missing dependencies.
BackendRegistry$is_loadable(tensor_type)
tensor_type
a string with the tensor type
TRUE if the tensor type is loadable, FALSE otherwise.