Skip to main content

NpyCVX

A small library to connect numpy and CVXOPT together and solves all messy conversions in between.

Install

pip install npycvx

Example usage

A simple example when maximizing w^T x over the same system of linear inequalities.

import numpy as np
import npycvx
import functools # <- built-in python lib... 

# Some dummy data...
A = np.array([
    [-1, 1, 1],
    [-2,-1,-1]
])
b = np.array([0,-3])
objectives = np.array([
    [ 0, 0, 0],
    [ 1, 1, 1],
    [-1,-1,-1],
    [ 1, 0, 1],
])

# Load solve-function with the now converted numpy
# matrices/vectors into cvxopt data type...
solve_part_fn = functools.partial(
    npycvx.solve_lp, 
    *npycvx.convert_numpy(A, b), 
    False
)

# Exectue each objective with solver function
solutions = list(
    map(
        solve_part_fn, 
        objectives
    )
)

Release files for npycvx 0.0.4

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

Source distribution (sdist)

Source distribution for npycvx 0.0.4
File Size Uploaded
npycvx-0.0.4.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for npycvx 0.0.4
File Interpreter ABI Platform
npycvx-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / npycvx-0.0.4.tar.gz

Download URL npycvx-0.0.4.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ddba97e66a31863b90cf7844d78ac4f3d69e28d3c13cbbf84bac5d256ac708e1
BLAKE2b-256 checksum
How to use checksums
45a3ad745fc09da6f7023c7dc67d5a501ab910522a12fc24059156cd738c7a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.9.18 Darwin/23.1.0

Release files / npycvx-0.0.4-py3-none-any.whl

Download URL npycvx-0.0.4-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2da9a37d47a9229e785b91ecd0dcad0daeb6b57a84ccddecf8db23bc2c625082
BLAKE2b-256 checksum
How to use checksums
db96c9a2e388d6d5a5a13caaeea81e24e0a929ea564c672c2401ed636a36a5b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.9.18 Darwin/23.1.0

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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