/[escript]/trunk/escript/test/python/test_util_reduction_no_tagged_data.py
ViewVC logotype

Diff of /trunk/escript/test/python/test_util_reduction_no_tagged_data.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2768 by jfenwick, Fri Aug 21 06:30:25 2009 UTC revision 2769 by jfenwick, Tue Nov 24 00:36:22 2009 UTC
# Line 366  class Test_util_reduction_no_tagged_data Line 366  class Test_util_reduction_no_tagged_data
366        res=inf(arg)        res=inf(arg)
367        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
368        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
369          
370     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
371     def test_inf_constData_rank4(self):     def test_inf_constData_rank4(self):
372        arg=Data(numpy.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace)        arg=Data(numpy.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0.73651436499107814]]]]),self.functionspace)
# Line 373  class Test_util_reduction_no_tagged_data Line 374  class Test_util_reduction_no_tagged_data
374        res=inf(arg)        res=inf(arg)
375        self.failUnless(isinstance(res,float),"wrong type of result.")        self.failUnless(isinstance(res,float),"wrong type of result.")
376        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")        self.failUnless(abs(res-ref)<=self.RES_TOL*abs(ref),"wrong result")
377          
378       def test_NaNReduction_constData_rank4(self):
379        arg=Data(numpy.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0]]]]),self.functionspace)
380        if getEscriptParamInt('NAN_CHECK')==1:
381            arg=1/arg   #will get us an inf
382            arg=arg/arg #will give a NaN in the last position, yes we could have just sqrt(arg) but I wanted last pos
383            self.failUnless(numpy.isnan(sup(arg)),"wrong result")
384            self.failUnless(numpy.isnan(inf(arg)),"wrong result")
385            self.failUnless(numpy.isnan(Lsup(arg)),"wrong result")      
386            
387    
388       def test_NaNReduction_expandedData_rank4(self):
389        arg=Data(numpy.array([[[[0.50544713768476202, 0.96922321849050874, -0.81524480218696649, -0.36499730379849193], [-0.48131882706974372, 0.026812357207576465, 0.090903267401989618, -0.24742363369877829], [-0.51631372893805438, 0.30410275437953183, -0.75149566289642533, -0.19930300338453599]], [[0.82034878499482788, -0.70904661587698792, -0.27637223434426073, -0.34818734117560401], [0.11686048779802416, -0.76746266142163178, -0.75578186306174833, 0.14509316330390232], [0.1590050723141736, 0.69684384552537937, -0.58747105640080832, -0.28640840371441523]]], [[[0.14956532194045669, 0.081514192262221119, 0.32061383569406399, -0.2444346881437609], [0.79564139071785278, -0.5456680167461434, 0.24722978802719742, 0.28286130725068315], [0.10385207763921711, -0.064749181840278336, 0.21325254547672734, -0.71875644540473838]], [[0.58552496009870802, 0.35472373485671338, -0.18411162994671826, 0.71609038134967773], [-0.20966804574945064, -0.49286619989346314, 0.85116051808632553, -0.94417114370961075], [-0.40434528979823714, 0.62250343758157611, 0.64860074098639742, 0.0043146814280992096]]], [[[-0.14242849200713259, 0.42551908502898095, 0.7691157770973962, -0.37595641162856674], [0.026655444032149589, -0.82186407521644167, 0.40285091480648783, -0.53328831035315982], [-0.12887729257054481, 0.75610663428133451, 0.022049613835531723, 0.59949338706293043]], [[-0.34506254315071772, 0.019719877473602043, 0.10216765908478709, 0.022681548062032153], [0.2228614880408597, 0.26944547311401901, -0.10122095357202965, -0.51019076850180589], [-0.081439546799124463, 0.18829632566943544, 0.12366885442775377, 0]]]]),self.functionspace, True)
390        if getEscriptParamInt('NAN_CHECK')==1:
391            arg=1/arg   #will get us an inf
392            arg=arg/arg #will give a NaN in the last position, yes we could have just sqrt(arg) but I wanted last pos
393            self.failUnless(numpy.isnan(sup(arg)),"wrong result")
394            self.failUnless(numpy.isnan(inf(arg)),"wrong result")
395            self.failUnless(numpy.isnan(Lsup(arg)),"wrong result")  
396          
397          
398     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++     #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
399     def test_inf_expandedData_rank0(self):     def test_inf_expandedData_rank0(self):
400    

Legend:
Removed from v.2768  
changed lines
  Added in v.2769

  ViewVC Help
Powered by ViewVC 1.1.26