Biomedical Physics > Software > pysparseLM

# pysparseLM - A Python wrapper for sparseLM

pysparseLM is a Python wrapper for the sparseLM library [1]. sparseLM is a sparse implementation of the Levenberg-Marquardt (LM) optimization algorithm. The Levenberg-Marquardt algorithm is used to minimize scalar functions of the form $C(x) = \sum_i H_i(\mathbf{x})^2 \; ,$ where $$\mathbf{x}$$ is the input vector and $$\mathbf{H}(\mathbf{x})$$ is a vector valued function. Although the scalar function $$C(\mathbf{x})$$ should be minimized, the vector valued function $$\mathbf{H}(\mathbf{x})$$ is required by sparseLM. In addition, sparseLM requires the Jacobian matrix of $$\mathbf{H}(\mathbf{x})$$ with respect to $$\mathbf{x}$$. The speciality of the LM implementation in sparseLM is, that the Jacobian matrix is sparse, i.e. most of its elements are always zero. The sparse Jacobian can be provided to pysparseLM in different ways:

• sparse matrix in CSC format
• sparse matrix in CSR format
• Sparsity pattern (indices of non-zero elements) in triple format and the values of the non-zero elements separately. In this case the Jacobian function has to return the values of the non-zero elements in the same order in which its indices are saved.
• Only sparsity pattern are provided. In this case the values of the non-zero elements are approximated by finite difference (not recommended!)