Skip to main content

Python bindings for PolySolve nonlinear optimization and linear solvers

Project description

polysolve-python

PyPI Python versions CI Build & publish License: MIT

Small Python binding for PolySolve's nonlinear and linear solver interfaces.

import numpy as np
import scipy.sparse
import polysolve


class Quadratic(polysolve.Problem):
    def value(self, x):
        y = x - np.array([-2.0, 3.0, 1.0])
        return float(y @ y)

    def gradient(self, x):
        return 2.0 * (x - np.array([-2.0, 3.0, 1.0]))

    def hessian(self, x):
        return 2.0 * scipy.sparse.eye(x.size, format="csc")


x, log = polysolve.minimize(
    Quadratic(),
    np.zeros(3),
    {
        "solver": "Newton",
        "line_search": {"method": "Backtracking"},
        "max_iterations": 100,
    },
    {"solver": "Eigen::SimplicialLDLT"},
)

print(x)
print(log)

Python subclasses must implement value(x), gradient(x), and hessian(x). Optional PolySolve callbacks such as solution_changed, stop, is_step_valid, and max_step_size can also be implemented on the subclass.

Linear solves

For a one-off linear system:

A = scipy.sparse.csc_matrix([[4.0, 1.0], [1.0, 3.0]])
b = np.array([1.0, 2.0])

x = polysolve.solve(A, b, {"solver": "Eigen::SimplicialLDLT"})

For repeated solves with the same matrix pattern:

solver = polysolve.LinearSolver({"solver": "Eigen::SimplicialLDLT"})
solver.analyze_pattern(A)
solver.factorise(A)  # factorize(A) is also available

x = solver.solve(b)
print(solver.info())

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

polyfem_polysolve-0.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

polyfem_polysolve-0.0.1-cp314-cp314-win_amd64.whl (33.8 MB view details)

Uploaded CPython 3.14Windows x86-64

polyfem_polysolve-0.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp314-cp314-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

polyfem_polysolve-0.0.1-cp313-cp313-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.13Windows x86-64

polyfem_polysolve-0.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

polyfem_polysolve-0.0.1-cp312-cp312-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.12Windows x86-64

polyfem_polysolve-0.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

polyfem_polysolve-0.0.1-cp311-cp311-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.11Windows x86-64

polyfem_polysolve-0.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

polyfem_polysolve-0.0.1-cp310-cp310-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.10Windows x86-64

polyfem_polysolve-0.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp310-cp310-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

polyfem_polysolve-0.0.1-cp39-cp39-win_amd64.whl (33.2 MB view details)

Uploaded CPython 3.9Windows x86-64

polyfem_polysolve-0.0.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (33.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

polyfem_polysolve-0.0.1-cp39-cp39-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file polyfem_polysolve-0.0.1.tar.gz.

File metadata

  • Download URL: polyfem_polysolve-0.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polyfem_polysolve-0.0.1.tar.gz
Algorithm Hash digest
SHA256 3d7df9cca2968c35f936c778dc5b08037caf01db8c7485963fe03af24fe25190
MD5 d991cbd62c56b619b93754d9cb06bdd7
BLAKE2b-256 dd2349fcb01daf9986c8936ee522db41d5bc7fd408b6b5ef379131c2d293b02e

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1.tar.gz:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 145e5c0e9502d545c13005c6fd07d904073de6baf54682a9ad8f895d463044b3
MD5 ca892b74a98ab8615d17676b61be4779
BLAKE2b-256 de7c855b9dce021c85fd698e4eec6a1e171763663e0d332d5f1d5f1091ac6e12

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp314-cp314-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 87ee644d56622e7249b9e006dfa4dd8f18f184be27638ed92a7c58d7ed7e3516
MD5 cd35f5771b3c0e91e160e7f33c1f9842
BLAKE2b-256 7059dcb24fc392a8c2b73265f7c0ed9a193b6dc190bfa4f68e2c544f3eb288df

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bf0d73f6b16851126999bbedaf5b2ab233f579c1ea4c7de79e6c172ac72bef64
MD5 99433f8044ebc399c6eaf8c091be1067
BLAKE2b-256 ed61630b63d6e5b94901f5ebebdcb17ef727bff680ee36cff6a52d2d72ae3a0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 92321e27fe2acb742bff1e090585727035cc5c7b8f0d0200f2374a64d6c14fc7
MD5 42c1ccedbe5c20014a3cabb1e8d61f49
BLAKE2b-256 b6f287fed083f5548eb7646987320664d9642b6179659baa771e27788c39cdd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp313-cp313-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7ca359d1df2170d572bd622674d4208b4c052b8fbcea73ea973f52ab093ed0e5
MD5 0ba14d56ad4f8d8b68d9af6cd00234e3
BLAKE2b-256 887a00c34bb368526170b51efbcf80681fa8b2734531a225a5a658b468afeb88

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cea53e9bdc93ac320df61cd92d936b264b2816385c8fa7e1d1f8c499eaee8395
MD5 0693b4165e965bd8c9eb86f4225d689e
BLAKE2b-256 fb3bd8ae7088fe4cd9bb4fcce986fce0b9dd2685b409e38caf64a2737b70dfbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 b9ac1d71b4f7b8fcbdfc4aef03973a110f13fd6d4cc9a83f52293ccd668376d8
MD5 9616d3330f6c0208fe4cd2458f44f6f0
BLAKE2b-256 c1b37b4e37bfdbe23f4a0f0dafc45e300cc936c1b72f5e248c9e8d915a685306

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp312-cp312-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d9107f5abc6655b971c03d564a3b066fec69c080bd1d7972cbeeed440d5d091
MD5 bf8f8886420967f36b96f473d4658742
BLAKE2b-256 1af237b39ff55fb2507a3f1f2d67fbbcb3f6847cdab43b10d255a4058263d292

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fddc76a992aa6a388c6ec8efb82a77c1f712918dd6115f3ccd33e90bc980d3a1
MD5 4afc057df22090b5c43e656bb7bd7f7f
BLAKE2b-256 7e9cf18d4e204e839cea740128c135f594c43c26b419d9de4c03822b1a4d114e

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1074474cb7a415dfbbf48bf04845efd7efcdf991de900cd7ae84ba10117b408e
MD5 04354ed10b4d50db29657c7a499ed805
BLAKE2b-256 694a0a1953388619446dc1f8f3811458150fc39069c571c165af02001f7ff463

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp311-cp311-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ecdc4a4ab8b32b6e6becf6f3d55a453b26a8f42d7abe723c1641cdf621026ebb
MD5 0aa6f7482674240f1b2a5206e060dd5b
BLAKE2b-256 f45e2fbcb84cf541a88837c1280181ea817396d8416e20ffd609ef522fadb2d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4eff01ce48582fca9f07a5620e4043d477e3c34daa0ffd6652873324aac890ba
MD5 4ee6af58a2350bef6761d2c82bf24791
BLAKE2b-256 8e3dca764c27948206f99cfb184c1aa226da68be298aed618cc2bb49aef39562

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 8530fa36b365a50ef4259e33ab9a7e56078d497409b925516d1a0cb11d468cbd
MD5 4f7cf1b53e805e6e238ba5434a9c275a
BLAKE2b-256 10f617393a5387b51a695f5e4935842b0a58c19e08ac632f0fe3c5a7ef799c98

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp310-cp310-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dc25628c2d05f45e7cbc8e06ff0c7a6bea40b769a74f97650fca6599d4e361e2
MD5 4bff3619576fc80d56b5244b59d3a901
BLAKE2b-256 3d9e0803826ce0a02894b586c40d4a723145eefe9202312ed9061e22faaee877

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 720cf8dc448eeae8bff65a2b30efa8312a1dc5235e77f767b90cec0323acee8a
MD5 93d3908f365094cb2085bd225ad0a372
BLAKE2b-256 67ad220a62ee36ecf4cb611e1bdb756bf1b4dde699cac6485c021ca46295b35e

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 50354f7464d8e4deb7cb43fc0acb0e7970827705e632ca833571fcf769e16e55
MD5 8a85527f1c26320e4601ca56d52a67c6
BLAKE2b-256 ef85d717efd913b6dc5df48e590b9e3f1a8b0e547bc844822a657eeef49308c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp39-cp39-win_amd64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 257f30c2effeab8d7a04ee14c62d9a1068eb0da597726dae0427ee8a6417bfd4
MD5 5ead5349792a5091f62eb22353d0cd1a
BLAKE2b-256 ab256dc6c8bac3db50211b40a306871c0c2b0d16a3915f562fe7828b6596b6ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file polyfem_polysolve-0.0.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for polyfem_polysolve-0.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 59a267987903b1c042d65f5f3ca992fce173ef330791cb71ed594808094f3d71
MD5 9368e831500d4fb55263ac51a8a735f2
BLAKE2b-256 76f87f8c14d9e7e0918cc1d5cafddd0cd1ca8e7f7767d5a3113b1499a717b7ac

See more details on using hashes here.

Provenance

The following attestation bundles were made for polyfem_polysolve-0.0.1-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on polyfem/polysolve-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page