Skip to content

Latest commit

 

History

History
138 lines (120 loc) · 7.68 KB

File metadata and controls

138 lines (120 loc) · 7.68 KB

Zigen Project Structure

Directory Layout

zigen/
├── build.zig                  # Build configuration (library, tests, examples, bench)
├── build.zig.zon              # Package manifest
├── src/                       # Source code
│   ├── zigen.zig              # Root module — re-exports all public types
│   ├── core/                  # Core types and operations
│   │   ├── core.zig           # Matrix, Vector, MatrixDynamic, VectorDynamic
│   │   ├── array.zig          # Array, ArrayDynamic (element-wise ops)
│   │   ├── complex.zig        # Complex number type
│   │   ├── kronecker.zig      # Kronecker product
│   │   ├── map.zig            # MapMatrix, MapVector (memory views)
│   │   ├── matrix_functions.zig # matExp, matPow, matSqrt, matLog
│   │   ├── permutation.zig    # PermutationMatrix, ColPivHouseholderQR
│   │   └── triangular.zig     # Triangular solvers, DiagonalMatrix, conditionNumber
│   ├── decompositions/        # Linear algebra decompositions
│   │   ├── decompositions.zig # Fixed-size: LU, QR, Cholesky, LDLT, SVD, EigenSolver
│   │   ├── dynamic_decompositions.zig # Dynamic: LUDynamic, QRDynamic, CholeskyDynamic, SVDDynamic
│   │   ├── bdcsvd.zig         # Bidiagonal Divide & Conquer SVD
│   │   ├── complete_orthogonal_decomp.zig # Complete orthogonal decomposition
│   │   ├── complex_schur.zig  # Complex Schur decomposition
│   │   ├── eigen_solver.zig   # Non-symmetric eigenvalue solver
│   │   ├── full_piv_lu.zig    # Full-pivoting LU
│   │   ├── generalized_eigen.zig # Generalized eigenvalue solver
│   │   ├── hessenberg.zig     # Hessenberg decomposition
│   │   ├── jacobi_svd.zig     # Jacobi SVD
│   │   ├── real_qz.zig        # Generalized Schur (QZ)
│   │   ├── real_schur.zig     # Real Schur decomposition
│   │   └── tridiag.zig        # Tridiagonalization
│   ├── sparse/                # Sparse matrix types and solvers
│   │   ├── sparse.zig         # SparseMatrix (CSR), SparseLU, SparseCholesky
│   │   ├── coo.zig            # SparseMatrixCOO (coordinate format)
│   │   ├── sparse_qr.zig      # Sparse QR decomposition
│   │   ├── simplicial_ldlt.zig # Simplicial LDLT solver
│   │   ├── simplicial_llt.zig  # Simplicial LLT solver
│   │   └── matrix_market.zig  # MatrixMarket I/O
│   ├── solvers/               # Iterative solvers
│   │   ├── solvers.zig        # CG, BiCGSTAB, GMRES, MINRES, LSCG
│   │   ├── preconditioners.zig # Diagonal, Identity, LeastSquare preconditioners
│   │   └── incomplete_lut.zig # Incomplete LU with thresholding
│   ├── geometry/              # Geometric types and transforms
│   │   └── geometry.zig       # Quaternion, Transform, AngleAxis, Rotation2D, etc.
│   └── io/                    # File format I/O
│       └── npy.zig            # NumPy .npy load/save
├── test/                      # Tests
│   ├── unit/                  # Unit tests (8 files)
│   │   ├── core_test.zig      # Matrix/vector operations
│   │   ├── dynamic_test.zig   # Dynamic matrix operations
│   │   ├── array_test.zig     # Array element-wise operations
│   │   ├── decomposition_test.zig # All decomposition tests
│   │   ├── geometry_test.zig  # Quaternion, transform tests
│   │   ├── sparse_test.zig    # Sparse matrix and solver tests
│   │   ├── utility_test.zig   # Utility function tests
│   │   └── npy_test.zig       # NPY I/O tests
│   └── integration/           # Integration tests
│       └── integration_test.zig # Cross-module integration
├── examples/                  # 9 runnable examples
│   ├── README.md              # Categorized example index
│   ├── basic_matrix.zig       # Matrix basics
│   ├── matrix_operations.zig  # Advanced matrix ops
│   ├── linear_algebra.zig     # Decompositions, solve
│   ├── dynamic_decompositions.zig # Workspace-reuse pattern
│   ├── sparse_systems.zig     # Sparse matrices, SparseLU
│   ├── iterative_solvers.zig  # CG, BiCGSTAB
│   ├── geometry.zig           # Quaternions, rotations
│   ├── data_analysis.zig      # PCA via SVD
│   └── image_processing.zig   # Convolution kernels
├── bench/                     # Benchmark system (Zigen vs Eigen)
│   ├── README.md              # Benchmark documentation
│   ├── run_benchmark.sh       # Main benchmark script
│   ├── benchmark_zigen.zig    # Zigen benchmark entry point
│   ├── benchmark_eigen.cpp    # Eigen benchmark entry point
│   ├── generate_test_data.py  # Test data generator
│   ├── generate_report.py     # Markdown report generator
│   ├── zigen/                 # Zigen benchmark modules (10 files)
│   │   ├── basic_matrix.zig, vector_ops.zig, decomposition.zig
│   │   ├── dynamic.zig, extended.zig, sparse.zig, quaternion.zig
│   │   ├── helpers.zig, verify.zig, timer.zig
│   │   └── ...
│   └── eigen/                 # Eigen benchmark modules (10 files)
│       ├── basic_matrix.hpp, vector_ops.hpp, decomposition.hpp
│       └── ...
├── docs/                      # Documentation
│   ├── README.md              # Documentation index
│   ├── api.md                 # Complete API reference
│   ├── eigen-migration.md     # Eigen → Zigen migration guide
│   └── modules/               # Per-module detailed docs
│       ├── core.md
│       ├── decompositions.md
│       ├── sparse.md
│       ├── solvers.md
│       ├── geometry.md
│       └── io.md
└── CHANGELOG.md

Module Overview

Core (src/core/ — 8 files)

Foundation types: Matrix, Vector, MatrixDynamic, VectorDynamic, Array, Complex, MapMatrix, DiagonalMatrix, PermutationMatrix, plus matrix functions (exp, pow, sqrt, log) and Kronecker product.

Decompositions (src/decompositions/ — 13 files)

Fixed-size and dynamic-size factorizations: LU, QR, Cholesky, LDLT, SVD, JacobiSVD, BDCSVD, EigenSolver, SelfAdjointEigenSolver, GeneralizedEigenSolver, Tridiagonalization, Hessenberg, RealSchur, ComplexSchur, RealQZ, FullPivLU, ColPivHouseholderQR, CompleteOrthogonalDecomp.

Dynamic variants support workspace-reuse via init() + computeFrom() + solveInto().

Sparse (src/sparse/ — 6 files)

CSR and COO sparse matrix formats. Direct solvers: SparseLU, SparseCholesky, SparseQR, SimplicialLDLT, SimplicialLLT. MatrixMarket file format I/O.

Solvers (src/solvers/ — 3 files)

Krylov-subspace iterative solvers: ConjugateGradient, BiCGSTAB, GMRES, MINRES, LeastSquaresConjugateGradient. Preconditioners: Diagonal, Identity, IncompleteLUT.

Geometry (src/geometry/ — 1 file)

Quaternion, Transform, AngleAxis, Rotation2D, Isometry, Affine, Projective, Hyperplane, AlignedBox, ParametrizedLine, Scaling, Translation, Euler angles, Umeyama alignment.

I/O (src/io/ — 1 file)

NumPy .npy binary format load/save for matrices and vectors.

Build Targets

zig build test              # All tests (src + unit + integration)
zig build unit-test         # Unit tests only
zig build integration-test  # Integration tests only
zig build run-<example>     # Run an example (e.g. run-basic_matrix)
zig build bench             # Run benchmark
zig build install-bench     # Build benchmark binary