makecd scripts
bsub < submit.shOperational
matrix_modules/matrix_operations.h- Matrix operation declarationsmatrix_modules/matrix_operations.cpp- Matrix operation implementationsmatrix_modules/verify_positive_definite_matrix.h- Matrix verification declarationsmatrix_modules/verify_positive_definite_matrix.cpp- Matrix verification implementations
LUP/LUP_solver.h- LUP decomposition method declarationsLUP/LUP_main.cpp- LUP solver implementationLUP/substitution.cpp- Forward and back substitution implementationsPI/power_iterations.h- Power Iterations method declarationsPI/power_iterations.cpp- Power Iterations method implementationII/inverse_iterations.h- Inverse Iteration method declarationsII/inverse_iterations.cpp- Inverse Iteration method implementation
main.cpp- Main program for solving individual systems
This program implements and compares several methods:
- LUP (Lower-Upper decomposition with Pivoting) - direct method for linear systems
- SOR (Successive Over-Relaxation) - iterative method for linear systems
- CG (Conjugate Gradient) - iterative method for linear systems
- PCG (Preconditioned Conjugate Gradient) - iterative method with Jacobi preconditioner for linear systems
- Power Iterations - iterative method for computing the dominant eigenvector and eigenvalue
- Inverse Iteration - iterative method for computing an eigenvector close to a specified eigenvalue
- Input for main solver is read from
input.txt - Format for Inverse Iteration (flag 6):
- Line 1: Flag (6 for Inverse Iteration) and approximate eigenvalue λ
- Line 2: Stopping criterion epsilon, maximum iterations
- Line 3: Matrix order n
- Next n lines: Elements of the n×n matrix A
- Last line: n elements of the initial guess vector
- Main solver output is written to
output.txt - Includes:
- Header with problem description
- Echo of input data
- Solution information (iterations, residuals/errors)
- For Power Iterations and Inverse Iteration:
- Computed eigenvector
- Computed eigenvalue
- Residual vector and its infinity norm
- Execution time
- Computes an eigenvector and eigenvalue near a specified shift λ
- Utilizes the LUP factorization from Lab 5 to factorize (A - λI)
- Reuses the same factorization for each iteration to solve linear systems efficiently
- Algorithm steps:
- Create shifted matrix (A - λI)
- Perform LUP factorization once at the beginning
- Initialize with user-provided initial guess vector
- Normalize using the L-infinity norm
- Iterate: solve (A - λI)y = x_{k-1} using the LUP factorization
- Normalize the result and compute eigenvalue using Rayleigh Quotient
- Check convergence on both eigenvector and eigenvalue
- Compute residual vector ρ = A·x - λ·x and its infinity norm
- Reports the eigenvalue of the original matrix A, not of the shifted matrix