Skip to content

Instantly share code, notes, and snippets.

View dousuguang's full-sized avatar

Suguang Dou dousuguang

  • DTU Wind Energy
  • Copenhagen, Denmark
View GitHub Profile
@dousuguang
dousuguang / rainflow_README.md
Created September 26, 2022 09:14 — forked from jennirinker/ rainflow_README.md
Rainflow counting in Python - cycle counts and ranges with/without Goodman correction

Summary

Python code to count rainflow cycles (with or without Goodman correction)

Notes

Repository includes a demo script (demo_rainflow.py) and the module (rainflow.py).

Rainflow function is a version of some commonly used Matlab/C code

@dousuguang
dousuguang / SparseCholesky.md
Created April 4, 2022 13:36 — forked from omitakahiro/SparseCholesky.md
[Python, Scipy] Sparse Cholesky decomposition

Scipy does not currently provide a routine for cholesky decomposition of a sparse matrix, and one have to rely on another external package such as scikit.sparse for the purpose. Here I implement cholesky decomposition of a sparse matrix only using scipy functions. Our implementation relies on sparse LU deconposition.

The following function receives a sparse symmetric positive-definite matrix A and returns a spase lower triangular matrix L such that A = LL^T.

from scipy.sparse import linalg as splinalg
import scipy.sparse as sparse
import sys

def sparse_cholesky(A): # The input matrix A must be a sparse symmetric positive-definite.