def norm2diff_id_matrix(mvma, a, solveb, solvetransb, b, rows: int, cols: int) -> float: cmvma = libkrylov.CFuncMvmT(mvma) ca = a.as_voidp() csolveb = libkrylov.CFuncPrcdT(solveb) csolvetransb = libkrylov.CFuncPrcdT(solvetransb) cb = b.as_voidp() return libkrylov.norm2diff_id_pre_matrix(cmvma, ca, csolveb, csolvetransb, cb, rows, cols)
def norm2diff_pre_matrix(mvma, a, evalb, evaltransb, b, rows: int, cols: int) -> float: cmvma = libkrylov.CFuncMvmT(mvma) ca = a.as_voidp() cevalb = libkrylov.CFuncPrcdT(evalb) cevaltransb = libkrylov.CFuncPrcdT(evaltransb) cb = b.as_voidp() return libkrylov.norm2diff_pre_matrix(cmvma, ca, cevalb, cevaltransb, cb, rows, cols)
def step_uzawa(solve_a11, matrix_a11, mvm_a21, matrix_a21, b1: 'vec.AVector', b2: 'vec.AVector', x1: 'vec.AVector', x2: 'vec.AVector', r2: 'vec.AVector', p2: 'vec.AVector', a1: 'vec.AVector', s2: 'vec.AVector'): csolvea11 = libkrylov.CFuncPrcdT(solve_a11) cmatrixa11 = matrix_a11.as_voidp() cmvma21 = libkrylov.CFuncMvmT(mvm_a21) cmatrixa21 = matrix_a21.as_voidp() libkrylov.step_uzawa(csolvea11, cmatrixa11, cmvma21, cmatrixa21, b1, b2, x1, x2, r2, p2, a1, s2)
def step_puzawa(solve_a11, matrix_a11, mvm_a21, matrix_a21, prcd, pdata, b1: 'vec.AVector', b2: 'vec.AVector', x1: 'vec.AVector', x2: 'vec.AVector', r2: 'vec.AVector', q2: 'vec.AVector', p2: 'vec.AVector', a1: 'vec.AVector', s2: 'vec.AVector'): csolvea11 = libkrylov.CFuncPrcdT(solve_a11) cmatrixa11 = matrix_a11.as_voidp() cmvma21 = libkrylov.CFuncMvmT(mvm_a21) cmatrixa21 = matrix_a21.as_voidp() cprcd = libkrylov.CFuncPrcdT(prcd) cpdata = cast(pdata, c_void_p) libkrylov.step_puzawa(csolvea11, cmatrixa11, cmvma21, cmatrixa21, cprcd, cpdata, b1, b2, x1, x2, r2, q2, p2, a1, s2)
def norm2_matrix(mvm, a, rows: int, cols: int) -> float: cmvm = libkrylov.CFuncMvmT(mvm) ca = cast(a, c_void_p) return libkrylov.norm2_matrix(cmvm, ca, rows, cols)
def norm2diff_matrix(mvma, a, mvmb, b, rows: int, cols: int) -> float: cmvma = libkrylov.CFuncMvmT(mvma) ca = a.as_voidp() cmvmb = libkrylov.CFuncMvmT(mvmb) cb = b.as_voidp() return libkrylov.norm2diff_matrix(cmvma, ca, cmvmb, cb, rows, cols)