Skip to main content
`Ctrl`+`K`

# KSPCGLS

Conjugate Gradient method for Least-Squares problems. Supports non-square (rectangular) matrices.

## Note

This does not use the preconditioner, so one should probably use `KSPLSQR` instead.

See `PETSCREGRESSORLINEAR` for a general toolkit for linear regression, include least squares.

## See Also

KSP: Linear System Solvers, `KSPLSQR`, `KSPCreate()`, `KSPSetType()`, `KSPType`, `KSP`, `KSPCGSetType()`, `KSPCGUseSingleReduction()`, `KSPPIPECG`, `KSPGROPPCG`, `PETSCREGRESSORLINEAR`

## Level

beginner

## Location

src/ksp/ksp/impls/cg/cgls.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages