$npx skillfedfor your agent

cotengra

Hyper optimized contraction trees for large tensor networks and einsums.

With conditionsPyPI Scientific/EngineeringReleased Jun 2026177.8K downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — cotengra-0.8.2-py3-none-any.whl
v0.8.2 · released 2026-06-22 · Python >=3.10 · 1 runtime deps: autoray

Yes, if you work with large tensor networks or complex einsum expressions where contraction order matters. The library is actively maintained, has no known vulnerabilities, installs with minimal friction, and is permissively licensed. It's most valuable in scientific computing and physics simulations; less critical for small-scale tensor operations where contraction cost is negligible.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.10 or later.
  • Low friction—pure Python wheel with a single runtime dependency (autoray).
  • Actively maintained with a recent release and no known vulnerabilities.

License · maintenance · safety

Apache-2.0 (permissive) — Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.

last release 2026-06-22 (53 days) · last repo commit 2026-08-07 · 247 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 177,800 downloads/mo, #10,206 on PyPI

Verify before relying

pip install cotengra
import cotengra as ctg
import autoray as ar

# Find optimized contraction path for einsum expression
path_info = ctg.contract_path('ij,jk->ik', ar.ones((10, 10)), ar.ones((10, 10)))
  • Whether the hyper optimizer's performance gains justify overhead for small tensor networks.
  • How dynamic slicing memory savings scale with network size and sparsity patterns.
  • Compatibility and performance with tensor libraries beyond those explicitly mentioned.
Same gist for agents: .md · .json

What it is and what it does

Cotengra is a Python library for optimizing the contraction of large tensor networks and einsum expressions. It addresses a core computational challenge: when contracting many tensors together, the order in which you combine them dramatically affects memory use and runtime. Cotengra provides multiple strategies—including a hyper optimizer that samples and tunes contraction trees, simulated annealing, and dynamic slicing—to find efficient contraction orders. It works as a drop-in replacement for numpy.einsum and ncon, and can generate paths compatible with opt_einsum, quimb, and other libraries.

The package is built on autoray, which abstracts tensor operations across different backends, so you can optimize contractions for tensors from many libraries even if they don't natively support einsum. It's designed for scientific and engineering workflows involving large hypergraph tensor networks, particularly in physics and machine learning applications where contraction cost dominates.

Use it for

  • Optimize contraction order for quantum circuit simulations or tensor network states in physics.
  • Find efficient einsum paths for large matrix chain multiplications in machine learning pipelines.
  • Parallelize and reduce memory footprint of tensor contractions via dynamic slicing.
  • Integrate optimized contraction strategies into existing code using einsum or ncon without rewriting.
  • Benchmark and compare contraction performance across different tensor libraries via autoray.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you work with large tensor networks or complex einsum expressions where contraction order matters.

The library is actively maintained, has no known vulnerabilities, installs with minimal friction, and is permissively licensed. It's most valuable in scientific computing and physics simulations; less critical for small-scale tensor operations where contraction cost is negligible.

Install

cotengra on PyPI

Before you install

Low friction—pure Python wheel with a single runtime dependency (autoray). Actively maintained with a recent release and no known vulnerabilities.

Requires Python 3.10 or later.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you include the license notice.

Quickstart

pip install cotengra
import cotengra as ctg
import autoray as ar

# Find optimized contraction path for einsum expression
path_info = ctg.contract_path('ij,jk->ik', ar.ones((10, 10)), ar.ones((10, 10)))

Verify before relying

  • Whether the hyper optimizer's performance gains justify overhead for small tensor networks.
  • How dynamic slicing memory savings scale with network size and sparsity patterns.
  • Compatibility and performance with tensor libraries beyond those explicitly mentioned.

Package facts

LicenseApache-2.0 permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
autoray
MaintenanceActively maintained 53 days since the last release
Last repo commit
First released
Downloads177,800 / month, #10,206 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Physics

Evidence: cotengra-0.8.2-py3-none-any.whl

Tags

Capabilities
tensor network contraction optimizationeinsum path optimizationtensor contraction orderinglarge tensor network solvereinsum replacement librarycontraction tree buildertensor slicing and parallelism
Topics
tensor-networksscientific-computingoptimization
PyPI keywords
contractioneinsumgraphhypergraphnetworkpartitiontensor

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “tensor network contraction optimization”

  • cotengraCotengra optimizes the contraction order of large tensor networks and…
  • quimbQuimb provides Python tools for quantum information and many-body…
  • opt-einsumOptimizes the contraction order of einsum expressions to dramatically…

Give your agent the search over MCP, or paste the wish link into any chat.

More Scientific/Engineering packages

numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
pandas Worth it
PyPI · Scientific/Engineering · released Jul 2026

pandas provides fast, flexible data structures (Series and DataFrame) for loading, cleaning, transforming, and analyzing labeled or relational data in Python.

BSD-3-Clausecompiled wheel · 3.11+
769.1Mdownloads / mo
scipy Worth it
PyPI · Libraries · released Jun 2026

scipy provides numerical algorithms for mathematics, science, and engineering—including optimization, integration, linear algebra, Fourier transforms, signal and image processing, and ODE solvers—built on numpy arrays.

BSD-3-Clausecompiled wheel · 3.12+
449.0Mdownloads / mo
scikit-learn Worth it
PyPI · Software Development · released Jun 2026

scikit-learn provides a comprehensive Python library for supervised and unsupervised machine learning, including classification, regression, clustering, dimensionality reduction, and model evaluation tools built on NumPy and SciPy.

Install it if you need to train, evaluate, or deploy supervised or unsupervised learning models.

BSD-3-Clausecompiled wheel · 3.11+
235.5Mdownloads / mo
dill Worth it
PyPI · Software Development · released Jan 2026

dill extends Python's pickle module to serialize and deserialize a much wider range of Python objects, including functions, lambdas, classes, and interpreter sessions, to byte streams for storage or network transmission.

BSD-3-Clausepure Python · 3.9+
208.1Mdownloads / mo
multiprocess Worth it
PyPI · Software Development · released Jan 2026

Multiprocess is an enhanced fork of Python's standard multiprocessing library that uses dill for better serialization, allowing you to spawn processes with a threading-like API and share complex objects between them.

Install it if you use multiprocessing and encounter pickle serialization limits with lambdas or complex objects.

BSD-3-Clausepure Python · 3.9+
202.7Mdownloads / mo

See also opt-einsum · opt-einsum-fx · einops · spo4onnx · torch · onnx-graphsurgeon · e3nn · instanttensor · onnxoptimizer · einops-exts