コード例 #1
0
ファイル: testLinAlgSolve.py プロジェクト: ericangle/esPic
  def testCase(A,x,B):
    x_Jacobi             = linAlgSolve.jacobi(A,B,relTol,absTol)
    x_Jacobi_Cython      = linAlgSolveCy.jacobi(A,B,relTol,absTol)
    x_GaussSeidel        = linAlgSolve.gaussSeidel(A,B,relTol,absTol)
    x_GaussSeidel_Cython = linAlgSolveCy.gaussSeidel(A,B,relTol,absTol)
    x_Direct             = linAlgSolve.direct(A,B)
    x_Direct_Cython      = linAlgSolveCy.direct(A,B)

    allTests = [ x_Jacobi,      x_Jacobi_Cython, \
                 x_GaussSeidel, x_GaussSeidel_Cython, \
                 x_Direct,      x_Direct_Cython ]

    for aTest in allTests:
       test(aTest,x)
コード例 #2
0
    def testCase(A, x, B):
        x_Jacobi = linAlgSolve.jacobi(A, B, relTol, absTol)
        x_Jacobi_Cython = linAlgSolveCy.jacobi(A, B, relTol, absTol)
        x_GaussSeidel = linAlgSolve.gaussSeidel(A, B, relTol, absTol)
        x_GaussSeidel_Cython = linAlgSolveCy.gaussSeidel(A, B, relTol, absTol)
        x_Direct = linAlgSolve.direct(A, B)
        x_Direct_Cython = linAlgSolveCy.direct(A, B)

        allTests = [ x_Jacobi,      x_Jacobi_Cython, \
                     x_GaussSeidel, x_GaussSeidel_Cython, \
                     x_Direct,      x_Direct_Cython ]

        for aTest in allTests:
            test(aTest, x)
コード例 #3
0
ファイル: esSolve.py プロジェクト: ericangle/esPic
def solveLinearSystem(M, B, solType, relTol, absTol, useCython=True):
    if solType == "direct":
        if useCython:
            x = linAlgSolveCy.direct(M, B)
        else:
            x = linAlgSolve.direct(M, B)
    elif solType == "jacobi":
        if useCython:
            x = linAlgSolveCy.jacobi(M, B, relTol, absTol)
        else:
            x = linAlgSolve.jacobi(M, B, relTol, absTol)
    elif solType == "gaussSeidel":
        if useCython:
            x = linAlgSolveCy.gaussSeidel(M, B, relTol, absTol)
        else:
            x = linAlgSolve.gaussSeidel(M, B, relTol, absTol)
    else:
        sys.exit("esSolve::solveLinearSystem() -- invalid solution type")

    return x
コード例 #4
0
ファイル: esSolve.py プロジェクト: ericangle/esPic
def solveLinearSystem(M,B,solType,relTol,absTol,useCython=True):
  if solType == "direct":
    if useCython:
      x = linAlgSolveCy.direct(M,B)
    else:
      x = linAlgSolve.direct(M,B)
  elif solType == "jacobi":
    if useCython:
      x = linAlgSolveCy.jacobi(M,B,relTol,absTol)
    else:
      x = linAlgSolve.jacobi(M,B,relTol,absTol)
  elif solType == "gaussSeidel":
    if useCython:
      x = linAlgSolveCy.gaussSeidel(M,B,relTol,absTol)
    else:
      x = linAlgSolve.gaussSeidel(M,B,relTol,absTol)
  else:
    sys.exit("esSolve::solveLinearSystem() -- invalid solution type")

  return x