nulapack 0.1.0__cp312-cp312-win_amd64.whl → 0.2.0__cp312-cp312-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.
Binary file
Binary file
nulapack/__init__.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from importlib.metadata import PackageNotFoundError, version
2
2
 
3
3
  from .cholesky import cholesky
4
+ from .crout import crout
4
5
  from .doolittle import doolittle
5
6
  from .gauss_seidel import gauss_seidel
6
7
  from .jacobi import jacobi
@@ -13,4 +14,4 @@ except PackageNotFoundError:
13
14
  # package is not installed
14
15
  pass
15
16
 
16
- __all__ = ["__version__", "cholesky", "doolittle", "gauss_seidel", "jacobi", "thomas"]
17
+ __all__ = ["__version__", "cholesky", "crout", "doolittle", "gauss_seidel", "jacobi", "thomas"]
nulapack/crout.py ADDED
@@ -0,0 +1,44 @@
1
+ import _nulapack
2
+ import numpy as np
3
+
4
+
5
+ def crout(a: np.ndarray):
6
+ """
7
+ Compute the LU Crout decomposition of a general matrix A.
8
+
9
+ Parameters
10
+ ----------
11
+ a : ndarray
12
+ Coefficient matrix (n x n) stored as a full matrix.
13
+
14
+ Returns
15
+ -------
16
+ L : ndarray
17
+ Lower triangular matrix from the factorization.
18
+ U : ndarray
19
+ Upper triangular matrix from the factorization (with ones on diagonal).
20
+ info : int
21
+ 0 if success, <0 if a zero diagonal in L was detected.
22
+ """
23
+ a = np.ascontiguousarray(a)
24
+ n = a.shape[0]
25
+
26
+ a_flat = a.ravel(order="C")
27
+ l_flat = np.zeros_like(a_flat)
28
+ u_flat = np.zeros_like(a_flat)
29
+ info = np.zeros(1, dtype=np.int32)
30
+
31
+ if np.issubdtype(a.dtype, np.floating):
32
+ if a.dtype == np.float32:
33
+ _nulapack.sgectrf(n, a_flat, l_flat, u_flat, info)
34
+ else: # float64
35
+ _nulapack.dgectrf(n, a_flat, l_flat, u_flat, info)
36
+ elif np.issubdtype(a.dtype, np.complexfloating):
37
+ if a.dtype == np.complex64:
38
+ _nulapack.cgectrf(n, a_flat, l_flat, u_flat, info)
39
+ else: # complex128
40
+ _nulapack.zgectrf(n, a_flat, l_flat, u_flat, info)
41
+ else:
42
+ raise TypeError(f"Unsupported array dtype: {a.dtype}")
43
+
44
+ return l_flat.reshape(n, n, order="C"), u_flat.reshape(n, n, order="C"), int(info[0])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nulapack
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: NUmerical Linear Algebra PACKage
5
5
  Keywords: numerical,linear,algebra
6
6
  Author-Email: Saud Zahir <m.saud.zahir@gmail.com>
@@ -0,0 +1,13 @@
1
+ nulapack-0.2.0.dist-info/METADATA,sha256=DQjLWgONIz7g2ey4AN6FNQ0NC8K1fJBzueSQwaFAJ9U,45248
2
+ nulapack-0.2.0.dist-info/WHEEL,sha256=50PeAbplA6PkI0hYOYoeacB9US1R6EguyfOnsccH0WU,85
3
+ nulapack-0.2.0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
4
+ _nulapack.cp312-win_amd64.pyd,sha256=NSXU-lFo0gHPrlcgt1NhxxqqWX4mu8Fe7y9-ezaC-Gk,188166
5
+ _nulapack.cp312-win_amd64.dll.a,sha256=4extQMPR95OK25Z1J7lDOs7PavUkMbMWkftHz-5q0Ak,1752
6
+ nulapack/cholesky.py,sha256=q22LfUITIW4neCoND2EVdNEKPcf5zu12XK3mLYXjZS8,1397
7
+ nulapack/crout.py,sha256=xqLzhYx_vImxvHlIoZJWS9QUdY4-js_3TqtIEXTEqcM,1350
8
+ nulapack/doolittle.py,sha256=xGPG2UZ-OYC-ppbBElQBFr1Ir5lbVah9Jsg1Zi-7ikU,1334
9
+ nulapack/gauss_seidel.py,sha256=kz97lJm7dl_kxg5MXYGmMdtDgkR45sk2QduEVmG-N0o,1419
10
+ nulapack/jacobi.py,sha256=Cdy4Q8ZZMZHFSDhYdb-QBBdqbrerRVk7WZG6kEaDIl8,1403
11
+ nulapack/thomas.py,sha256=RHi1a5ezy7McoJSJZUEPb3y9TY2uAlu2JiJW3D-TfjY,1174
12
+ nulapack/__init__.py,sha256=q29f7X9G_onZDSRatW3iFInQtN2iA1egHl_ZdguvWzY,455
13
+ nulapack-0.2.0.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- nulapack-0.1.0.dist-info/METADATA,sha256=bVRCi7e8mpN7gE2XmqCPR4HvkSAyJjBdQtR258959BA,45248
2
- nulapack-0.1.0.dist-info/WHEEL,sha256=50PeAbplA6PkI0hYOYoeacB9US1R6EguyfOnsccH0WU,85
3
- nulapack-0.1.0.dist-info/LICENSE,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
4
- _nulapack.cp312-win_amd64.pyd,sha256=c4aeWFhiLM8zuhGlOOlCCx3IKEjlJbpz5AjEYXKcPZo,170410
5
- _nulapack.cp312-win_amd64.dll.a,sha256=tNJcPfqGyAdLLQPl2cR8zY5Ju4yNrfCksTTkOfMwZ30,1752
6
- nulapack/cholesky.py,sha256=q22LfUITIW4neCoND2EVdNEKPcf5zu12XK3mLYXjZS8,1397
7
- nulapack/doolittle.py,sha256=xGPG2UZ-OYC-ppbBElQBFr1Ir5lbVah9Jsg1Zi-7ikU,1334
8
- nulapack/gauss_seidel.py,sha256=kz97lJm7dl_kxg5MXYGmMdtDgkR45sk2QduEVmG-N0o,1419
9
- nulapack/jacobi.py,sha256=Cdy4Q8ZZMZHFSDhYdb-QBBdqbrerRVk7WZG6kEaDIl8,1403
10
- nulapack/thomas.py,sha256=RHi1a5ezy7McoJSJZUEPb3y9TY2uAlu2JiJW3D-TfjY,1174
11
- nulapack/__init__.py,sha256=VHZWNkFUoLNkxzMMTI2GEAE2XDGoQqiBAeIa_pWg8GQ,421
12
- nulapack-0.1.0.dist-info/RECORD,,