No project description provided
Project description
vector-structure
Lightweight utilities for working with structured flat vectors and block matrices in NumPy.
Example usage
Consider a Newton algorithm for solving the KKT conditions, as described here:
$$\begin{pmatrix} \nabla^2 f(x) & \color{gray}{Df(x)^T} & A^T \ \color{gray}{-diag(\lambda) Df(x)} & \color{gray}{-diag(f(x))} & \color{gray}{0} \ A & \color{gray}{0} & 0 \end{pmatrix} \begin{pmatrix} x^* \ \color{gray}{\lambda^*} \ v^* \end{pmatrix} = \begin{pmatrix} \ \dots \ \end{pmatrix}$$
where the grey components are only required when inequality constraints are present.
from vector_structure import VectorStructure
structure = [("x", n)]
if ineq_constraints:
structure.append(("lambda", m))
structure.append(("mu", p))
vs = VectorStructure(structure)
M = np.zeros((vs.size, vs.size))
M[vs["x"], vs["x"]] = nabla2(f)(x)
if ineq_constraints:
M[vs["x"], vs["lambda"]] = Df(x).T
M[vs["x"], vs["mu"]] = A
...
x_lambda_mu = np.linalg.solve(M, r)
x = x_lambda_mu[vs["x"]]
if ineq_constraints:
lambda = x_lambda_mu[vs["lambda"]]
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vector_structure-2.2.0.tar.gz.
File metadata
- Download URL: vector_structure-2.2.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85fd6dfa8874a385a448e9025a8cbbad1c8b48e2e075ecb3e697b1d10825ac4c
|
|
| MD5 |
e59d0c5754b55ade6549902c74886e50
|
|
| BLAKE2b-256 |
36d860f1633da79f7f34b44d5f95f8f50a73ff1d64b1d4859df7bfaa737c09db
|
Provenance
The following attestation bundles were made for vector_structure-2.2.0.tar.gz:
Publisher:
python-publish.yml on Warggr/vector-structure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vector_structure-2.2.0.tar.gz -
Subject digest:
85fd6dfa8874a385a448e9025a8cbbad1c8b48e2e075ecb3e697b1d10825ac4c - Sigstore transparency entry: 1205753897
- Sigstore integration time:
-
Permalink:
Warggr/vector-structure@6b31aa9e054c969f9fbb5f9b0b3bde1de946e385 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/Warggr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6b31aa9e054c969f9fbb5f9b0b3bde1de946e385 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vector_structure-2.2.0-py3-none-any.whl.
File metadata
- Download URL: vector_structure-2.2.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f97494daf3cc45ce35e41b79b2db12973ed7d8a9b799fcec3086ee287d656d1a
|
|
| MD5 |
fad7ddb1e644704a53be356cae3a1f98
|
|
| BLAKE2b-256 |
f703383accaf04186ee070167346bcb9e761ce2f592caa143ae8e0ae5f69971d
|
Provenance
The following attestation bundles were made for vector_structure-2.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on Warggr/vector-structure
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vector_structure-2.2.0-py3-none-any.whl -
Subject digest:
f97494daf3cc45ce35e41b79b2db12973ed7d8a9b799fcec3086ee287d656d1a - Sigstore transparency entry: 1205753907
- Sigstore integration time:
-
Permalink:
Warggr/vector-structure@6b31aa9e054c969f9fbb5f9b0b3bde1de946e385 -
Branch / Tag:
refs/tags/v2.2.0 - Owner: https://github.com/Warggr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6b31aa9e054c969f9fbb5f9b0b3bde1de946e385 -
Trigger Event:
push
-
Statement type: