R9484/6b34fa15936cmaster
R9484/
6b34fa15936cmaster
README.md
README.md
SP4E Homeworks
Students:
- Lars B.
- Bertil T.
In this repository, we will keep all homeworks for SP4E
Homework 1
See folder named *hw1-conjugate-gradient*.
- Requirements
- Numpy
- Scipy
- Matplotlib
- Argparse
The code as been tested with Python 3.
Usage
Run the *main_minimize.py* with the following arguments:
- -A < matrix elements in row major order >
- -b < vector elements >
- -x0 < initial guess elements >
- -method < CG-scipy or CG-ours >
- -plot < True or False >
Example
The following command will run the program with the coefficients given in Exercise 1:
python3 main_minimize.py -A 8 0 2 6 -b 0 1 -x0 4 4 -method CG-scipy -plot True
NB: Note that A must be s.p.d. in order for the conjugate gradient method to correctly solve Ax=b. Thus, the matrix A in Exercise 1 should not be used to compare the scipy version (CG-scipy) againts our version (CG-ours).
c4science · Help