def step_bicg(addeval, addeval_trans, matrix, b: 'vec.AVector', x: 'vec.AVector', r: 'vec.AVector', rt: 'vec.AVector', p: 'vec.AVector', pt: 'vec.AVector', a: 'vec.AVector', at: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) caddevaltrans = libkrylov.CFuncAddevalT(addeval_trans) cmatrix = matrix.as_voidp() libkrylov.step_bicg(caddeval, caddevaltrans, cmatrix, b, x, r, rt, p, pt, a, at)
def finish_gmres(addeval, matrix, b: 'vec.AVector', x: 'vec.AVector', rhat: 'vec.AVector', q: 'vec.AVector', kk: List[int], qr: 'mat.AMatrix', tau: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() ckk = pylist_to_ptr(kk, c_uint) libkrylov.finish_gmres(caddeval, cmatrix, b, x, rhat, q, ckk, qr, tau)
def step_pcg(addeval, matrix, prcd, pdata, b: 'vec.AVector', x: 'vec.AVector', r: 'vec.AVector', q: 'vec.AVector', p: 'vec.AVector', a: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() cprcd = libkrylov.CFuncPrcdT(prcd) cpdata = cast(pdata, c_void_p) libkrylov.step_pcg(caddeval, cmatrix, cprcd, cpdata, b, x, r, q, p, a)
def solve_pcg_avector(a, addeval, prcd, pdata, b: 'vec.AVector', x: 'vec.AVector', eps: float, maxiter: int) -> int: ca = a.as_voidp() caddeval = libkrylov.CFuncAddevalT(addeval) cprcd = libkrylov.CFuncPrcdT(prcd) cpdata = cast(pdata, c_void_p) return libkrylovsolvers.solve_pcg_avector(ca, caddeval, cprcd, cpdata, b, x, eps, maxiter)
def finish_pgmres(addeval, matrix, prcd, pdata, b: 'vec.AVector', x: 'vec.AVector', rhat: 'vec.AVector', q: 'vec.AVector', kk: List[int], qr: 'mat.AMatrix', tau: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() cprcd = libkrylov.CFuncPrcdT(prcd) cpdata = cast(pdata, c_void_p) ckk = pylist_to_ptr(kk, c_uint) libkrylov.finish_pgmres(caddeval, cmatrix, cprcd, cpdata, b, x, rhat, q, ckk, qr, tau)
def evalfunctional_cg(addeval, matrix, b: 'vec.AVector', x: 'vec.AVector', r: 'vec.AVector') -> float: caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() return libkrylov.evalfunctional_cg(caddeval, cmatrix, b, x, r)
def step_cg(addeval, matrix, b: 'vec.AVector', x: 'vec.AVector', r: 'vec.AVector', p: 'vec.AVector', a: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() libkrylov.step_cg(caddeval, cmatrix, b, x, r, p, a)
def step_bicgstab(addeval, matrix, b: 'vec.AVector', x: 'vec.AVector', r: 'vec.AVector', rt: 'vec.AVector', p: 'vec.AVector', a: 'vec.AVector', at: 'vec.AVector'): caddeval = libkrylov.CFuncAddevalT(addeval) cmatrix = matrix.as_voidp() libkrylov.step_bicgstab(caddeval, cmatrix, b, x, r, rt, p, a, at)
def solve_gmres_avector(a, addeval, b: 'vec.AVector', x: 'vec.AVector', eps: float, maxiter: int, kmax: int) -> int: ca = a.as_voidp() caddeval = libkrylov.CFuncAddevalT(addeval) return libkrylovsolvers.solve_gmres_avector(ca, caddeval, b, x, eps, maxiter, kmax)