Skip to content
Permalink
Browse files

inject properties at the base, add a wrapped BiCG solver

  • Loading branch information...
lheagy committed Feb 15, 2018
1 parent e5d2619 commit f77695359c7b71d63166080b275acd3e8860ebcc
Showing with 17 additions and 5 deletions.
  1. +1 −0 pymatsolver/__init__.py
  2. +12 −4 pymatsolver/solvers.py
  3. +2 −0 pymatsolver/wrappers.py
  4. +2 −1 setup.py
@@ -10,6 +10,7 @@
from pymatsolver.wrappers import Solver
from pymatsolver.wrappers import SolverLU
from pymatsolver.wrappers import SolverCG
from pymatsolver.wrappers import SolverBiCG

from pymatsolver.iterative import BicgJacobi

@@ -4,9 +4,20 @@
from __future__ import absolute_import

import numpy as np
import properties


class Base(object):
class Base(properties.HasProperties):

check_accuracy = properties.Bool(
"check the accuracy of the solve?",
default = False
)

accuracy_tol = properties.Float(
"tolerance on the accuracy of the solver",
default=1e-6
)

def __init__(self, A):
self.A = A.tocsr()
@@ -41,9 +52,6 @@ def T(self):
newS = self._transposeClass(self.A.T)
return newS

check_accuracy = False
accuracy_tol = 1e-6

def _compute_accuracy(self, rhs, x):
nrm = np.linalg.norm(np.ravel(self.A*x - rhs), np.inf)
nrm_rhs = np.linalg.norm(np.ravel(rhs), np.inf)
@@ -120,3 +120,5 @@ def _solveM(self, rhs):
Solver = WrapDirect(linalg.spsolve, factorize=False, name="Solver")
SolverLU = WrapDirect(linalg.splu, factorize=True, name="SolverLU")
SolverCG = WrapIterative(linalg.cg, name="SolverCG")
SolverBiCG = WrapIterative(linalg.bicgstab, name="SolverBiCG")

@@ -34,7 +34,8 @@
install_requires=[
'numpy>=1.7',
'scipy>=0.13',
'pyMKL>=0.0.3'
'pyMKL>=0.0.3',
'properties'
],
author="Rowan Cockett",
author_email="rowanc1@gmail.com",

0 comments on commit f776953

Please sign in to comment.
You can’t perform that action at this time.