Convert Msor To Sor -
Set all ( \omega_i ) in your code to this single ( \omega ). The algorithm becomes: [ x_i^(k+1) = (1 - \omega) x_i^(k) + \frac\omegaa_ii \left( b_i - \sum_j < i a_ij x_j^(k+1) - \sum_j > i a_ij x_j^(k) \right) ]
[ x_i^(k+1) = (1 - \omega) x_i^(k) + \frac\omegaa_ii \left( b_i - \sum_j < i a_ij x_j^(k+1) - \sum_j > i a_ij x_j^(k) \right) ] convert msor to sor
You can take the average: [ \omega = \frac1n \sum_i=1^n \omega_i ] Or use the spectral radius-minimizing value for the matrix at hand. Set all ( \omega_i ) in your code to this single ( \omega )
if i % 2 == 0: omega = omega_even else: omega = omega_odd Convert to: i a_ij x_j^(k+1) - \sum_j >
Or in matrix form: [ (D - \omega L) x^(k+1) = \omega b + \left[(1 - \omega) D + \omega U \right] x^(k) ] MSOR (Modified SOR) is a generalization where different relaxation parameters are used for different equations or different groups of variables.