Skip to main content

Algebraic Independence Processor - auto-detects structure for optimal computation

Project description

AIP Engine

Algebraic Independence Processor - Auto-detects structure in your data and picks the optimal computation path.

Install

pip install aip-engine

Quick start

import aip
import numpy as np

# Matrix multiply: auto-detects sparse vs dense
A = np.eye(1000) * 3.0
B = np.eye(1000) * 2.0
C = aip.multiply(A, B)  # uses scipy.sparse automatically

# Solve linear system: auto-routes by shape and density
x = aip.solve(A, np.ones(1000))

# Graph analysis: communities, fraud detection
edges = [(0, 1), (1, 2), (2, 0), (3, 4)]
info = aip.analyze(edges)

# Matrix conversion: auto-detect optimal format
report = aip.analyze_format(A)
print(report['recommended'])  # 'DIA' (diagonal detected)
sparse_A = aip.to_sparse(A)   # auto-picks best sparse format

# MoE acceleration: only activate needed experts
result = aip.moe_forward(x_input, experts, router, n_active=4)

Modules

Detector (aip.detect, aip.detect_matrix)

Analyzes matrices and graphs to detect: density, sparsity, bipartition, connected components, max degree. Routes to optimal algorithm. Complexity: O(n + m).

Matrix Operations (aip.multiply, aip.solve)

Auto-routing multiplication and linear system solving:

Input AIP detects Routes to
Sparse matrix density < 30% scipy.sparse (CSR)
Dense matrix density >= 30% numpy / BLAS
Square sparse system square + sparse spsolve
Rectangular sparse non-square + sparse LSQR iterative
Rectangular dense non-square + dense lstsq

Matrix Conversion (aip.convert, aip.to_sparse, aip.to_dense)

Auto-detects internal structure (diagonal, banded, block, symmetric, triangular) and converts to the optimal storage format:

Structure detected Converts to
Diagonal DIA
Banded (narrow bandwidth) DIA
Block-diagonal BSR
General sparse CSR
Dense (> 30%) numpy array

Includes aip.analyze_format() for full structural analysis with memory comparison, and aip.benchmark_convert() for actual timing benchmarks across formats.

Graph Analysis (aip.analyze, aip.detect_fraud)

Community detection, critical nodes, and fraud pattern detection (odd cycle / carousel detection) in transaction networks.

MoE Acceleration (aip.moe_forward, aip.MoEEngine)

Inference engine for Mixture-of-Experts models. Detects and activates only the needed experts (~3% of total), reducing compute and memory proportionally.

Documentation

See the docs/ folder for detailed API documentation of each module.

Requirements

  • Python 3.8+
  • NumPy >= 1.20
  • SciPy >= 1.7

License

MIT - Carmen Esteban, 2025-2026

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

aip_engine-0.3.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

aip_engine-0.3.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file aip_engine-0.3.0.tar.gz.

File metadata

  • Download URL: aip_engine-0.3.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for aip_engine-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e48d40d4500b20c7eea07dde440165329ddcb54d5aed092f8f73219788e1c14
MD5 127e0fde72aa218c21791b01fc632d94
BLAKE2b-256 5994e78e801d35584c7bc4c924d0de18df70dbe3cf58fc38a931d609264a87e4

See more details on using hashes here.

File details

Details for the file aip_engine-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: aip_engine-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for aip_engine-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0dff56536f3e65f7d7ea9042bae0415106dccc51c07516977609a515de63bc57
MD5 91b123b62d229f57fcd7a54729c76cab
BLAKE2b-256 27c76676b61646fd5872392e6052b47308d98faee57694bd4c9039d6efcb4a04

See more details on using hashes here.

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