Code and data for "Generalized inverses of structured ring-linked multi-star digraph matrices"
Description
This dataset contains the Python code, the test instances, and the numerical results reported in the computational experiments of the article "Generalized inverses of structured ring-linked multi-star digraph matrices" by F. Maciala. The article studies the Drazin inverse and the index of the block matrices M = [A B; C 0] associated with ring-linked multi-star digraphs, in which the centers of k >= 3 stars lie on a bidirected cycle. The code verifies the theoretical results of the article and compares a structured algorithm for computing the Drazin inverse with a dense method. Contents: - code/ringstars_symbolic.py: symbolic verification in rational arithmetic (SymPy). It reproduces the table of verified instances and tests 250 random instances, checking the defining equations of the Drazin inverse, the factorization chain, the criteria for index two and index three, and the run criterion for the cycle. - code/ringstars_numeric.py: floating-point experiments (NumPy/SciPy). It reproduces the comparison between the structured and the dense computation (matrices of order up to about 2000) and the large-scale experiments (structured computation for matrices of order up to 400 000, without forming dense matrices). - results/: the data underlying all tables of the computational experiments (CSV), the matrices of every verified instance (JSON), the 250 random instances (CSV), and the platform and library versions used for the timings. - README.md, requirements.txt, LICENSE. All random choices use fixed seeds, so matrix sizes, indices, and residuals are reproduced identically; timings depend on the machine.
Files
Steps to reproduce
Software requirements Python 3.10 or later with SymPy, NumPy and SciPy. The results in the article were produced on Linux (2 CPU cores) with Python 3.13, NumPy 2.5 and SciPy 1.18; see results/machine_info.txt. Installation From the top-level folder of the dataset, install the required packages: pip install -r requirements.txt Symbolic verification Run: python3 code/ringstars_symbolic.py Running time: about 45 seconds. For each instance, the script builds the matrix M in rational arithmetic, computes ind(M) from the ranks of the powers of M, computes the Drazin inverse with the minimal-polynomial algorithm of the article, and checks the defining equations of the Drazin inverse. It then verifies the factorization chain, the criteria for index two and index three, and the run criterion for the cycle. It repeats these checks on 250 random instances generated with the seed random.Random(7). Expected output: the 13 verified instances, each ending in "True", followed by the line "random instances: 250, failures: 0; table all ok: True". Output files: results/table1_instances.csv, results/table1_instances.json, results/random_instances.csv. Floating-point experiments Run: python3 code/ringstars_numeric.py Running time: about 35 seconds. The script generates four families of test matrices (G, R, S, X) with the seed numpy.random.default_rng(2026). For orders up to about 2000, it compares the structured algorithm of the article with the dense formula M^D = M^l (M^(2l+1))^+ M^l, where l = ind(M) and the pseudoinverse uses the standard tolerance max(m,n)*eps*sigma_max. For orders up to 400 000, it applies the structured algorithm to random vectors without forming dense matrices and evaluates the residuals of the defining equations on five random vectors. Output files: results/table2_structured_vs_dense.csv, results/table3_large_scale.csv, results/machine_info.txt. Reproducibility Because all random choices use fixed seeds, matrix sizes, indices and residuals are reproduced identically; timings depend on the machine. An alternative output directory can be passed as the first argument to either script.
Institutions
- University of MinhoBraga, Braga
Categories
Funders
- Fundação para a Ciência e TecnologiaMinistry of Science Technology and Higher EducationLisbon, LisbonGrant ID: UID/00013/2025