You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new `oqupy.backends.numerical_backend.py` module handles the
15
16
[breaking changes in JAX NumPy](https://jax.readthedocs.io/en/latest/notebooks/Common_Gotchas_in_JAX.html),
16
17
while the rest of the modules utilizes `numpy` and `scipy.linalg` instances from there
17
18
without explicitly importing JAX-based libraries.
18
19
19
20
### Enabling Experimental Features
20
21
21
-
To enable experimental features in the , use
22
+
To enable experimental features switch to the `dev/jax` branch and use
22
23
```python
23
-
from oqupy.backends importenable_experimental_features
24
-
enable_experimental_features()
24
+
from oqupy.backends importenable_gpu_features
25
+
enable_gpu_features()
25
26
```
26
27
27
-
### Contributing to Experimental Feautres
28
+
### Contributing Guidelines
28
29
29
-
If you wish to contribute to these "experimental" features,
30
-
an optional set of guidelines can be followed to reduce the maintenance overhead.
31
-
These are, to:
30
+
To contribute features compatible with the JAX backend,
31
+
please adhere to the following set of guidelines:
32
32
33
33
* avoid wildcard imports of NumPy and SciPy.
34
-
* use `from oqupy.backends.numerical_backend import np` instead of `import numpy as np` and use the alias `default_np`for vanilla NumPy.
34
+
* use `from oqupy.backends.numerical_backend import np` instead of `import numpy as np` and use the alias `default_np`in cases vanilla NumPy is explicitly required.
35
35
* use `from oqupy.backends.numerical_backend import la` instead of `import scipy.linalg as la`, except that for non-symmetric eigen-decomposition, `scipy.linalg.eig` should be used.
36
36
* use one of `np.dtype_complex` (`np.dtype_float`) or `oqupy.config.NumPyDtypeComplex` (`oqupy.config.NumPyDtypeFloat`) instead of `np.complex_` (`np.float_`).
37
37
* convert lists or tuples to arrays when passing them as arguments inside functions.
38
38
* use `array = np.update(array, indices, values)` instead of `array[indices] = values`.
39
39
* use `np.get_random_floats(seed, shape)` instead of `np.random.default_rng(seed).random(shape)`.
40
40
* declare signatures for `np.vectorize` explicitly.
41
-
* avoid in-place updates of`shape` attribute.
41
+
* avoid directly changing the`shape` attribute of an array (use `.reshape` instead)
0 commit comments