semvec/pypi-packages huggingface dataset:
jeig 0.5.1
Various eigendecomposition implementations wrapped for jax.
Requires Python: >=3.7
Keywords: jax, eigendecomposition, eig, torch, scipy, numpy

# jeig - Eigendecompositions wrapped for jax
[![Continuous integration](https://github.com/invrs-io/jeig/actions/workflows/build-ci.yml/badge.svg)](https://github.com/invrs-io/jeig/actions)
[![PyPI version](https://img.shields.io/pypi/v/jeig)](https://pypi.org/project/jeig/)

## Overview

This package wraps eigendecompositions as provided by jax, cusolver, magma, numpy, scipy, and torch for use with jax. Depending upon your system and your versions of these packages, you may observe significant speed differences. The following were obtained using jax 0.8.0 on a system with 28-core Intel Xeon w7-3465X and NVIDIA RTX4090.

![Speed comparison](https://github.com/invrs-io/jeig/blob/main/docs/speed.png?raw=true)

## Install
jeig can be installed via pip,
```
pip install jeig
```
This will also install torch. If you only need torch for use with jeig, then the CPU-only version could be sufficient and you may wish to install manually as described in the [pytorch docs](https://pytorch.org/get-started/locally/).

## Example usage

```python
import jax
import jeig

matrix = jax.random.normal(jax.random.PRNGKey(0), (1, 2048, 2048)).astype(complex)

%timeit jax.block_until_ready(jeig.eig(matrix, backend="cusolver"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="lapack"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="magma"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="torch"))
```
```
1.31 s ± 43 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
5.44 s ± 379 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
11.1 s ± 937 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
4.93 s ± 92.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```

The default torch backend has good performance when performing batched eigendecomposition on many-core CPUs.

```python
matrix = jax.random.normal(jax.random.PRNGKey(0), (8, 2048, 2048)).astype(complex)

%timeit jax.block_until_ready(jeig.eig(matrix, backend="cusolver"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="lapack"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="magma"))
%timeit jax.block_until_ready(jeig.eig(matrix, backend="torch"))
```
```
10.4 s ± 116 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
48.1 s ± 6.74 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
1min 33s ± 1.49 s per loop (mean ± std. dev. of 7 runs, 1 loop each)
7.18 s ± 91.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```

## Credit
The torch implementation of eigendecomposition is due to a [comment](https://github.com/google/jax/issues/10180#issuecomment-1092098074) by @YouJiacheng.
laibon 0.0.12
Common library for django development
Requires Python: >=3.8

# Laibon

Laibon is a collection of useful common classes that can go a long way to help in developing a django based web application.

## Features

- **Database Access**: Abstract adapter pattern for clean separation between business logic and Django models
- **Flow Management**: Activity-based workflow execution with conditional jumps and error handling  
- **Container Pattern**: Thread-safe key-value storage for passing data between activities
- **JSON Validation**: Schema-based request validation with caching for performance
- **Exception Handling**: Comprehensive exception hierarchy for different error scenarios

## Installation

From PyPI:
```bash
python3 -m pip install laibon
```

From TestPyPI:
```bash
pip install --extra-index-url https://testpypi.python.org/pypi laibon
```

## Quick Examples

### Database Adapter Pattern
```python
from laibon.db import Adapter, BaseModel

class UserAdapter(Adapter):
    def __init__(self, entity_id=None, name=None, email=None):
        super().__init__(entity_id)
        self.name = name
        self.email = email
    
    def to_model(self, existing=None):
        if existing:
            existing.name = self.name
            return existing
        return UserModel(name=self.name, email=self.email)
```

### Flow Management
```python
from laibon.rtf import FlowDefinition, FlowRunner

flow = FlowDefinition("User Registration")
flow.add(ValidateInputActivity) \
    .jump_if(ValidationResult.INVALID, ErrorActivity) \
    .jump_default(CreateUserActivity)

runner = FlowRunner(data_container)
runner.run_flow(flow)
```

### JSON Validation
```python
from laibon.rest import JSONSchemaValidator

try:
    JSONSchemaValidator.validate_schema(
        {"name": "John", "age": 30}, 
        "user/create_request.json"
    )
except JSONValidationException:
    # Handle validation error
    pass
```

## Requirements

- Python >= 3.8
- Django >= 4.2
- jsonschema >= 4.0.0
pygfxd 1.0.5
Python bindings for libgfxd

## pygfxd

Python bindings for [libgfxd](https://github.com/glankk/libgfxd/)

Refer to the original documentation and function docstrings for usage.

Before running the library, run `make` to build the libgfxd native code as a shared object.

Example in `test.py`, however sample data is not provided, please source some yourself.