Vicentin
A comprehensive Python library for mathematical optimization, deep learning, computer vision, and classic algorithms. This library is designed with a dual-backend architecture, offering seamless switching between NumPy for transparency and PyTorch for hardware acceleration and automatic differentiation.
Table of Contents
Introduction
vicentin is a Python package that contains my personal implementations of a variety of algorithms, data structures, and optimization techniques. It serves as a collection of theoretical and practical programming concepts.
Features
- Data Structures: Queue, Stack, Tree, Graph, Heap, Priority Queue, Trie, Union Find
- Dynamic Programming: Knapsack, Matrix Multiplication, Rod Cutting, Edit Distance
- Graph Algorithms: Minimum Spanning Tree (MST), Shortest Path, Negative Cycle Detection
- Image & Video Processing: Optical Flow (Horn-Schunck), Differentiation, Regularization, Image-to-Graph
- Optimization: Gradient Descent, Newton's Method, Barrier Method, Proximal Gradient Descent, ISTA, Projected Gradient Descent, Newton-Raphson (Root Finding)
- Machine Learning:
- Kernels
- Unsupervised Learning: PCA
- Classification: Logistic Regression, SVM
- Regression: Ridge Regression
- Deep Learning:
- Models: Autoencoders (AE), Variational Autoencoders (VAE)
- Trainers: Standard, Supervised, GAN, Distillation
- Losses: Beta-VAE, Wasserstein GAN
- Sorting: Heap Sort
- Mathematical Tools: Polynomial Operations
- Papers: Grad-CAM, SimCLR
Installation
pip install vicentin # core: NumPy backend (numpy, scipy)
pip install "vicentin[torch]" # + Torch backend for the dual-backend modules
Optional extras, combine as needed (e.g. "vicentin[torch,plot]"):
| Extra | Adds | For |
|---|---|---|
torch |
torch | the Torch backend of any dual-backend module |
dl |
torch, torchvision, tqdm | vicentin.deep_learning, vicentin.papers |
svm |
cvxopt | the NumPy SVM's QP solver |
plot |
matplotlib, networkx | Graph.draw(), trainer visualizations |
all |
everything above | |
test |
all + pytest, scikit-learn |
running the test suite |
For development:
git clone https://codeberg.org/fsvicentin/vicentin.git
cd vicentin
python -m venv venv && source venv/bin/activate
pip install -e ".[test]"
pytest
Usage
Heap data structure
# Example: Using the heap data structure
from vicentin.data_structures.heap import Heap
heap = Heap()
heap.insert(5)
heap.insert(2)
heap.insert(8)
print(heap.extract_min()) # Output: 2
Newton's Method
import torch
from vicentin.optimization.minimization import newton_method
def objective(x):
return torch.sum(x**2)
x0 = torch.tensor([10.0, 10.0])
A = torch.tensor([[1.0, 1.0]])
b = torch.tensor([1.0])
# Backend (Torch) is automatically detected from x0
x_opt = newton_method(objective, x0, equality=(A, b))
print(f"Optimal solution: {x_opt}")
Pre-commit Setup
This repository uses pre-commit to enforce coding standards, automatic formatting and automatic version bumping before commits.
1️⃣ Install pre-commit
pip install pre-commit
2️⃣ Install Hooks
pre-commit install
3️⃣ Use commitizen to commit
cz commit
License
This project is licensed under the MIT License.
Metadata
Release files for vicentin 1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vicentin-1.7.tar.gz | 138.4 kB | Without provenance | Details for vicentin-1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vicentin-1.7-py3-none-any.whl | Python 3 | none | any | Details for vicentin-1.7-py3-none-any.whl |
Total release size: 323.1 kB
Release files / vicentin-1.7.tar.gz
| Download URL | vicentin-1.7.tar.gz |
|---|---|
| Size | 138.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c3af5ac3f82fd8e6a9f1286d61a2722ae810ddda3e263426dcfec266fb032ff
|
|
BLAKE2b-256 checksum How to use checksums |
073b4314741f89f812f2aa87d044dad556f9b0a335cf542efee2ad4e47925e92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / vicentin-1.7-py3-none-any.whl
| Download URL | vicentin-1.7-py3-none-any.whl |
|---|---|
| Size | 184.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c52d7a52b74448a058903a7caed9e4a0c469f7420c59f9f6b1cad981afa05a4
|
|
BLAKE2b-256 checksum How to use checksums |
a4ffba6f3043cf779d40d7f8faaa93f57652d095492b8cbb2104af81c687e029
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for vicentin 1.7
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.