qimpy.algorithms.LinearSolve
- class LinearSolve(*, checkpoint_in, comm, n_iterations, gradient_threshold, name='')
Bases:
Generic[Vector],ABC,TreeNode- Parameters:
checkpoint_in (CheckpointPath)
comm (Comm)
n_iterations (int)
gradient_threshold (float)
name (str)
- __init__(*, checkpoint_in, comm, n_iterations, gradient_threshold, name='')
Initialize minimization algorithm parameters.
- Parameters:
checkpoint_in (CheckpointPath)
comm (MPI.Comm)
n_iterations (int)
gradient_threshold (float)
name (str)
- Return type:
None
Methods
Initialize minimization algorithm parameters.
add_childConstruct child object self.`attr_name` of type cls.
add_child_one_ofInvoke add_child on one of several child options in args.
Multiply by the hessian of the objective function.
Multiply by the preconditioner.
save_checkpointSave self and all children in hierarchy to cp_path.
Solve hessian`(`x) = rhs by the conjugate-gradients method.
Attributes
Communicator over which algorithm operates in unison
Maximum number of iterations
Convergence threshold on preconditioned residual norm
Line prefix in log for convergence progress; don't log if empty
child_namesNames of attributes with child objects.
variant_nameVersion of children having variants (if any)
- abstractmethod hessian(v)
Multiply by the hessian of the objective function. Derived classes must override this to specify the objective function.
- Parameters:
v (Vector)
- Return type:
Vector
- precondition(v)
Multiply by the preconditioner. Derived classes may override this to specify a preconditioner (defaullt: none).
- Parameters:
v (Vector)
- Return type:
Vector
- solve(rhs, x)
Solve hessian`(`x) = rhs by the conjugate-gradients method. Start from initial guess in x and return the result in place. Return the number of iterations taken to converge.
- comm: Comm
Communicator over which algorithm operates in unison
- gradient_threshold: float
Convergence threshold on preconditioned residual norm
- n_iterations: int
Maximum number of iterations
- name: str
Line prefix in log for convergence progress; don’t log if empty