<s> import numpy as np <EOL> import scipy . sparse as sp <EOL> import unittest <EOL> import matplotlib . pyplot as plt <EOL> from SimPEG import * <EOL> MESHTYPES = [ '<STR_LIT>' ] <EOL> class Test1D_InhomogeneousDirichlet ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:1> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> , <NUM_LIT:64> , <NUM_LIT> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . cos ( np . pi * x ) <EOL> j_fun = lambda x : - np . pi * np . sin ( np . pi * x ) <EOL> q_fun = lambda x : - ( np . pi ** <NUM_LIT:2> ) * np . cos ( np . pi * x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> j_ana = j_fun ( self . M . gridFx ) <EOL> vec = self . M . vectorCCx <EOL> phi_bc = phi ( vec [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> j_bc = j_fun ( vec [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> P , Pin , Pout = self . M . getBCProjWF ( [ [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> V = Utils . sdiag ( self . M . vol ) <EOL> G = - Pin . T * Pin * self . M . faceDiv . T * V <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * phi_bc ) <EOL> q = V * D * Pin . T * Pin * j + V * D * Pout . T * j_bc <EOL> A = V * D * Pin . T * Pin * McI * G <EOL> rhs = V * q_ana - V * D * Pin . T * Pin * McI * P * phi_bc - V * D * Pout . T * j_bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( j - j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - V * q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> solver = SolverCG ( A , maxiter = <NUM_LIT:1000> ) <EOL> xc = solver * ( rhs ) <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc = Solver ( A ) * ( rhs ) <EOL> print np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> j = McI * ( G * xc + P * phi_bc ) <EOL> err = np . linalg . norm ( ( j - j_ana ) , np . inf ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderX ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> class Test2D_InhomogeneousDirichlet ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:2> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . cos ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . cos ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funX = lambda x : - np . pi * np . sin ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . cos ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funY = lambda x : - np . pi * np . cos ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . sin ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> q_fun = lambda x : - <NUM_LIT:2> * ( np . pi ** <NUM_LIT:2> ) * phi ( x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> jX_ana = j_funX ( self . M . gridFx ) <EOL> jY_ana = j_funY ( self . M . gridFy ) <EOL> j_ana = np . r_ [ jX_ana , jY_ana ] <EOL> fxm , fxp , fym , fyp = self . M . cellBoundaryInd <EOL> gBFx = self . M . gridCC [ ( fxm | fxp ) , : ] <EOL> gBFy = self . M . gridCC [ ( fym | fyp ) , : ] <EOL> bc = phi ( np . r_ [ gBFx , gBFy ] ) <EOL> P , Pin , Pout = self . M . getBCProjWF ( '<STR_LIT>' ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> G = - self . M . faceDiv . T * Utils . sdiag ( self . M . vol ) <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * bc ) <EOL> q = D * j <EOL> A = D * McI * G <EOL> rhs = q_ana - D * McI * P * bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( j - j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc = Solver ( A ) * ( rhs ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc = Solver ( A ) * ( rhs ) <EOL> j = McI * ( G * xc + P * bc ) <EOL> err = np . linalg . norm ( ( j - j_ana ) , np . inf ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderX ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> class Test1D_InhomogeneousNeumann ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:1> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> , <NUM_LIT:64> , <NUM_LIT> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . sin ( np . pi * x ) <EOL> j_fun = lambda x : np . pi * np . cos ( np . pi * x ) <EOL> q_fun = lambda x : - ( np . pi ** <NUM_LIT:2> ) * np . sin ( np . pi * x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> j_ana = j_fun ( self . M . gridFx ) <EOL> vecN = self . M . vectorNx <EOL> vecC = self . M . vectorCCx <EOL> phi_bc = phi ( vecC [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> j_bc = j_fun ( vecN [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> P , Pin , Pout = self . M . getBCProjWF ( [ [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> V = Utils . sdiag ( self . M . vol ) <EOL> G = - Pin . T * Pin * self . M . faceDiv . T * V <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * phi_bc ) <EOL> q = V * D * Pin . T * Pin * j + V * D * Pout . T * j_bc <EOL> A = V * D * Pin . T * Pin * McI * G <EOL> rhs = V * q_ana - V * D * Pin . T * Pin * McI * P * phi_bc - V * D * Pout . T * j_bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - V * q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> j = McI * ( G * xc + P * phi_bc ) <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> class Test2D_InhomogeneousNeumann ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:2> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . sin ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . sin ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funX = lambda x : np . pi * np . cos ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . sin ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funY = lambda x : np . pi * np . sin ( np . pi * x [ : , <NUM_LIT:0> ] ) * np . cos ( np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> q_fun = lambda x : - <NUM_LIT:2> * ( np . pi ** <NUM_LIT:2> ) * phi ( x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> jX_ana = j_funX ( self . M . gridFx ) <EOL> jY_ana = j_funY ( self . M . gridFy ) <EOL> j_ana = np . r_ [ jX_ana , jY_ana ] <EOL> cxm , cxp , cym , cyp = self . M . cellBoundaryInd <EOL> fxm , fxp , fym , fyp = self . M . faceBoundaryInd <EOL> gBFx = self . M . gridFx [ ( fxm | fxp ) , : ] <EOL> gBFy = self . M . gridFy [ ( fym | fyp ) , : ] <EOL> gBCx = self . M . gridCC [ ( cxm | cxp ) , : ] <EOL> gBCy = self . M . gridCC [ ( cym | cyp ) , : ] <EOL> phi_bc = phi ( np . r_ [ gBFx , gBFy ] ) <EOL> j_bc = np . r_ [ j_funX ( gBFx ) , j_funY ( gBFy ) ] <EOL> P , Pin , Pout = self . M . getBCProjWF ( '<STR_LIT>' ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> V = Utils . sdiag ( self . M . vol ) <EOL> G = - Pin . T * Pin * self . M . faceDiv . T * V <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * phi_bc ) <EOL> q = V * D * Pin . T * Pin * j + V * D * Pout . T * j_bc <EOL> A = V * D * Pin . T * Pin * McI * G <EOL> rhs = V * q_ana - V * D * Pin . T * Pin * McI * P * phi_bc - V * D * Pout . T * j_bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - V * q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> j = McI * ( G * xc + P * phi_bc ) <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> class Test1D_InhomogeneousMixed ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:1> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> , <NUM_LIT:32> , <NUM_LIT:64> , <NUM_LIT> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . cos ( <NUM_LIT:0.5> * np . pi * x ) <EOL> j_fun = lambda x : - <NUM_LIT:0.5> * np . pi * np . sin ( <NUM_LIT:0.5> * np . pi * x ) <EOL> q_fun = lambda x : - <NUM_LIT> * ( np . pi ** <NUM_LIT:2> ) * np . cos ( <NUM_LIT:0.5> * np . pi * x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> j_ana = j_fun ( self . M . gridFx ) <EOL> vecN = self . M . vectorNx <EOL> vecC = self . M . vectorCCx <EOL> phi_bc = phi ( vecC [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> j_bc = j_fun ( vecN [ [ <NUM_LIT:0> , - <NUM_LIT:1> ] ] ) <EOL> P , Pin , Pout = self . M . getBCProjWF ( [ [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> V = Utils . sdiag ( self . M . vol ) <EOL> G = - Pin . T * Pin * self . M . faceDiv . T * V <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * phi_bc ) <EOL> q = V * D * Pin . T * Pin * j + V * D * Pout . T * j_bc <EOL> A = V * D * Pin . T * Pin * McI * G <EOL> rhs = V * q_ana - V * D * Pin . T * Pin * McI * P * phi_bc - V * D * Pout . T * j_bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - V * q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> j = McI * ( G * xc + P * phi_bc ) <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> class Test2D_InhomogeneousMixed ( Tests . OrderTest ) : <EOL> name = "<STR_LIT>" <EOL> meshTypes = MESHTYPES <EOL> meshDimension = <NUM_LIT:2> <EOL> expectedOrders = <NUM_LIT:2> <EOL> meshSizes = [ <NUM_LIT:2> , <NUM_LIT:4> , <NUM_LIT:8> , <NUM_LIT:16> ] <EOL> def getError ( self ) : <EOL> phi = lambda x : np . cos ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:0> ] ) * np . cos ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funX = lambda x : - <NUM_LIT:0.5> * np . pi * np . sin ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:0> ] ) * np . cos ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> j_funY = lambda x : - <NUM_LIT:0.5> * np . pi * np . cos ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:0> ] ) * np . sin ( <NUM_LIT:0.5> * np . pi * x [ : , <NUM_LIT:1> ] ) <EOL> q_fun = lambda x : - <NUM_LIT:2> * ( ( <NUM_LIT:0.5> * np . pi ) ** <NUM_LIT:2> ) * phi ( x ) <EOL> xc_ana = phi ( self . M . gridCC ) <EOL> q_ana = q_fun ( self . M . gridCC ) <EOL> jX_ana = j_funX ( self . M . gridFx ) <EOL> jY_ana = j_funY ( self . M . gridFy ) <EOL> j_ana = np . r_ [ jX_ana , jY_ana ] <EOL> cxm , cxp , cym , cyp = self . M . cellBoundaryInd <EOL> fxm , fxp , fym , fyp = self . M . faceBoundaryInd <EOL> gBFx = self . M . gridFx [ ( fxm | fxp ) , : ] <EOL> gBFy = self . M . gridFy [ ( fym | fyp ) , : ] <EOL> gBCx = self . M . gridCC [ ( cxm | cxp ) , : ] <EOL> gBCy = self . M . gridCC [ ( cym | cyp ) , : ] <EOL> phi_bc = phi ( np . r_ [ gBCx , gBCy ] ) <EOL> j_bc = np . r_ [ j_funX ( gBFx ) , j_funY ( gBFy ) ] <EOL> P , Pin , Pout = self . M . getBCProjWF ( [ [ '<STR_LIT>' , '<STR_LIT>' ] , [ '<STR_LIT>' , '<STR_LIT>' ] ] ) <EOL> Mc = self . M . getFaceInnerProduct ( ) <EOL> McI = Utils . sdInv ( self . M . getFaceInnerProduct ( ) ) <EOL> V = Utils . sdiag ( self . M . vol ) <EOL> G = - Pin . T * Pin * self . M . faceDiv . T * V <EOL> D = self . M . faceDiv <EOL> j = McI * ( G * xc_ana + P * phi_bc ) <EOL> q = V * D * Pin . T * Pin * j + V * D * Pout . T * j_bc <EOL> A = V * D * Pin . T * Pin * McI * G <EOL> rhs = V * q_ana - V * D * Pin . T * Pin * McI * P * phi_bc - V * D * Pout . T * j_bc <EOL> if self . myTest == '<STR_LIT>' : <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT:q>' : <EOL> err = np . linalg . norm ( ( q - V * q_ana ) , np . inf ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> err = np . linalg . norm ( ( xc - xc_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> elif self . myTest == '<STR_LIT>' : <EOL> xc , info = sp . linalg . minres ( A , rhs , tol = <NUM_LIT> ) <EOL> j = McI * ( G * xc + P * phi_bc ) <EOL> err = np . linalg . norm ( ( Pin * j - Pin * j_ana ) , np . inf ) <EOL> if info > <NUM_LIT:0> : <EOL> print '<STR_LIT>' <EOL> print '<STR_LIT>' , np . linalg . norm ( Utils . mkvc ( A * xc ) - rhs ) <EOL> return err <EOL> def test_orderJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> def test_orderQ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT:q>' <EOL> self . orderTest ( ) <EOL> def test_orderXJ ( self ) : <EOL> self . name = "<STR_LIT>" <EOL> self . myTest = '<STR_LIT>' <EOL> self . orderTest ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
