Research Article
HotSpot Thermal Floorplan Solver Using Conjugate Gradient to Speed Up
Algorithm 1
: The conjugate gradient algorithm as an iterative method.
Require: f(x): objective function; x0: initial solution; | Ensure: optimal x | (1) | int Iter = 0; | (2) | double α, β, rp, rpold, bnorm, rnorm; | (3) | vector r, p, q, z; | (4) | initial r = b ? A ? x; | (5) | rnorm = (r,r); | (6) | while (rnorm < precision) do | (7) | if using preconditioned then | (8) | z = M−1r; (using difference preconditioned) | (9) | else | (10) | z = r; (no preconditioned) | (11) | end if | (12) | rp = (r,z); | (13) | if Iter == 1 then | (14) | p0 = z | (15) | else | (16) | β = rp/rpold; | (17) | p = z + β p | (18) | end if | (19) | q = A p; | (20) | α = (r,z)/(p,q); | (21) | x = x + α p; | (22) | r = r − α q; | (23) | rnorm = (r,r); | (24) | rpold = rp; | (25) | end while |
|