MP 2
MP 2
MP 2
A. PROBLEM DESCRIPTION
A set of matrix (Matrix B) was given to be evaluated using the Conjugate gradient
squared method and using the L1 norm exit criterion.The algorithm for this method
is as follows:
associated with
x0
. The formula is
r0
be equal to the
r 0=b A x 0
search direction
p0
r0
r kT rk
using the equation, k = p T A p
k
k
x k+1=x k + k p k
r k +1=r k k A p k
. If the value is
pk+1 =r k+1 + k p k
2. Wikimedia
Foundation,
Inc.,
"Conjugate
Gradient
https://en.wikipedia.org/wiki/Conjugate_gradient_method
3. Lecture Notes / C Code given by Dr. Arturo Cortes
Method".
D. RESULT
In executing the program, the matrix was not solved after250
iterationsand L1 norm is not applicable. This means the tolerance of
0.000001 was not met. This suggests that the assigned number of equation or n
is not sufficient, which convey a value of greater than 250.
The resulting matrixdesignated as x using n = 250 and L1 norm are
0.98746535 and 0.98506782respectively. The time elapsed to finish the
execution using mobile phone was approximately 5 sec.
Run window Output (Using L1 norm)
r 0=b A x 0
3.
r 0 =bA x 0
x0
p0=r 0
p0 =r 0
6. For
k =0,1, do
rk rk
1. Compute alpha, k = p k A p k
2. Compute next location,
3.
x k+1=x k + k p k
x k+1 =x k + k p k
r k +1=r k k A p k
5. r k +1 =r k k A p k
r k+1 r k+1
k=
rk r k
pk+1 =r k+1 + k p k
pk+1 =r k +1 + k p k
7. Finally, find
x k+1
. If the value is
8.
B. PROBLEMS ENCOUNTERED
In generating the code desired, the same challenge was experienced to
understand the difference between L1 norm and L2 norm. The prevailing norm for
this method was chosen to be L2.
Upon compiling the code, it was observed that the problem experience on CGS
method is the same for this method. The mobile phone and program used does not
display the complete list of iterations.
C. REFERENCES
1. Dongarra, J, Lumsdaine, A., Pozo, R. and Remington, K. " Iterative Methods
Library". http://math.nist.gov/iml++/.
2. Lecture Notes / C Code given by Dr. Arturo Cortes
3. Wikimedia
Foundation,
Inc.,
"Conjugate
Gradient
Method".
https://en.wikipedia.org/wiki/Biconjugate_gradient_method
D. RESULT
In executing the program, the matrix was solved after 129 iterations
using L2 norm exit criterion equal to 0.00000104.
The resulting matrix designated as x are 1.08421002 and
1.08430721respectively. The time elapsed to finish the execution using mobile
phone was approximately 2 sec.
Run window Output (Using L2 norm)
:56
, where
for
such that
and go to step 1.
B. PROBLEMS ENCOUNTERED
In generating the code,the challenge was how to convert the algorithm mentioned
above. However, upon compiling the code, it was observed that the iteration executes
but the values are not present. This means that the code still needs some
improvement.
C. REFERENCES
D. RESULT
In executing the program, the matrix was not solved due to incomplete
inputs on the code prepared. Further improvement should be done to get the
correct solution for this particular method.
Run window Output (Using L2 norm)
On the other hand, when L2 norm was used in the program, the program converged
after 69984 iterations with an accuracy of 0.00000100. This was performed in a
computer and took 16.828sec to converge. The value of x after n=250 is 0.980603.
Run window Output (Using L2 norm)