public class ConjugateGradientEx1 extends Object implements ConjugateGradient.Function
Solves a positive definite linear system using the conjugate gradient method.
The solution to a positive definite linear system is found. The coefficient matrix is stored as a full matrix. The system is \(Ax = b\) where $$ A=\begin{bmatrix} 1.0 & -3.0 & 2.0 \\ -3.0 & 10.0 & -5.0 \\ 2.0 & -5.0 & 6.0 \end{bmatrix} $$and \( b = (27.0, -78.0, 64.0)^T\)
Constructor and Description |
---|
ConjugateGradientEx1() |
Modifier and Type | Method and Description |
---|---|
void |
amultp(double[] p,
double[] z)
A user-supplied function which computes z=Ap.
|
static void |
main(String[] args) |
public void amultp(double[] p, double[] z)
ConjugateGradient.Function
amultp
in interface ConjugateGradient.Function
p
- an input double
vector of length
dimension of A.z
- an output double
vector containing the
matrix-vector product Ap.Copyright © 2020 Rogue Wave Software. All rights reserved.