Skip to content

Instantly share code, notes, and snippets.

@denis-bz
denis-bz / 0-tri101-inverse.md
Last active Apr 3, 2021
A simple matrix with interesting inverse 31 Mar 2021
View 0-tri101-inverse.md

A simple matrix with interesting inverse

Keywords: sparse linear solver, python, scipy, testcase, matrix, GMRES, poisson, plot

2apr-tri101-inv

A simple testcase for GMRES

Wikipedia GMRES says

@denis-bz
denis-bz / 0-Mittelmann-ip-simplex.md
Last active Jan 26, 2021
Mittelmann interior-point and simplex benchmarks 24 Jan 2021
View 0-Mittelmann-ip-simplex.md

Mittelmann interior-point and simplex benchmarks from http://plato.asu.edu/bench.html

Keywords, tags: linear programming, benchmark, Mittelmann, HiGHS, python, scipy, sparse-matrix

26jan-Mittelmann-ip-simplex

This plot shows the runtimes of various LP interior-point and simplex programs on Mittelmann's benchmark problems.

To plot similar rows / similar columns near each other,

@denis-bz
denis-bz / 0-LP-benchmarks-Mittelmann-HiGHS.md
Last active Jan 21, 2021
A few Mittelmann LP benchmarks run with HiGHS-ipm 19 Jan 2021
View 0-LP-benchmarks-Mittelmann-HiGHS.md

A few Mittelmann LP benchmarks run with HiGHS-ipm

Keywords, tags: linear programming, benchmark, Mittelmann, HiGHS, python, scipy, sparse-matrix

Here are logfiles for a few of the Mittelmann linear programming benchmark problems, run with the HiGHS interior-point solver via python-scipy. lpbar

@denis-bz
denis-bz / lpgen34.py
Created Jan 17, 2021
LP sparse testcase generator: 4n^3 x n^4, 4n^4 non0 17 Jan 2021
View lpgen34.py
#!/usr/bin/env python
""" lpgen34.py LP testcase generator
d=3: 3n^2 x n^3, 3 1s in each column
n=55: A 9075 x 166375, 499125 nnz, glpsol simplex 100 minutes
d=4: 4n^3 x n^4, 4 1s in each column, n in each row
n=16: A 2^14 x 2^16, 2^18 nnz, glpsol simplex 10 hours
"""
# keywords: linear programming, test case, generator, Latin-square
# https://stackoverflow.com/questions/57936789/many-vertex-test-problems-for-the-simplex-method
# https://math.stackexchange.com/questions/3370934/3d-permutation-matrices -- 4d too
@denis-bz
denis-bz / 0-Stripy.md
Created Jan 8, 2021
Stripy: percentile stripes for scatterplots
View 0-Stripy.md

Stripy: percentile stripes for scatterplots

Keywords: scatterplot, percentiles, quantiles, visualize, regression, nonparametric

ozone-stripy-4june

What does this show ? Consider a fat vertical line at a given x in one of these plots. The colored bands are, from low to high,

@denis-bz
denis-bz / rki-Klinische_Aspekte-29dec.csv
Created Jan 7, 2021
Covid-19 in Germany: ~ 5 % of the cases are hospitalized
View rki-Klinische_Aspekte-29dec.csv
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
# from rki-Klinische_Aspekte-29dec.xlsx
# written 2020-12-30 Dec 10:29 by bz rki_hospitalised_excel.py
KW Cases Hosp Hosp% Nohospinfo% Deaths Deaths%
10 894 162 18.1 10.5 12 1.34
11 6433 519 8.1 12.8 85 1.32
12 22431 2204 9.8 13.8 478 2.13
13 34028 5110 15 13.4 1457 4.28
14 36094 6064 16.8 12.8 2253 6.24
15 27188 4710 17.3 11.5 1870 6.88
@denis-bz
denis-bz / triangles_in_sparsegraph.py
Created Nov 17, 2020
triangles_in_sparsegraph.py triangles_to_edges.py 17 Nov 2020
View triangles_in_sparsegraph.py
#!/usr/bin/env python3
""" triangles in a sparse graph """
# Keywords: sparse-graph, sparse-matrix, scipy, mesh, triangles
# w Polygon_mesh Mesh_generation ...
import numpy as np
from scipy import sparse
# https://docs.scipy.org/doc/scipy/reference/sparse.csgraph.html
# some type names --
@denis-bz
denis-bz / 0-invop.md
Last active Mar 10, 2021
Inverse operators for scipy.sparse eigs, arpack 15 Nov 2020
View 0-invop.md

Invop() inverse operator for scipy.sparse eigenvalues with ARPACK

Problem: find a few eigenvalues λ and eigenvectors v of
A v = λ v, \ A a scipy.sparse matrix, largest or smallest |λ|
or K v = λ M v with stiffness matrix K and mass matrix M.

Purpose: experiment with different linear solvers, with verbose to track solver calls.
Keywords: scipy.sparse, linear-solvers, eigenvalue, generalized-eigenvalue, Arpack, logging

In the following examples, eigs( A [M] [Minv] [OPinv] [sigma] ... ) \

@denis-bz
denis-bz / 0-Covid19-hospitalized-Germany.md
Last active Sep 9, 2020
Covid-19 % cases hospitalized in Germany up to 6 Sept 2020
View 0-Covid19-hospitalized-Germany.md

Covid-19 cases hospitalized in Germany, March up to 6 September 2020

Keywords: Covid-19, hospitalized, Germany, plot, python

This plot shows the number of Covid-19 cases per week, the number hospitalized, and number of deaths, in Germany for weeks 10 to 36 2020:

9sep2020-Covid19-hospitalized-de-8sep

The data is taken from this report: \

@denis-bz
denis-bz / 0-How-to-make-a-Python-package-for-other-people-to-use.md
Created Jul 27, 2020
How to make a Python package for other people to use 27 Jul 2020
View 0-How-to-make-a-Python-package-for-other-people-to-use.md

How to make a Python package for other people to use

Keywords, tags: python packaging setup.py setuptools

Purpose: describe how to make a "package" of a Python program for other people to use. This introduction builds on the excellent oa-packaging-guide-preview.readthedocs.io — read that first.