ConjugateGradient

org.appliedtopology.tda4j.ConjugateGradient

The conjugate gradient method for A x = b with A symmetric positive definite, given only as a function: the harmonic smoothing of CircularCoordinates solves a graph Laplacian system this way, never forming the matrix.

Attributes

Experimental
true
Source
ConjugateGradient.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

open class NotConvergedException(message: String) extends RuntimeException

The residual did not get small enough within the iteration limit.

The residual did not get small enough within the iteration limit.

Attributes

Source
ConjugateGradient.scala
Supertypes
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
open class NotSymmetricPositiveDefiniteException(message: String) extends IllegalArgumentException

Raised when checking is on and the operator is not symmetric, or has non-positive curvature.

Raised when checking is on and the operator is not symmetric, or has non-positive curvature.

Attributes

Source
ConjugateGradient.scala
Supertypes
class IllegalArgumentException
class RuntimeException
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

def solve(operator: DenseVector => DenseVector, b: DenseVector, maxIterations: Int = ..., tolerance: Double = ..., check: Boolean = ..., initial: Optional[DenseVector] = ...): DenseVector

The solution of operator(x) = b for a symmetric positive definite operator, stopping at the first iterate whose residual b - operator(x) has norm at most tolerance * |b|.

The solution of operator(x) = b for a symmetric positive definite operator, stopping at the first iterate whose residual b - operator(x) has norm at most tolerance * |b|.

With check on, the operator is tested for symmetry once (two extra applications: against for two fixed vectors) and every step for positive curvature (> 0); either failure raises NotSymmetricPositiveDefiniteException saying which. The tests catch an operator that is plainly not symmetric positive definite; they do not prove that it is. With check off a bad operator typically ends in NotConvergedException.

Value parameters

b

the right-hand side.

check

whether to test the operator as described above.

initial

where to start (default: the zero vector, which also saves the application of operator to it).

maxIterations

the most iterations to run; NotConvergedException if the tolerance is not reached by then. One iteration is one application of operator.

operator

x => A x, for the symmetric positive definite A of the system. It is given a fresh vector each time.

tolerance

relative residual to reach, |b - A x| <= tolerance * |b|.

Attributes

Source
ConjugateGradient.scala