Skip to main content

spacecore-optimize

Optimization on top of SpaceCore. SpaceCore supplies spaces, geometry, operators, functionals and proximal steps; this package hands them to external optimizers and adds a catalogue of common objectives.

The one rule it enforces: an optimizer that works on flat coordinates gets the gradient as the covector X.riesz(F.grad(x)), not the Riesz gradient F.grad(x). On a Euclidean space the two coincide; on a weighted or operator geometry only the covector is the derivative with respect to the coordinates SciPy and optax update.

Install

pip install spacecore-optimize            # SciPy adapters and functionals
pip install "spacecore-optimize[optax]"   # plus minimize_optax (JAX backend)

Requires Python 3.11+ and SpaceCore 0.5.0+.

Example

Least squares on a space with a weighted inner product:

import numpy as np
import spacecore as sc
import spacecore_optimize as spo

ctx = sc.Context(sc.NumpyOps(), dtype=np.float64)
X = sc.DenseCoordinateSpace((3,), ctx, geometry=sc.WeightedInnerProduct(ctx.asarray([1.0, 4.0, 9.0])))
Y = sc.DenseCoordinateSpace((5,), ctx)
rng = np.random.default_rng(0)
A = sc.DenseLinOp(ctx.asarray(rng.standard_normal((5, 3))), X, Y, ctx)
b = ctx.asarray(rng.standard_normal(5))

F = spo.least_squares(A, b)                 # 1/2 ||A x - b||^2
result = spo.minimize_scipy(F, X.zeros())   # scipy.optimize.minimize, L-BFGS-B
x = result.x_element                        # the minimizer, an element of X

What is in it

Name What it does
minimize_scipy, line_search_scipy Run scipy.optimize.minimize / line_search on a SpaceCore Functional.
minimize_optax, OptaxResult A compiled optax loop on a JAX-backed domain, stopping on the dual gradient norm.
least_squares scale * ‖A x − b‖² as a quadratic form, optionally weighted.
NegativeEntropyFunctional, KLDivergenceFunctional, HuberFunctional Coordinate objectives whose gradients follow the domain geometry.
SpectralFunctional, spectralize, eigenvalue_space, NuclearNormFunctional Spectral functions on Jordan-algebra spaces such as Hermitian matrices.
RealifiedFunctional, realify A complex-domain functional seen on stacked real coordinates.
generalized_shrinkage, prox_l1, prox_l2sq, project_nonneg Closed-form proximal steps in diagonal geometry.

The norms covered by SpaceCore's own prox rules (LpNormFunctional, SquaredL2NormFunctional, L1NormFunctional) live in SpaceCore.

Documentation

Published at https://pavlo3p.github.io/spacecore-optimize/. To build locally:

pip install -e ".[docs]"
sphinx-build -W docs docs/_build/html

License

Apache-2.0.

Metadata

Release files for spacecore-optimize 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spacecore-optimize 0.0.1
File Size Uploaded
spacecore_optimize-0.0.1.tar.gz 44.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spacecore-optimize 0.0.1
File Interpreter ABI Platform
spacecore_optimize-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 76.0 kB

Release files / spacecore_optimize-0.0.1.tar.gz

Download URL spacecore_optimize-0.0.1.tar.gz
Size 44.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7c55b5bdea280c612957e911cd223bfb534fe2797b4e80bc1b559059e587c902
BLAKE2b-256 checksum
How to use checksums
0e3b681315ffe9d38494394deab01b9367d76fcae87ccf35c2d0cfc42e86b898
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release files / spacecore_optimize-0.0.1-py3-none-any.whl

Download URL spacecore_optimize-0.0.1-py3-none-any.whl
Size 31.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8966b6cf7ac6e869dfffd6bc9281652a50ae15a3c7387e9186c83a0bd8d06dce
BLAKE2b-256 checksum
How to use checksums
a058542ca65ba1d6f0936faabb8a1ec040d74ed44437ce8baf0253835f8643a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page