hyperfold 0.1.1__cp313-cp313-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hyperfold might be problematic. Click here for more details.
- hyperfold/__init__.py +153 -0
- hyperfold/__init__.pyi +405 -0
- hyperfold/_core.py +944 -0
- hyperfold/_cpu_features.py +21 -0
- hyperfold/_dtypes.py +68 -0
- hyperfold/_extensions.py +1620 -0
- hyperfold/_loader.py +45 -0
- hyperfold/_native.cp313-win_amd64.pyd +0 -0
- hyperfold/_native.pyi +110 -0
- hyperfold/_numeric.py +42 -0
- hyperfold/_operations.py +681 -0
- hyperfold/_solvers.py +362 -0
- hyperfold/_variant.py +21 -0
- hyperfold/cuda.py +13 -0
- hyperfold/cuda.pyi +2 -0
- hyperfold/include/hyperfold/plugin/abi.h +262 -0
- hyperfold/include/hyperfold/plugin/sdk.h +61 -0
- hyperfold/py.typed +1 -0
- hyperfold-0.1.1.dist-info/DELVEWHEEL +2 -0
- hyperfold-0.1.1.dist-info/METADATA +55 -0
- hyperfold-0.1.1.dist-info/RECORD +25 -0
- hyperfold-0.1.1.dist-info/WHEEL +5 -0
- hyperfold-0.1.1.dist-info/licenses/LICENSE.txt +147 -0
- hyperfold-0.1.1.dist-info/licenses/THIRD_PARTY_NOTICES.txt +59 -0
- hyperfold.libs/msvcp140-f22b3317cfb3fad7db3a18f8f234f32b.dll +0 -0
hyperfold/__init__.py
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""NumPy-first Python API for Hyperfold HPC."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# start delvewheel patch
|
|
5
|
+
def _delvewheel_patch_1_13_0():
|
|
6
|
+
import os
|
|
7
|
+
if os.path.isdir(libs_dir := os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'hyperfold.libs'))):
|
|
8
|
+
os.add_dll_directory(libs_dir)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
_delvewheel_patch_1_13_0()
|
|
12
|
+
del _delvewheel_patch_1_13_0
|
|
13
|
+
# end delvewheel patch
|
|
14
|
+
|
|
15
|
+
from ._cpu_features import require_wheel_baseline as _require_wheel_baseline
|
|
16
|
+
from ._loader import prepare_cuda_runtime as _prepare_cuda_runtime
|
|
17
|
+
from ._variant import require_single_distribution as _require_single_distribution
|
|
18
|
+
|
|
19
|
+
_installed_distribution = _require_single_distribution()
|
|
20
|
+
_require_wheel_baseline()
|
|
21
|
+
_prepare_cuda_runtime(_installed_distribution == "hyperfold-cuda")
|
|
22
|
+
del _prepare_cuda_runtime, _require_single_distribution, _require_wheel_baseline
|
|
23
|
+
|
|
24
|
+
try:
|
|
25
|
+
from . import _native as _native_probe
|
|
26
|
+
except ImportError as error:
|
|
27
|
+
detail = str(error).lower()
|
|
28
|
+
if any(name in detail for name in ("libcuda", "libcudart", "libcublas", "libcusolver", "libcusparse", "libnvjitlink")):
|
|
29
|
+
raise ImportError(
|
|
30
|
+
"Hyperfold's CUDA extension could not load its NVIDIA runtime libraries. "
|
|
31
|
+
"Reinstall hyperfold-cuda in a clean environment and ensure a compatible NVIDIA driver is available."
|
|
32
|
+
) from error
|
|
33
|
+
raise
|
|
34
|
+
|
|
35
|
+
from ._dtypes import complex32, pack_complex32, unpack_complex32
|
|
36
|
+
from . import cuda
|
|
37
|
+
from ._core import BackendError, Context, available_backends, build_info
|
|
38
|
+
from ._extensions import (
|
|
39
|
+
AlgorithmParameter,
|
|
40
|
+
BackendKind,
|
|
41
|
+
BackendOperandSpec,
|
|
42
|
+
ComplexLayout,
|
|
43
|
+
ComplexityDescription,
|
|
44
|
+
ContextBuilder,
|
|
45
|
+
DataLocation,
|
|
46
|
+
EigenOperand,
|
|
47
|
+
ExtensionKind,
|
|
48
|
+
ExtensionProvenance,
|
|
49
|
+
ExtensionRegistrar,
|
|
50
|
+
ImplementationNumerics,
|
|
51
|
+
ImplementationOperandDescription,
|
|
52
|
+
Invocation,
|
|
53
|
+
KernelSpec,
|
|
54
|
+
LUOperand,
|
|
55
|
+
MatrixLayout,
|
|
56
|
+
OperandAccess,
|
|
57
|
+
OperandKind,
|
|
58
|
+
OperandRole,
|
|
59
|
+
OperandShape,
|
|
60
|
+
OperandSpec,
|
|
61
|
+
NumericalRequirement,
|
|
62
|
+
NumericalRequirementKind,
|
|
63
|
+
OperationDescription,
|
|
64
|
+
OperationId,
|
|
65
|
+
OperationImplementation,
|
|
66
|
+
OperationNumerics,
|
|
67
|
+
OperationOperandDescription,
|
|
68
|
+
OperationSpec,
|
|
69
|
+
PrecisionDescription,
|
|
70
|
+
PrecisionMode,
|
|
71
|
+
ReductionOrder,
|
|
72
|
+
RequirementEnforcement,
|
|
73
|
+
RequirementPurpose,
|
|
74
|
+
ShapeConstraint,
|
|
75
|
+
ShapeRelation,
|
|
76
|
+
Stability,
|
|
77
|
+
StorageFormat,
|
|
78
|
+
SymbolicExpression,
|
|
79
|
+
SymbolicOperator,
|
|
80
|
+
)
|
|
81
|
+
from ._operations import (
|
|
82
|
+
add,
|
|
83
|
+
adjoint,
|
|
84
|
+
conjugate,
|
|
85
|
+
divide,
|
|
86
|
+
eye,
|
|
87
|
+
inner,
|
|
88
|
+
is_unitary,
|
|
89
|
+
kron,
|
|
90
|
+
matmul,
|
|
91
|
+
matrix_power,
|
|
92
|
+
matvec,
|
|
93
|
+
multiply,
|
|
94
|
+
norm,
|
|
95
|
+
outer,
|
|
96
|
+
partial_trace,
|
|
97
|
+
scale,
|
|
98
|
+
sqrt,
|
|
99
|
+
subtract,
|
|
100
|
+
sum,
|
|
101
|
+
trace,
|
|
102
|
+
transpose,
|
|
103
|
+
vector_equal,
|
|
104
|
+
)
|
|
105
|
+
from ._solvers import (
|
|
106
|
+
LUFactor, eig, eigh, eigvalsh, logdet_positive_definite, lu_factor,
|
|
107
|
+
principal_eigenvector, slogdet, solve,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
__version__ = str(_native_probe.build_info()["version"])
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_include() -> str:
|
|
114
|
+
"""Return the include root containing Hyperfold's native plug-in SDK."""
|
|
115
|
+
from pathlib import Path
|
|
116
|
+
|
|
117
|
+
packaged = Path(__file__).resolve().parent / "include"
|
|
118
|
+
if packaged.is_dir():
|
|
119
|
+
return str(packaged)
|
|
120
|
+
return str(Path(__file__).resolve().parents[2] / "include")
|
|
121
|
+
|
|
122
|
+
__all__ = [
|
|
123
|
+
"complex32",
|
|
124
|
+
"pack_complex32",
|
|
125
|
+
"unpack_complex32",
|
|
126
|
+
"BackendError", "Context", "add", "subtract", "multiply", "sqrt",
|
|
127
|
+
"conjugate", "sum", "scale", "divide", "transpose", "adjoint",
|
|
128
|
+
"matmul", "matvec", "kron", "outer", "trace", "inner", "norm",
|
|
129
|
+
"vector_equal", "eye", "LUFactor", "lu_factor", "solve", "eig",
|
|
130
|
+
"eigh", "eigvalsh", "slogdet", "logdet_positive_definite",
|
|
131
|
+
"principal_eigenvector", "matrix_power", "partial_trace", "is_unitary",
|
|
132
|
+
"available_backends", "build_info", "get_include", "cuda",
|
|
133
|
+
"ContextBuilder", "ExtensionRegistrar", "OperationId", "OperationSpec", "OperandSpec",
|
|
134
|
+
"BackendOperandSpec", "KernelSpec", "Invocation", "OperandAccess",
|
|
135
|
+
"OperandKind", "OperandRole", "BackendKind",
|
|
136
|
+
"MatrixLayout", "ExtensionKind", "DataLocation", "StorageFormat",
|
|
137
|
+
"ComplexLayout", "ExtensionProvenance", "OperationOperandDescription",
|
|
138
|
+
"ImplementationOperandDescription", "OperationImplementation",
|
|
139
|
+
"OperationDescription", "SymbolicOperator", "SymbolicExpression",
|
|
140
|
+
"ShapeRelation", "OperandShape", "ShapeConstraint",
|
|
141
|
+
"NumericalRequirementKind", "RequirementPurpose",
|
|
142
|
+
"RequirementEnforcement", "NumericalRequirement", "OperationNumerics",
|
|
143
|
+
"Stability", "PrecisionMode", "ReductionOrder",
|
|
144
|
+
"ComplexityDescription", "PrecisionDescription", "AlgorithmParameter",
|
|
145
|
+
"ImplementationNumerics",
|
|
146
|
+
"LUOperand", "EigenOperand",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
for _public_name in __all__:
|
|
150
|
+
_public_object = globals()[_public_name]
|
|
151
|
+
if callable(_public_object):
|
|
152
|
+
_public_object.__module__ = __name__
|
|
153
|
+
del _public_name, _public_object
|
hyperfold/__init__.pyi
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
from collections.abc import Callable, Mapping, Sequence
|
|
2
|
+
from enum import Enum, StrEnum
|
|
3
|
+
from os import PathLike
|
|
4
|
+
from typing import Any, Literal
|
|
5
|
+
from . import cuda
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
complex32: np.dtype[Any]
|
|
9
|
+
def pack_complex32(values: Any) -> Any: ...
|
|
10
|
+
def unpack_complex32(values: Any) -> Any: ...
|
|
11
|
+
|
|
12
|
+
class BackendError(RuntimeError):
|
|
13
|
+
operation: str
|
|
14
|
+
reason: str
|
|
15
|
+
device: int | None
|
|
16
|
+
native_status: int | None
|
|
17
|
+
def __init__(self, message: str, *, operation: str = ..., reason: str = ..., device: int | None = ..., native_status: int | None = ...) -> None: ...
|
|
18
|
+
|
|
19
|
+
class Context:
|
|
20
|
+
cpu_threads: int
|
|
21
|
+
parallel_work_threshold: int
|
|
22
|
+
numa_policy: str
|
|
23
|
+
pinning_policy: str
|
|
24
|
+
cuda_devices: int | Sequence[int] | None
|
|
25
|
+
stream_pool_size: int
|
|
26
|
+
external_stream: int | None
|
|
27
|
+
scheduling: str
|
|
28
|
+
cross_device: str
|
|
29
|
+
def __init__(self, *, cpu_threads: int = ..., parallel_work_threshold: int = ..., numa_policy: str = ..., pinning_policy: str = ..., cuda_devices: int | Sequence[int] | None = ..., stream_pool_size: int = ..., external_stream: int | None = ..., scheduling: str = ..., cross_device: str = ...) -> None: ...
|
|
30
|
+
def operations(self) -> tuple[OperationId, ...]: ...
|
|
31
|
+
def describe(self, operation: str | OperationId) -> OperationDescription: ...
|
|
32
|
+
def execute(self, operation: str | OperationId, bindings: Mapping[OperandRole, Any], *, compute_dtypes: Mapping[OperandRole, Any] | None = ...) -> Any: ...
|
|
33
|
+
|
|
34
|
+
class OperandAccess(StrEnum):
|
|
35
|
+
READ: OperandAccess
|
|
36
|
+
WRITE: OperandAccess
|
|
37
|
+
READ_WRITE: OperandAccess
|
|
38
|
+
|
|
39
|
+
class OperandRole(Enum):
|
|
40
|
+
INPUT_0: OperandRole
|
|
41
|
+
INPUT_1: OperandRole
|
|
42
|
+
INPUT_2: OperandRole
|
|
43
|
+
OUTPUT: OperandRole
|
|
44
|
+
OUTPUT_0: OperandRole
|
|
45
|
+
OUTPUT_1: OperandRole
|
|
46
|
+
OUTPUT_2: OperandRole
|
|
47
|
+
value: int
|
|
48
|
+
input_index: int
|
|
49
|
+
output_index: int
|
|
50
|
+
@classmethod
|
|
51
|
+
def input(cls, index: int) -> OperandRole: ...
|
|
52
|
+
@classmethod
|
|
53
|
+
def output(cls, index: int) -> OperandRole: ...
|
|
54
|
+
|
|
55
|
+
class OperandKind(StrEnum):
|
|
56
|
+
SCALAR: OperandKind
|
|
57
|
+
VECTOR: OperandKind
|
|
58
|
+
MATRIX: OperandKind
|
|
59
|
+
LU: OperandKind
|
|
60
|
+
EIGEN: OperandKind
|
|
61
|
+
|
|
62
|
+
class BackendKind(StrEnum):
|
|
63
|
+
CPU_SCALAR: BackendKind
|
|
64
|
+
CPU_SIMD: BackendKind
|
|
65
|
+
CUDA: BackendKind
|
|
66
|
+
|
|
67
|
+
class MatrixLayout(StrEnum):
|
|
68
|
+
ROW_MAJOR: MatrixLayout
|
|
69
|
+
COLUMN_MAJOR: MatrixLayout
|
|
70
|
+
|
|
71
|
+
class ExtensionKind(StrEnum):
|
|
72
|
+
BUILTIN: ExtensionKind
|
|
73
|
+
PYTHON: ExtensionKind
|
|
74
|
+
NATIVE: ExtensionKind
|
|
75
|
+
|
|
76
|
+
class DataLocation(StrEnum):
|
|
77
|
+
PAGEABLE_HOST: DataLocation
|
|
78
|
+
PINNED_HOST: DataLocation
|
|
79
|
+
CUDA_DEVICE: DataLocation
|
|
80
|
+
|
|
81
|
+
class StorageFormat(StrEnum):
|
|
82
|
+
DENSE: StorageFormat
|
|
83
|
+
SPARSE: StorageFormat
|
|
84
|
+
DIAGONAL: StorageFormat
|
|
85
|
+
CSR: StorageFormat
|
|
86
|
+
CSC: StorageFormat
|
|
87
|
+
COO: StorageFormat
|
|
88
|
+
|
|
89
|
+
class ComplexLayout(StrEnum):
|
|
90
|
+
NONE: ComplexLayout
|
|
91
|
+
SPLIT: ComplexLayout
|
|
92
|
+
INTERLEAVED: ComplexLayout
|
|
93
|
+
|
|
94
|
+
class SymbolicOperator(StrEnum):
|
|
95
|
+
UNKNOWN: SymbolicOperator
|
|
96
|
+
CONSTANT: SymbolicOperator
|
|
97
|
+
SYMBOL: SymbolicOperator
|
|
98
|
+
OPERAND_DIMENSION: SymbolicOperator
|
|
99
|
+
OPERAND_VALUE: SymbolicOperator
|
|
100
|
+
ADD: SymbolicOperator
|
|
101
|
+
MULTIPLY: SymbolicOperator
|
|
102
|
+
POWER: SymbolicOperator
|
|
103
|
+
DIVIDE: SymbolicOperator
|
|
104
|
+
MINIMUM: SymbolicOperator
|
|
105
|
+
MAXIMUM: SymbolicOperator
|
|
106
|
+
LOG2: SymbolicOperator
|
|
107
|
+
|
|
108
|
+
class ShapeRelation(StrEnum):
|
|
109
|
+
EQUAL: ShapeRelation
|
|
110
|
+
LESS_EQUAL: ShapeRelation
|
|
111
|
+
GREATER_EQUAL: ShapeRelation
|
|
112
|
+
DIVISIBLE_BY: ShapeRelation
|
|
113
|
+
|
|
114
|
+
class NumericalRequirementKind(StrEnum):
|
|
115
|
+
FINITE: NumericalRequirementKind
|
|
116
|
+
NONZERO: NumericalRequirementKind
|
|
117
|
+
NONNEGATIVE: NumericalRequirementKind
|
|
118
|
+
POSITIVE: NumericalRequirementKind
|
|
119
|
+
NONSINGULAR: NumericalRequirementKind
|
|
120
|
+
HERMITIAN: NumericalRequirementKind
|
|
121
|
+
NORMAL: NumericalRequirementKind
|
|
122
|
+
POSITIVE_DEFINITE: NumericalRequirementKind
|
|
123
|
+
UNIQUE_DOMINANT_EIGENVALUE: NumericalRequirementKind
|
|
124
|
+
|
|
125
|
+
class RequirementPurpose(StrEnum):
|
|
126
|
+
EXECUTION: RequirementPurpose
|
|
127
|
+
DEFINED_RESULT: RequirementPurpose
|
|
128
|
+
UNIQUE_RESULT: RequirementPurpose
|
|
129
|
+
ACCURACY: RequirementPurpose
|
|
130
|
+
|
|
131
|
+
class RequirementEnforcement(StrEnum):
|
|
132
|
+
CHECKED: RequirementEnforcement
|
|
133
|
+
GUARANTEED_BY_OPERAND: RequirementEnforcement
|
|
134
|
+
CALLER_RESPONSIBILITY: RequirementEnforcement
|
|
135
|
+
|
|
136
|
+
class Stability(StrEnum):
|
|
137
|
+
EXACT: Stability
|
|
138
|
+
BACKWARD_STABLE: Stability
|
|
139
|
+
CONDITIONALLY_STABLE: Stability
|
|
140
|
+
NOT_GUARANTEED: Stability
|
|
141
|
+
UNKNOWN: Stability
|
|
142
|
+
|
|
143
|
+
class PrecisionMode(StrEnum):
|
|
144
|
+
EXACT: PrecisionMode
|
|
145
|
+
NATIVE: PrecisionMode
|
|
146
|
+
WIDENED: PrecisionMode
|
|
147
|
+
MIXED: PrecisionMode
|
|
148
|
+
UNKNOWN: PrecisionMode
|
|
149
|
+
|
|
150
|
+
class ReductionOrder(StrEnum):
|
|
151
|
+
NOT_APPLICABLE: ReductionOrder
|
|
152
|
+
SEQUENTIAL: ReductionOrder
|
|
153
|
+
PAIRWISE: ReductionOrder
|
|
154
|
+
PARALLEL_TREE: ReductionOrder
|
|
155
|
+
LIBRARY_DEFINED: ReductionOrder
|
|
156
|
+
UNKNOWN: ReductionOrder
|
|
157
|
+
|
|
158
|
+
class SymbolicExpression:
|
|
159
|
+
operator: SymbolicOperator
|
|
160
|
+
operands: tuple[SymbolicExpression, ...]
|
|
161
|
+
integer: int | None
|
|
162
|
+
name: str | None
|
|
163
|
+
role: OperandRole | None
|
|
164
|
+
axis: int | None
|
|
165
|
+
canonical: str
|
|
166
|
+
def __init__(self, operator: SymbolicOperator, operands: tuple[SymbolicExpression, ...] = ..., integer: int | None = ..., name: str | None = ..., role: OperandRole | None = ..., axis: int | None = ...) -> None: ...
|
|
167
|
+
@classmethod
|
|
168
|
+
def unknown(cls) -> SymbolicExpression: ...
|
|
169
|
+
@classmethod
|
|
170
|
+
def constant(cls, value: int) -> SymbolicExpression: ...
|
|
171
|
+
@classmethod
|
|
172
|
+
def symbol(cls, name: str) -> SymbolicExpression: ...
|
|
173
|
+
@classmethod
|
|
174
|
+
def dimension(cls, role: OperandRole, axis: int) -> SymbolicExpression: ...
|
|
175
|
+
@classmethod
|
|
176
|
+
def scalar_value(cls, role: OperandRole) -> SymbolicExpression: ...
|
|
177
|
+
@classmethod
|
|
178
|
+
def operation(cls, operator: SymbolicOperator, *operands: SymbolicExpression) -> SymbolicExpression: ...
|
|
179
|
+
|
|
180
|
+
class OperandShape:
|
|
181
|
+
role: OperandRole
|
|
182
|
+
rank: int
|
|
183
|
+
def __init__(self, role: OperandRole, rank: int) -> None: ...
|
|
184
|
+
|
|
185
|
+
class ShapeConstraint:
|
|
186
|
+
left: SymbolicExpression
|
|
187
|
+
relation: ShapeRelation
|
|
188
|
+
right: SymbolicExpression
|
|
189
|
+
def __init__(self, left: SymbolicExpression, relation: ShapeRelation, right: SymbolicExpression) -> None: ...
|
|
190
|
+
|
|
191
|
+
class NumericalRequirement:
|
|
192
|
+
kind: NumericalRequirementKind
|
|
193
|
+
roles: tuple[OperandRole, ...]
|
|
194
|
+
purpose: RequirementPurpose
|
|
195
|
+
enforcement: RequirementEnforcement
|
|
196
|
+
note: str
|
|
197
|
+
def __init__(self, kind: NumericalRequirementKind, roles: tuple[OperandRole, ...], purpose: RequirementPurpose, enforcement: RequirementEnforcement, note: str) -> None: ...
|
|
198
|
+
|
|
199
|
+
class OperationNumerics:
|
|
200
|
+
shapes: tuple[OperandShape, ...]
|
|
201
|
+
constraints: tuple[ShapeConstraint, ...]
|
|
202
|
+
requirements: tuple[NumericalRequirement, ...]
|
|
203
|
+
notes: tuple[str, ...]
|
|
204
|
+
def __init__(self, shapes: tuple[OperandShape, ...], constraints: tuple[ShapeConstraint, ...] = ..., requirements: tuple[NumericalRequirement, ...] = ..., notes: tuple[str, ...] = ...) -> None: ...
|
|
205
|
+
|
|
206
|
+
class ComplexityDescription:
|
|
207
|
+
work: SymbolicExpression
|
|
208
|
+
auxiliary_space: SymbolicExpression
|
|
209
|
+
notes: tuple[str, ...]
|
|
210
|
+
def __init__(self, work: SymbolicExpression, auxiliary_space: SymbolicExpression, notes: tuple[str, ...] = ...) -> None: ...
|
|
211
|
+
|
|
212
|
+
class PrecisionDescription:
|
|
213
|
+
mode: PrecisionMode
|
|
214
|
+
accumulation_dtype: str | None
|
|
215
|
+
reduction_order: ReductionOrder
|
|
216
|
+
notes: tuple[str, ...]
|
|
217
|
+
def __init__(self, mode: PrecisionMode, accumulation_dtype: str | None, reduction_order: ReductionOrder, notes: tuple[str, ...] = ...) -> None: ...
|
|
218
|
+
|
|
219
|
+
class AlgorithmParameter:
|
|
220
|
+
name: str
|
|
221
|
+
value: int | float | str
|
|
222
|
+
description: str
|
|
223
|
+
def __init__(self, name: str, value: int | float | str, description: str) -> None: ...
|
|
224
|
+
|
|
225
|
+
class ImplementationNumerics:
|
|
226
|
+
algorithm: str
|
|
227
|
+
stability: Stability
|
|
228
|
+
complexity: ComplexityDescription
|
|
229
|
+
precision: PrecisionDescription
|
|
230
|
+
parameters: tuple[AlgorithmParameter, ...]
|
|
231
|
+
notes: tuple[str, ...]
|
|
232
|
+
def __init__(self, algorithm: str, stability: Stability, complexity: ComplexityDescription, precision: PrecisionDescription, parameters: tuple[AlgorithmParameter, ...] = ..., notes: tuple[str, ...] = ...) -> None: ...
|
|
233
|
+
|
|
234
|
+
class OperationId:
|
|
235
|
+
name: str
|
|
236
|
+
major: int
|
|
237
|
+
canonical: str
|
|
238
|
+
def __init__(self, name: str, major: int = ...) -> None: ...
|
|
239
|
+
@classmethod
|
|
240
|
+
def parse(cls, value: str | OperationId) -> OperationId: ...
|
|
241
|
+
|
|
242
|
+
class ExtensionProvenance:
|
|
243
|
+
kind: ExtensionKind
|
|
244
|
+
id: str
|
|
245
|
+
version: str | None
|
|
246
|
+
def __init__(self, kind: ExtensionKind, id: str, version: str | None = ...) -> None: ...
|
|
247
|
+
|
|
248
|
+
class OperationOperandDescription:
|
|
249
|
+
role: OperandRole
|
|
250
|
+
access: OperandAccess
|
|
251
|
+
kind: OperandKind | None
|
|
252
|
+
def __init__(self, role: OperandRole, access: OperandAccess, kind: OperandKind | None) -> None: ...
|
|
253
|
+
|
|
254
|
+
class ImplementationOperandDescription:
|
|
255
|
+
role: OperandRole
|
|
256
|
+
access: OperandAccess
|
|
257
|
+
kind: OperandKind
|
|
258
|
+
dtype: str
|
|
259
|
+
location: DataLocation
|
|
260
|
+
storage_format: StorageFormat | None
|
|
261
|
+
complex_layout: ComplexLayout
|
|
262
|
+
matrix_layout: MatrixLayout | None
|
|
263
|
+
compute_dtype: str
|
|
264
|
+
def __init__(self, role: OperandRole, access: OperandAccess, kind: OperandKind, dtype: str, location: DataLocation, storage_format: StorageFormat | None, complex_layout: ComplexLayout, matrix_layout: MatrixLayout | None, compute_dtype: str | None = ...) -> None: ...
|
|
265
|
+
|
|
266
|
+
class OperationImplementation:
|
|
267
|
+
backend: BackendKind
|
|
268
|
+
operands: tuple[ImplementationOperandDescription, ...]
|
|
269
|
+
provenance: ExtensionProvenance
|
|
270
|
+
numerics: ImplementationNumerics | None
|
|
271
|
+
def __init__(self, backend: BackendKind, operands: tuple[ImplementationOperandDescription, ...], provenance: ExtensionProvenance, numerics: ImplementationNumerics | None = ...) -> None: ...
|
|
272
|
+
|
|
273
|
+
class OperationDescription:
|
|
274
|
+
id: OperationId
|
|
275
|
+
operands: tuple[OperationOperandDescription, ...]
|
|
276
|
+
provenance: ExtensionProvenance
|
|
277
|
+
implementations: tuple[OperationImplementation, ...]
|
|
278
|
+
numerics: OperationNumerics | None
|
|
279
|
+
def __init__(self, id: OperationId, operands: tuple[OperationOperandDescription, ...], provenance: ExtensionProvenance, implementations: tuple[OperationImplementation, ...], numerics: OperationNumerics | None = ...) -> None: ...
|
|
280
|
+
|
|
281
|
+
class OperandSpec:
|
|
282
|
+
role: OperandRole
|
|
283
|
+
kind: OperandKind
|
|
284
|
+
access: OperandAccess
|
|
285
|
+
def __init__(self, role: OperandRole, kind: OperandKind, access: OperandAccess = ...) -> None: ...
|
|
286
|
+
|
|
287
|
+
class OperationSpec:
|
|
288
|
+
operation: OperationId
|
|
289
|
+
operands: Sequence[OperandSpec]
|
|
290
|
+
validator: Callable[[Mapping[OperandRole, Any]], None] | None
|
|
291
|
+
numerics: OperationNumerics | None
|
|
292
|
+
output: OperandSpec
|
|
293
|
+
outputs: tuple[OperandSpec, ...]
|
|
294
|
+
output_count: int
|
|
295
|
+
output_roles: tuple[OperandRole, ...]
|
|
296
|
+
def __init__(self, operation: str | OperationId, operands: Sequence[OperandSpec], validator: Callable[[Mapping[OperandRole, Any]], None] | None = ..., numerics: OperationNumerics | None = ...) -> None: ...
|
|
297
|
+
def preserves_output(self, role: OperandRole = ...) -> bool: ...
|
|
298
|
+
|
|
299
|
+
class BackendOperandSpec:
|
|
300
|
+
role: OperandRole
|
|
301
|
+
kind: OperandKind
|
|
302
|
+
access: OperandAccess
|
|
303
|
+
dtype: str
|
|
304
|
+
matrix_layout: MatrixLayout | None
|
|
305
|
+
compute_dtype: str
|
|
306
|
+
def __init__(self, role: OperandRole, kind: OperandKind, access: OperandAccess = ..., dtype: str = ..., matrix_layout: MatrixLayout | str | None = ..., compute_dtype: str | None = ...) -> None: ...
|
|
307
|
+
|
|
308
|
+
class Invocation:
|
|
309
|
+
bindings: Mapping[OperandRole, Any]
|
|
310
|
+
backend: BackendKind
|
|
311
|
+
cuda_device: int | None
|
|
312
|
+
stream: int | None
|
|
313
|
+
compute_dtypes: Mapping[OperandRole, str]
|
|
314
|
+
|
|
315
|
+
class KernelSpec:
|
|
316
|
+
operation: OperationId
|
|
317
|
+
backend: BackendKind
|
|
318
|
+
operands: Sequence[BackendOperandSpec]
|
|
319
|
+
callback: Callable[[Invocation], None]
|
|
320
|
+
numerics: ImplementationNumerics | None
|
|
321
|
+
id: OperationId
|
|
322
|
+
def __init__(self, operation: str | OperationId, backend: BackendKind, operands: Sequence[BackendOperandSpec], callback: Callable[[Invocation], None], numerics: ImplementationNumerics | None = ...) -> None: ...
|
|
323
|
+
|
|
324
|
+
class ExtensionRegistrar:
|
|
325
|
+
id: str
|
|
326
|
+
def register_operation(self, operation: OperationSpec) -> ExtensionRegistrar: ...
|
|
327
|
+
def register_kernel(self, kernel: KernelSpec) -> ExtensionRegistrar: ...
|
|
328
|
+
|
|
329
|
+
class ContextBuilder:
|
|
330
|
+
def __init__(self, **context_options: Any) -> None: ...
|
|
331
|
+
def extension(self, extension_id: str) -> ExtensionRegistrar: ...
|
|
332
|
+
def load_plugin(self, path: str | PathLike[str]) -> ContextBuilder: ...
|
|
333
|
+
def build(self) -> Context: ...
|
|
334
|
+
|
|
335
|
+
class LUOperand:
|
|
336
|
+
def __init__(self, value: int | Any, *, dtype: Any = ..., compute_dtype: Any = ...) -> None: ...
|
|
337
|
+
@property
|
|
338
|
+
def dtype(self) -> Any: ...
|
|
339
|
+
@property
|
|
340
|
+
def compute_dtype(self) -> Any: ...
|
|
341
|
+
@property
|
|
342
|
+
def size(self) -> int: ...
|
|
343
|
+
@property
|
|
344
|
+
def pivots(self) -> Any: ...
|
|
345
|
+
@property
|
|
346
|
+
def factors(self) -> Any: ...
|
|
347
|
+
@property
|
|
348
|
+
def swaps(self) -> int: ...
|
|
349
|
+
|
|
350
|
+
class EigenOperand:
|
|
351
|
+
def __init__(self, size: int, *, dtype: Any = ..., compute_dtype: Any = ...) -> None: ...
|
|
352
|
+
@property
|
|
353
|
+
def dtype(self) -> Any: ...
|
|
354
|
+
@property
|
|
355
|
+
def compute_dtype(self) -> Any: ...
|
|
356
|
+
@property
|
|
357
|
+
def size(self) -> int: ...
|
|
358
|
+
@property
|
|
359
|
+
def values(self) -> Any: ...
|
|
360
|
+
@property
|
|
361
|
+
def vectors(self) -> Any: ...
|
|
362
|
+
|
|
363
|
+
class LUFactor:
|
|
364
|
+
@property
|
|
365
|
+
def dtype(self) -> Any: ...
|
|
366
|
+
@property
|
|
367
|
+
def size(self) -> int: ...
|
|
368
|
+
def solve(self, b: Any, *, out: Any = ..., copy: bool | None = ...) -> Any: ...
|
|
369
|
+
def logdet(self) -> Any: ...
|
|
370
|
+
|
|
371
|
+
def add(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
372
|
+
def get_include() -> str: ...
|
|
373
|
+
def subtract(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
374
|
+
def multiply(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
375
|
+
def sqrt(value: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
376
|
+
def conjugate(value: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
377
|
+
def sum(value: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
378
|
+
def scale(value: Any, scalar: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
379
|
+
def divide(value: Any, scalar: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
380
|
+
def transpose(value: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
381
|
+
def adjoint(value: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
382
|
+
def matmul(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
383
|
+
def matvec(matrix: Any, vector: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
384
|
+
def kron(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
385
|
+
def outer(left: Any, right: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
386
|
+
def trace(value: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
387
|
+
def inner(left: Any, right: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
388
|
+
def norm(value: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
389
|
+
def vector_equal(left: Any, right: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
390
|
+
def eye(n: int, *, like: Any = ..., dtype: Any = ..., out: Any = ..., context: Context | None = ...) -> Any: ...
|
|
391
|
+
def lu_factor(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> LUFactor: ...
|
|
392
|
+
def solve(a: Any, b: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
393
|
+
def eig(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> tuple[Any, Any]: ...
|
|
394
|
+
def eigh(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> tuple[Any, Any]: ...
|
|
395
|
+
def eigvalsh(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
396
|
+
def slogdet(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> tuple[Any, Any]: ...
|
|
397
|
+
def logdet_positive_definite(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
398
|
+
def principal_eigenvector(a: Any, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
399
|
+
def matrix_power(a: Any, n: int, *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
400
|
+
def partial_trace(a: Any, dims: tuple[int, int], trace_out: Literal["left", "right"] = ..., *, out: Any = ..., context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
401
|
+
def is_unitary(a: Any, *, context: Context | None = ..., copy: bool | None = ...) -> Any: ...
|
|
402
|
+
def available_backends() -> tuple[str, ...]: ...
|
|
403
|
+
def build_info() -> dict[str, Any]: ...
|
|
404
|
+
|
|
405
|
+
__version__: str
|