r****y 发帖数: 1437 | 1
I think here is wrong. Should be
max[ abs [(new_value-old_value)/ old_value] ] < = 0.01
First, it is more routine to use old_value as denominator
rather than new value
Second, you cannot just abs(diff) then divided by denominator,
you must take absolute value of all of them
BTW, SOR is too slow and too sensitive to the relax factor
that you choose. Why | r****y 发帖数: 1437 | 2
呵呵, 那得看你处理的问题了. SOR 对松弛因子的响应是个很
尖锐的曲线, 所以有时候松弛因子差一点点, 要迭代的次数要增加很多.
有时候选择的不好, 比LU分解还来得慢慢(在矩阵不是很大的情况下).
现在比较流行的趋势是preconditioner 加CG, 比SOR还是有些
优势的. 不过话讲回来, 选择那种方法还是要根据系数矩阵的特点. 但
是其优点比SOR要明显得多. 比如, 对Toeplitz矩阵的circulant preconditioner,
整个解的过程中只需要构造circulant矩阵的第一列(circulant 轮换矩阵), 然后
用FFT, IFFT完成矩阵相乘的操作, 然后用CG算法. 这种preconditioner的好处
在于, 迭代所需次数很少, 而且几乎独立于矩阵的大小. 如果做一个12x12的矩阵用
6次, 那么做1200x1200的矩阵还是6-9次迭代就可以搞定. 比SOR优越得多.
当然, 要是不是对速度那么苛求的话, SOR编程最省心. :-) |
|