/[escript]/trunk/escriptcore/test/python/test_util_base.py
ViewVC logotype

Contents of /trunk/escriptcore/test/python/test_util_base.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6465 - (show annotations)
Wed Jan 11 01:28:23 2017 UTC (15 months, 1 week ago) by jfenwick
File MIME type: text/x-python
File size: 140974 byte(s)
Fix bug in get_tagged
Adding test for eigenvalues - not currently testing the scalar input case

1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2016 by The University of Queensland
5 # http://www.uq.edu.au
6 #
7 # Primary Business: Queensland, Australia
8 # Licensed under the Apache License, version 2.0
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 # Development 2012-2013 by School of Earth Sciences
13 # Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 #
15 ##############################################################################
16
17 from __future__ import print_function, division
18
19 __copyright__="""Copyright (c) 2003-2016 by The University of Queensland
20 http://www.uq.edu.au
21 Primary Business: Queensland, Australia"""
22 __license__="""Licensed under the Apache License, version 2.0
23 http://www.apache.org/licenses/LICENSE-2.0"""
24 __url__="https://launchpad.net/escript-finley"
25
26 """
27 basic tests for util.py
28
29 :remark: use see `test_util`
30
31 :var __author__: name of author
32 :var __copyright__: copyrights
33 :var __license__: licence agreement
34 :var __url__: url entry point on documentation
35 :var __version__: version
36 :var __date__: date of the version
37 """
38
39 __author__="Lutz Gross, l.gross@uq.edu.au"
40
41 import esys.escriptcore.utestselect as unittest
42 import numpy
43 import os
44 from esys.escript import *
45 from esys import escript
46
47 try:
48 ESCRIPT_WORKDIR=os.environ['ESCRIPT_WORKDIR']
49 except KeyError:
50 ESCRIPT_WORKDIR='.'
51
52
53 class Test_util_values(unittest.TestCase):
54 """
55 Please do not define tests in this class.
56 The idea is to make it easier to isolate groups of tests, which
57 will be harder if there are tests in the base class
58
59 Sets of values could be generated as follows:
60 def z2(levels, row):
61 if levels==1:
62 v=[]
63 for j in range(row):
64 v.append(random.triangular(-1., 1.0))
65 return tuple(v)
66 else:
67 v=[]
68 for j in range(row):
69 v.append(z2(levels-1,row))
70 return tuple(v)
71
72 z2(2,2)
73 z2(3,3)
74 z2(4,4)
75
76 However, some of the larger arrays are modified afterwards to ensure
77 that they contain at least one 0 for NaN checking purposes
78 """
79
80 RES_TOL=1.e-7 # RES_TOLerance to compare results
81 DIFF_TOL=1.e-7 # RES_TOLerance to derivatices
82
83
84 def get_scalar_inputL(self, cplx):
85 if not cplx:
86 v1=33489.58300735649
87 else:
88 v1=(9824.950442887115-46215.48181304759j)
89 return (v1,v1)
90
91 def get_python_inputL(self, rank, cplx):
92 if cplx:
93 if rank==0:
94 return (-3960.4642291825876+70893.2937559552j,)
95 if rank==1:
96 return ((59731.62346830329-82535.93558513945j), (97413.28611726397-71163.21858234056j))
97 if rank==2:
98 return (((22662.9306818+10450.1928396j), (-5876.588037489+31316.069231294925j)),
99 ((-48775.88574400305+21535.3746218j), (36479.6003269178-39287.306108j)))
100 if rank==3:
101 return ((((-50847.97960-9062.27j), (-63529.6088+55171.4663j), (215.4-10185.37j)),
102 ((40080.58380528418-34586.4289827135j), (-27276.009276950237-61855.16687539085j), (-34721.25780748475+82851.2788274762j)),
103 ((43010.5425+18456.0305j), (-8655.17674+4404.157j), (23658.850518231033-20372.09007648639j))),
104 (((43347.843141+58591.16j), (25836.3146-5995.971j), (-28969.5+31065.035j)),
105 ((-31942.46+61141.334j), (-84655.794+49812.188j), (63001.6-44321.65j)),
106 ((-19368.317+29114.8j), (-84938.09+83917.34j), (30356.3+48962.755j))),
107 (((-50756.5-28925.102j), (3348.16+79354.6j), (30159.52+6881.75j)),
108 ((59025.953-39.831j), (-237.942-53.93j), (9308.8+36247.003775959376j)),
109 ((12068.153033533716-68009.47095735556j), (7693.602018284684-23713.22567007532j), (44993.89718529736-3807.1609666917066j))))
110 if rank==4:
111 return (((((36743.82175242095+26778.737326529765j), (-29754.182129388544+25393.077634889414j), (-7835.209676340906+49819.26015705921j), (33964.789417447566-32778.45444590585j)),
112 ((-44579.370809357875-68703.24361188836j), (-149.28320431357133-64698.83715098185j), (38295.13314270778+58425.02740389345j), (-59088.20438563965-81586.99049191552j)),
113 ((22892.612062358283-24715.70868029048j), (13367.867311961876+20860.578306432217j), (-47859.40778589482+71392.8351064374j), (-2304.287041885458+49294.11306179231j)),
114 ((-62640.841478880255+36871.688232087705j), (10655.923749286507-23128.560897714342j), (-4131.801825297647+4443.2840182007785j), (-27903.670838787744-3117.482981970883j))),
115 (((57034.38962108706+38044.26403584313j), (-4462.844355084104+18211.587917962242j), (4313.178312608696-12868.233657189892j), (46374.72869675713-11812.40480331378j)),
116 ((322.189068738895+47179.67709271595j), (72322.13544947651-3662.5467369358375j), (-9231.467186395414+76230.40517770775j), (-41704.75682501451+32558.11893996234j)),
117 ((79487.23328596324-7366.42862253316j), (10481.924314965669-15120.283604848068j), (26960.83136881994-41071.566704782505j), (-24115.39190283895-7711.336401151741j)),
118 ((22474.95612418659+15623.165463453799j), (25929.087385707462+38175.58304877044j), (-8177.232611463696+21287.640323926986j), (34229.957465479616+34000.54107560321j))),
119 (((26772.169008338446-23226.644157592586j), (44355.462946645705+38435.617150983846j), (82270.23681598579+57228.460214922394j), (-61649.67759149854-29496.646828970726j)),
120 ((33208.12540969731-42543.11381431012j), (-37368.19634070844+36983.91078521421j), (-53479.67762639474+69192.57351520905j), (-16987.119998626833-24907.621827720854j)),
121 ((58265.74226484515+21428.598358311836j), (-25451.773790957814+34641.52936103524j), (49737.44278424142+46668.70872917027j), (-19763.07777821306-55742.60412333406j)),
122 ((39696.62704009203+11792.880723760507j), (45040.78931593459+1353.15524889082j), (38919.41458390256+5018.601358823813j), (24700.01773615746+18638.158415414437j))),
123 (((-27357.697301503198+67993.98776577965j), (43358.65691551873-60981.94828910699j), (-36961.845280498295+73544.32798356535j), (-7005.460088561973+56718.32085849555j)),
124 ((-45794.83454061549-24789.54243897248j), (-35553.771747041705+281.20812003471656j), (741.8214864204201-48926.27892674535j), (15258.748935604614+5750.3134710095765j)),
125 ((13578.214948777008+49023.37779316875j), (-52997.87500887418-28291.632747669166j), (34523.01328904568+70373.31760549065j), (-8549.195292188699+38710.00933198735j)),
126 ((-8724.746595711767+39671.57400059246j), (54220.76682697828+52787.45089736888j), (-2929.7928072663053-14645.947666259133j), (6967.3562262647465+20575.621108094565j)))),
127 ((((41255.3128726088-4735.07598620026j), (17330.015550087788+39190.403383224395j), (-2409.2939922655205+33755.22845153985j), (-84016.4244828014-28839.63999275923j)),
128 ((-7567.298951515288+24481.103774662595j), (-25149.082523503632-8583.669927251554j), (47788.23750305794+37492.05579481191j), (-19575.167208193656+21113.148224316566j)),
129 ((-8076.55304084401+75096.61990916729j), (42138.65038370111-27451.77036345769j), (17599.47893995483-6322.617589222951j), (43000.60101023788+54422.76834543564j)),
130 ((-24961.480874041634-2122.019874702237j), (6425.889470030932+5622.557974648473j), (-65254.39721134174+59644.00375157643j), (-26617.634404672892-53495.819302484895j))),
131 (((-54060.398876227686+55992.77686553825j), (-29817.626727209106-29704.79980981775j), (-6767.670138070098+10024.257522469488j), (-30133.80524111932+40328.89815642918j)),
132 ((50000.78584499907-5894.192721755971j), (-3021.8049413580593-70247.81603731646j), (695.299152508218+58895.55560166443j), (-16680.2648353032-87022.82137596376j)),
133 ((14249.594063942364-1274.074993916045j), (12234.307608613788-18357.139710977237j), (32290.96562094186+38793.36224883628j), (67656.21258170376-9760.573070193976j)),
134 ((-45601.023706816115-74319.21757213926j), (55876.22452146437-61120.98256716965j), (58027.41230717529+10786.688485100865j), (-3495.6762613661413-46756.553429873304j))),
135 (((92894.48804954227+23902.59394418483j), (1353.988548653011-92567.68243719656j), (65397.064463537616+10248.124624835778j), (567.8160836168245+78786.59184031615j)),
136 ((-40282.49291521364+79825.32258981027j), (-40310.88688269715+455.4179428850184j), (-11166.391823961778+2764.918200738073j), (78697.6368921528-685.3372273494751j)),
137 ((70892.98538412598+78843.94735644812j), (-64882.52692417733+80256.3932249126j), (26045.841803168907-12175.162753092736j), (-58159.5440761434-67887.15729778618j)),
138 ((8775.14598500292+16795.25423101084j), (13155.934674011907+16737.126752117358j), (15975.852541323125+14513.776915618466j), (-25215.109458495746+8530.276446405784j))),
139 (((25795.767870170166-31056.851297134257j), (4037.894742402088-83.2035600123636j), (-19413.455650262404+40693.39115961014j), (-63145.75424957367+34735.00168222326j)),
140 ((17181.9690394505+18815.796074907106j), (45370.782381827026+55332.61058358025j), (-15112.046450780603-88000.14177105221j), (81609.38175982882+21862.010369853655j)),
141 ((-55560.45495276697-8487.570486260593j), (-1240.3046453718998-36806.93746782728j), (2314.7751094353007+66709.2996375249j), (73913.798692593+17715.330241595133j)),
142 ((-6756.64963479065-17680.06798381319j), (-68433.87475450675-1521.61274877697j), (-38429.70821819296-59684.70774465629j), (679.6723316871648-5141.593014362268j)))),
143 ((((6009.97586310716+60604.30942478338j), (32396.109723949165-43790.651419414105j), (28779.550340574773+51904.28569017858j), (22898.47954312162+24374.281930383077j)),
144 ((43337.67939273335-5975.004215923647j), (-20668.774830910013-76079.20355770885j), (28645.123677151292+25672.909247014104j), (-31717.682104715685+9732.221717787586j)),
145 ((53661.13842896042+72923.84155787138j), (35385.072072520015-6307.198139944798j), (30479.544507534592+62234.1254985712j), (-1034.7905621764367+40286.709890159545j)),
146 ((-81367.55312016135+16928.505901155673j), (-7815.888755622378+6045.680730129257j), (23493.410721616994+56525.86301109548j), (64379.29795689413-41596.85817228346j))),
147 (((10077.706189869234-14023.344225890105j), (9787.45494885469+1980.526605239269j), (-41789.42734084199+33109.62355852481j), (77722.47714091674+16230.914008263571j)),
148 ((33929.99686388744+69324.24249861641j), (-42944.721176775936+77239.49498876408j), (-24531.218551429585+33511.72101875048j), (38167.50870231599+48640.295148756864j)),
149 ((5153.059156082629+82411.43319343394j), (46237.63154724835-24482.044081531683j), (-42350.512586094905+21364.573202395462j), (27884.705448024964+27406.374083228744j)),
150 ((26735.822927676723-16229.136581069019j), (-20377.70277018177-48828.24171348816j), (-31499.21640336576-14810.9243228345j), (-7904.957576446148-20229.149437926535j))),
151 (((16522.705470639165+17310.831386237332j), (-76148.34984139015+80969.93773509384j), (-24811.00749069672+38047.29320608019j), (20992.172136102876-22605.533994627098j)),
152 ((-20970.94805191878-11158.194764479718j), (-24776.365668172788+15335.11508002579j), (31475.965557547286+42101.17185492054j), (-5067.057332858472-32895.81793448307j)),
153 ((2682.2679111504112+39461.2760464704j), (8347.197026209295+5913.884037792421j), (-33487.63388762134-63339.09288353257j), (-57157.881248657024+1556.61791639906j)),
154 ((-41068.04079080766+48584.07702236999j), (8498.148930898213+14312.48564445498j), (-21316.05107180962+87054.88334056246j), (-21471.236761054563-59830.259831579846j))),
155 (((29431.72773241329-33178.12936911729j), (26409.71652118041+55871.26981512072j), (66462.49459072504+84224.15533504078j), (54448.348792259174+24319.32902355393j)),
156 ((-71328.38862684023+23367.89957869296j), (-59401.71170696309+49485.585597715195j), (41883.2210796735+19719.46171899562j), (-18795.333157237168-68982.70021560306j)),
157 ((59112.62708481629-45457.26410539314j), (-88790.25871362776-25685.393578202435j), (23696.552787236098+41921.596338817966j), (55010.09931039718-93443.28701025742j)),
158 ((39099.27462555075-21859.303492325664j), (-13175.71402014888+48223.91127425416j), (-5568.289447947842-299.0850724438933j), (-20467.28086020409+30095.8347308894j)))),
159 ((((-16018.868474730582-47768.31986595277j), (51712.37041771119-18503.457760090154j), (-49051.6111606494+23687.829560421436j), (-71984.9830420537+396.65467472762975j)),
160 ((10108.4516848598+51857.057322104636j), (-7216.241612916012+72110.85192662141j), (54626.45574269543-59774.72883503144j), (-657.6522009949113+60897.80850184188j)),
161 ((-7989.0171800768585-89431.37235259652j), (-24705.702245950946+70622.38482297733j), (-63459.904012077815-42658.85544672633j), (50226.10296539047+34122.54286740055j)),
162 ((41218.241998490725+14373.480195603668j), (-54370.32919269195+6808.202490824406j), (-1527.4828551954124+54636.12386175628j), (14472.837501920381-52333.2803360176j))),
163 (((-2746.8539660817187-74513.82700384625j), (-61015.83534421826+53680.73473922199j), (-79322.89757472202-30783.74464730559j), (-46747.1238366321-74773.91885253192j)),
164 ((38500.41669416314-55405.667973400086j), (1396.4878373664105+24775.37482803031j), (58020.02299122539+48560.59423440633j), (-29555.466456927898-2523.0682893230987j)),
165 ((-34617.908388179705-12964.332502930381j), (-45031.80883921236+65602.1489634705j), (-25153.44844444198-12070.474688363538j), (-21543.782061126898-86119.31236007596j)),
166 ((71651.55622950022+37553.55829666175j), (73215.11980883317-718.055454765301j), (7065.864625805567-92990.91593148846j), (11751.07053047308-7707.306990859142j))),
167 (((-43076.79837010652+24177.23355451846j), (6793.467392677732-20449.573606641366j), (-71013.01101746038-6225.881152518472j), (74055.17870813374+66606.15686348274j)),
168 ((11557.138464109157+5388.5729086161155j), (36732.06100793248-37022.585715349574j), (2921.611354480643+55496.19455947708j), (55058.90849766818+18274.262129668554j)),
169 ((-58815.802612553605-3016.8034868425602j), (11211.939776371626+85380.70520152281j), (5184.476190878297-46247.039507761j), (66267.98054810712-61671.71978896645j)),
170 ((-5378.665820848371+9328.328146237982j), (43895.1264174895-68770.39938502887j), (-17511.997277418195+58343.13845945775j), (-85449.25399769237+5421.878678659821j))),
171 (((39759.129208538325-36375.49825029998j), (14116.074449609747-3690.404237582101j), (726.610813691339+20601.83416877652j), (-39703.3656455713+3717.592156691331j)),
172 ((59401.5216214189+24249.24110262998j), (32483.925202512517+12478.691995073255j), (-32680.63271733308-27669.460617493503j), (-49228.06429579756+18669.428245068033j)),
173 ((44330.3653675318-76.05447174097935j), (-77173.70951748395-14072.79466329544j), (44365.91092729417+30775.448092456412j), (-27126.74998375852-42673.613992010614j)),
174 ((69065.27619440478+6707.326801963689j), (30689.082128804977-86800.51053515819j), (49475.52450098609+20399.323850453336j), (-29667.120261194417+8908.992755905914j)))))
175 else:
176 if rank==0:
177 return (1968.4370221151426,)
178 if rank==1:
179 return (-24899.54037082102, -25.31549006801)
180 if rank==2:
181 return ((1830.692020877672, 4256.807988523855), (31330.447580824955, 30088.386511638193))
182 if rank==3:
183 return (((22464.14939770715, 9326.07497133658, -58843.28039835674),
184 (-39132.51601559524, -28984.021248456513, 87606.99636934511),
185 (82483.31416277925, 58484.471708777906, 28659.10377643413)),
186 ((-48055.05693146407, 36954.49346593733, 25658.428739633804),
187 (-45374.680239837886, -11967.766802782062, 40707.17918100887),
188 (-9272.611657965084, 95545.34560025277, 36552.65523613798)),
189 ((-91272.06575583504, 61258.36210240262, 23700.008344466856),
190 (-76559.99183386622, 74506.2742834793, -40042.39145376187),
191 (54893.50655552275, -60408.00584363263, -68208.21135366432)))
192 if rank==4:
193 return ((((-2613.5684369694354, 384.9724701708765, 17359.719572324335, -63393.27571171061),
194 (41041.42067423142, -14993.16104673734, -27399.273319594344, 60051.2377656026),
195 (18566.32422588553, -73825.83739655794, 95319.0187027347, -27646.03157540709),
196 (-88007.8178172775, 60759.47561504975, 31822.15287970184, -38852.10105560179)),
197 ((-89386.29724076603, 79511.70453673883, 1325.344653112319, 14210.631402891566),
198 (9099.55295712997, 30612.395205911307, -5512.258312859951, -43371.59702594321),
199 (24961.325742358764, 6843.62962861413, -43588.35638871549, 37139.61080792606),
200 (-59901.00300911518, -59802.81275754453, -26119.701955513825, 70973.81339014533)),
201 ((10824.815145545523, -37682.56858486531, -14732.374901197414, -14286.141738580205),
202 (-43004.59056324265, 59441.985441533616, -83687.96499450768, 4325.869356595635),
203 (-56783.42265829212, -28959.61168144866, -83740.97480554663, -10729.510064491638),
204 (-38480.61835393819, -50636.84578373406, -3588.0738023085723, 56239.74544740876)),
205 ((18228.900850710852, -16632.129655349723, 8015.163471499967, -4521.799739700364),
206 (-51505.380752985875, -1524.7016267364233, -19342.421346891773, -48490.57412835015),
207 (-73047.79149393305, -35239.98425352734, -35458.1734620065, 55659.41536985519),
208 (-13074.184715655007, 6436.319756047014, -28485.17418228225, -11128.300314215841))),
209 (((321.6371242800669, 35572.05942103493, 9515.23626081155, -4433.077669837556),
210 (26761.084128710136, 10867.52013173081, -19183.162620251198, -68559.41235027292),
211 (11484.667574519088, 51828.050682516754, 38005.19565254123, -76175.23771370867),
212 (-5227.790707720851, 71440.84429737684, -50336.09378326664, 37678.70778115371)),
213 ((-45566.74581644684, 5908.975208284799, 22576.958775978783, -50020.73251106653),
214 (-26017.058082686533, -25299.281527364627, 40976.696154446676, -13431.16881318092),
215 (-46649.16989082289, -65794.20117285698, 64119.987425361716, 5497.440022742972),
216 (-2203.2985446707025, -57513.79981817989, 41574.749087273776, 48387.40101623114)),
217 ((-18416.741032524515, -47640.69430896508, 19679.029797917596, -34810.30464977612),
218 (62831.92844082225, 27725.457434774376, -3134.438446956716, 49315.595365086476),
219 (-73623.94099730175, 20978.640264794405, -5573.772319421056, 36086.56272512534),
220 (28660.57533284233, -58241.55583429358, -51661.45261125069, -50693.33103010448)),
221 ((56426.23453986164, 78359.73594286482, -38576.297999959155, 8913.910887926046),
222 (-88189.29548286308, 2602.1208204264694, -15718.494307329529, 39115.51872697051),
223 (50134.74938380022, -42828.424427019796, 39528.932684095016, 71074.105860494),
224 (10360.78422517216, 3628.4946464838577, 866.6535588603292, 31553.01858562138))),
225 (((52390.293064785874, -12243.173190398476, 12973.542140497811, 24679.210914480092),
226 (-39068.25465569209, 11375.555598436607, -11948.963084895935, 23180.6696549638),
227 (7750.742802840003, -4544.655806011273, 17257.229884485423, -38718.29755209083),
228 (-54962.39017442457, -32692.842165301, 79228.7545707964, -46958.08883925094)),
229 ((58808.04021951867, 31679.09607989699, 60465.22396617634, 3778.4799478359637),
230 (17712.329884018807, 17874.74312645469, 14954.738052270157, -44753.01307496137),
231 (24417.93508883397, -25931.24652138863, -27186.302587945494, 37605.82669369904),
232 (-20116.370032880397, 22395.271847421376, 39918.504300252374, 43365.55907616498)),
233 ((-29680.436323581554, -7156.784950690315, -27141.447127045933, 65196.42918411147),
234 (-10851.323062587486, -12918.348059911383, -61892.308397834146, -49367.20478221224),
235 (-12048.985149625369, 61619.01673500164, 19594.218775417554, 52093.668037218595),
236 (-38465.24637072596, -9188.19710817252, -7828.463839086282, -62406.93767988804)),
237 ((-35787.91825329978, 23117.81737012358, -49967.17854684144, -9030.162340133553),
238 (-31476.492123520133, -42646.47087585365, -80893.4161545868, -38123.68731593444),
239 (23794.505773755358, -1648.5505688887642, -18076.67754352292, -50552.198666715994),
240 (31218.595116869503, 36051.76246348336, -23827.05367940539, 6983.787679924746))),
241 (((-22717.871470141312, 41000.10860057993, 57170.77347009425, -45870.224065572766),
242 (-75749.5782286584, 82016.05469083885, 15364.324776823589, -34421.772637849994),
243 (56091.35037369725, 69020.64428824343, -54982.82912975482, 26461.710610700044),
244 (-6865.449808598962, 1458.33269652327, 19976.42644646119, 71857.51352483299)),
245 ((-19816.540187252496, 8015.999325965924, 73384.47295519276, -29811.76619356322),
246 (-13116.527286368713, -76148.43320182734, 694.6129571919591, -51487.98727764331),
247 (-18216.321286892955, 19089.44846330423, -49851.57024753545, -23061.547216296094),
248 (4069.367521493099, 4460.02510964268, -70628.47512058845, -5320.222269188191)),
249 ((55551.601997272795, 15131.970379855833, 9132.149357120768, -1748.749782567771),
250 (25571.39049857318, -22269.3336119335, -40013.90106400979, -41645.300687720875),
251 (19942.423484201456, -77721.3403094917, -49049.37211887518, -42125.028417728725),
252 (-20331.591530993654, 18849.729202127564, -11172.361078239031, -42378.721186597744)),
253 ((-28162.219784186906, 27005.38411136302, 28047.626970074954, -48907.05914121462),
254 (21561.00249540838, 16819.379648924267, 21373.309752767862, 81217.52472263864),
255 (14530.50392089595, -38878.60235910026, 18507.98920090188, 38187.90762089445),
256 (24234.820876412356, 50390.96325142998, 5976.493423496679, -16545.42618485792))))
257
258 def get_scalar_input1(self, cplx):
259 if not cplx:
260 v1=0.6081355033581688
261 else:
262 v1=(0.27562178672620385+0.42446484939332796j)
263 return (v1,v1)
264
265 def get_scalar_input2(self, cplx):
266 if not cplx:
267 v2=0.5327268994219874
268 else:
269 v2=(0.49976275640416334+0.4141087840210876j)
270 return (v2,v2)
271
272 def get_scalar_input3(self, cplx):
273 if not cplx:
274 v3=0.4903827487969067
275 else:
276 v3=(0.4130410618402195+0.7195601418761082j)
277 return (v3,v3)
278
279 def get_python_input1(self, rank, cplx):
280 if cplx:
281 if rank==0:
282 return (-0.8493106430566671+0.5498588650604705j,)
283 elif rank==1:
284 return (0.5213538174366878+0.45097055421243537j, 0.25896216831911634-0.5966874048733529j)
285 elif rank==2:
286 return (((-0.20984377987310687+0.024810300993445944j), (0.024805532005481523+0.015098314700385806j)),
287 ((0.2292639954026584-0.7100972341857507j), (0.08682454615283863+0.12332238221542291j)))
288 elif rank==3:
289 return ((((-0.6550500854131598-0.2127087989155373j), (-0.017627543683440106-0.3665841375380333j), (0.12492952051741912+0.05374046981620606j)),
290 ((-0.11197479851035519-0.5608269924316476j), (-0.5419470859968003+0.07356518546227997j), (-0.42635110929148823+0.47738396333288513j)),
291 ((-0.16556333483163588+0.009959138144123747j), (-0.17095759700320223+0.19563542216810015j), (0.38543550056193654-0.7475542165987907j))),
292 (((-0.773039591137402+0.001304882415888442j), (0.005692414753365238+0.7073228171031704j), (0.16149889599978962-0.5779399189029897j)),
293 ((-0.39240472327059983+0.5661946692113213j), (0.15619153376084327-0.2043397442335695j), (0.12989734566943012-0.6797045089189742j)),
294 ((-0.2953545934396431+0.00897241164565632j), (0.2424492369208724-0.3012099081809274j), (-0.5052331641775911-0.7560269073586534j))),
295 (((-0.4330063069118393+0.4662418513842146j), (0.14640515390237896+0.21280275920042335j), (-0.6848374766215319+0.688509731931129j)),
296 ((-0.7009542857194253+0.5090290863675988j), (-0.08777137326709294-0.0642088074588476j), (-0.22469168662839534-0.20497222057853204j)),
297 ((-0.004895060324627054-0.0007149461427655712j), (0.5733987472263198-0.020876347517763794j), (0.14677839835678597-0.33748939337229644j))))
298 elif rank==4:
299 return (((((0.790344350-0.675690862j), (-0.33969014424346+0.004667354999j), (-0.353898037-0.23103247j), (-0.173453149+0.350472j)),
300 ((0.262318036+0.493920836j), (0.122221063-0.2126j), (-0.2002867+0.62847794j), (0.2585201923791-0.1055537993243j)),
301 ((0.1024287918-0.07259437049j), (0.3338564+0.44847000j), (0.0433384-0.2616078j), (-0.1717597+0.2503709670077j)),
302 ((-0.768778331-0.076403010j), (0.251991719+0.62985777j), (0.4514933+0.47696252j), (-0.0351486+0.023037350246j))),
303 (((-0.4863645-0.24921801802j), (-0.023444472-0.5599386j), (-0.56592+0.4275706j), (0.41222370286-0.34867238925j)),
304 ((-0.5252590+0.04977251205j), (-0.33737953+0.27293775j), (0.66428+0.87048705j), (0.0672260574-0.416242856449j)),
305 ((0.148783460-0.4520517585j), (-0.41537536+0.16140391j), (0.6278127+0.263838j), (-0.07760387-0.1831155602152j)),
306 ((0.0470026875+0.481795665j), (0.0215979296-0.081945318j), (0.7913869-0.0861j), (0.39466-0.36695690929153635j))),
307 (((-0.143371038+0.36692459j), (-0.05936024660+0.57744203j), (0.35210125-0.3062606j), (0.09250628940+0.2787772j)),
308 ((0.5220814-0.12741648j), (-0.054402209613+0.8726141525j), (0.19115503+0.059924j), (0.34340959513-0.13436584j)),
309 ((-0.854710-0.3580477j), (-0.45614757+0.0726810109j), (-0.11809521670+0.15075834042j), (-0.028270996-0.13039829j)),
310 ((-0.4935554755+0.6616606j), (-0.77712599-0.292285j), (-0.29938802+0.958714551j), (0.1306040901396+0.5467211724j))),
311 (((-0.490711642822499-0.0679784225903799j), (-0.028147241164195536-0.03995809530085381j), (-0.28811330815221536-0.6815443637070895j), (0.07421744086779403+0.7402073156785812j)),
312 ((-0.20556698745139912+0.15621646747170792j), (0.09192542596753261+0.12253579257228409j), (-0.3264483145179087-0.946630282004219j), (0.224192041112648-0.90380956121387j)),
313 ((-0.23224656797256493-0.6768140280012414j), (0.2451768408209073+0.17488492564153224j), (-0.6851697787753819-0.08406614036650228j), (0.20088414272093424+0.1669900873662492j)),
314 ((-0.36057308512412345+0.4226878583624143j), (0.4490488492756204+0.11240390126422484j), (0.03234540063577107+0.5512325765639803j), (-0.5756238638317961-0.46042879607009257j)))),
315 ((((0.24124399378525585-0.8745635773731907j), (-0.19374525735285986+0.5380787997061398j), (-0.4489085299026162-0.6296073456803736j), (0.056570144039872594-0.135671341894538j)),
316 ((0.05530486113034205-0.45284053426797866j), (-0.04502323738051783+0.0630304737860885j), (0.004887893978963609+0.5713368827301133j), (0.18732743423207876-0.7143408881411377j)),
317 ((-0.3712234322764927+0.24908466763268566j), (0.6364022966205971-0.21808571418727385j), (-0.5670900710572193+0.6348611392807915j), (0.9245683140013828+0.3899090325528184j)),
318 ((-0.6094870272364956-0.2685532809269351j), (0.6287315177811945+0.4264823533706973j), (0.1676715780106749-0.48029733292855326j), (-0.5376630517471747-0.7182359990772386j))),
319 (((-0.018779747197580465+0.6114308512727638j), (0.3732084851158033-0.4786089418474003j), (-0.5663664323873074+0.39392462282467033j), (0.13538143997466878-0.12985823792228446j)),
320 ((-0.4780490757496574-0.39805216916921526j), (-0.2797090849741719+0.93720217986173j), (0.6203622207514078-0.15823957110011522j), (0.6060182605777774+0.018214531480017393j)),
321 ((-0.3696664461011986+0.07708468475820063j), (0.3066672994071602-0.345863819817513j), (-0.18002308351634988+0.6758164917135244j), (-0.3299795335012433+0.3472073085359665j)),
322 ((-0.018635553181191034-0.2527645838168162j), (0.10050559250760827-0.2682102608362037j), (0.15675656210201427-0.8704771160865176j), (0.2060240187990353+0.1525158024705776j))),
323 (((0.17233488629737193-0.11594210469295985j), (0.06281516668626441-0.2603634509290429j), (-0.05642743012335105-0.655594777161181j), (0.6959785793264961+0.19699171017512973j)),
324 ((-0.17348338509217032-0.6986792371372937j), (-0.8346643961801311-0.3680194342368177j), (0.12864312443903647-0.32156359553027614j), (0.6861567331359726-0.010430013106866087j)),
325 ((-0.6222917331694062+0.112713903157314j), (-0.12621654439609742+0.28520452943867913j), (0.44508284456518865-0.7522188187153122j), (-0.2636591190438452-0.040926078833506185j)),
326 ((-0.19805372118683406+0.5858778783604968j), (0.8721978764710994-0.548302441850661j), (-0.15430327558703272-0.01201209901149869j), (-0.3670274756811238+0.5474051336552919j))),
327 (((0.25034760722181615-0.15703084151927404j), (-0.14637027923589074+0.2928912738619156j), (0.46416445476921286+0.08042093992929411j), (-0.506840204775922-0.1186965040818393j)),
328 ((-0.37679950234230697-0.2701183493158177j), (0.043782673009088335+0.06734842807447794j), (0.2517828293729589-0.46888255931621403j), (0.6737055518213005-0.812365808946925j)),
329 ((-0.2661639821601073+0.13557351739334367j), (0.7392306869051049+0.5132140781139445j), (0.8364137600747349+0.15412542220542547j), (-0.5220472284167044-0.3618612888730691j)),
330 ((0.13970939326026943-0.3036727447660489j), (-0.38759251152342933+0.18775991991684293j), (-0.2487083238049208-0.4778652656270306j), (0.1390512499757498-0.9134653209907141j)))),
331 ((((0.04833008268979544+0.15219347436054742j), (0.26103655160455086-0.3757461116008425j), (-0.12150273403936784-0.617683120749172j), (0.06086845258368434+0.5631830804862105j)),
332 ((0.5300453373682147+0.4166351114705461j), (-0.6851243348127105+0.6918703698362535j), (-0.7710255671005614+0.10134603710624956j), (-0.26008427165733317+0.39542364464404867j)),
333 ((0.5854498106749348+0.549731062650827j), (0.2519939415821417-0.43527531634423966j), (-0.6267811606157699+0.8585285100484663j), (0.07940474123690222-0.5124720092697812j)),
334 ((0.30776303313314646-0.15530657580599816j), (0.007522269998118669+0.35668611429959896j), (-0.1919814476250188-0.30177638543157503j), (-0.1646298733419591-0.7159546806725978j))),
335 (((-0.30218788472478486+0.7760123719336528j), (-0.6314508280105797-0.1304090779644247j), (0.47461359141937576+0.4479088939414325j), (-0.06334668969380608+0.1323481666947287j)),
336 ((-0.7546949847971307+0.1756014222789699j), (0.25493728708952623-0.1282474899023487j), (0.390011965026524+0.4028431671750171j), (0.06598509493063165+0.7155111116236064j)),
337 ((0.07881709314826968-0.24405932002231845j), (0.36802109324120846-0.15749901166866498j), (-0.4450424875753707+0.7030178139999255j), (0.27329963141708635-0.7119309406610871j)),
338 ((-0.30933381776423374-0.11542316873853986j), (-0.0254248179097315-0.7313241377455038j), (0.10700540112141-0.4660169963118146j), (-0.3013644469437623+0.17540339691654783j))),
339 (((0.0008073119623276392-0.05721575120619815j), (-0.08090870209548084-0.5957005266957907j), (0.17886979689341065+0.08798138279240286j), (-0.47326181867795214-0.39061153265097337j)),
340 ((-0.6240780356387126+0.931178282425864j), (0.49774084728858903-0.6554241240698137j), (-0.5514724615982707-0.1357900974308276j), (0.9476110679732384-0.8254384162767912j)),
341 ((0.339181898243627-0.26749719725842025j), (-0.8452885480367868+0.6880217962554664j), (0.6160319781793868-0.21382367328363683j), (-0.10773724739140955+0.12900692439104278j)),
342 ((-0.4524239681624962-0.05106064389660214j), (0.3502260661172907-0.28486272434416593j), (-0.22611152371676513-0.4473111544777272j), (-0.07889011849494199-0.902189430409641j))),
343 (((-0.4549255061524088+0.8204137745689758j), (0.6262794891433104-0.07873980006902381j), (-0.2099285569580429-0.5700098959028401j), (0.6485809522680817+0.09567054692828636j)),
344 ((0.20594301199461984+0.4902067661467834j), (0.3329644191869927-0.02188884849814343j), (-0.22921000231707434+0.3393725843732417j), (0.5813376839449342+0.09312340842380451j)),
345 ((-0.44184373889384854-0.22572260324605908j), (-0.2865930601221123+0.2963815667447778j), (0.23401187102772336-0.14690195925951866j), (0.5821368881041176+0.7899842539077798j)),
346 ((0.21512923589171906-0.5017618261731809j), (-0.29710734954707296+0.3058974064324922j), (-0.3522028959822211-0.5211544989239631j), (0.0833888296839771+0.47110470479799904j)))),
347 ((((-0.12192871299046759-0.7328491805867747j), (0.7012790193629233+0.7216675552235499j), (0.07746694166806012+0.07187177179945092j), (-0.11596083131875812-0.3402549730235054j)),
348 ((0.4419525909212654-0.41264178907481297j), (-0.9540280899180219-0.0931626138838092j), (0.5850822884122122+0.023613319021177137j), (0.6204747822108139+0.4817530149691007j)),
349 ((0.12857240889181254+0.26765277556782874j), (-0.5905959060433874+0.30391448875145577j), (-0.33009606966351646-0.5133049903372606j), (0.3911371567574641-0.5699531083068055j)),
350 ((-0.06951047741648464+0.09185412570082496j), (0.23412720494006845-0.15301303449597714j), (-0.3632868271203742-0.0854806981764501j), (-0.06898965841232252-0.08895516025337646j))),
351 (((-0.30228646550028415+0.06630530646305488j), (0.1386457118575627-0.48419676726390337j), (-0.22729071025997294-0.7643686926101503j), (-0.3622425543437594+0.8590754571587876j)),
352 ((-0.22721539776726385-0.36036034464849565j), (0.31497309604817325+0.3597772211828737j), (0.5069787174234794-0.8219928876404512j), (0.11194139062149588+0.26293050464964796j)),
353 ((0.4612090001013647+0.27388506472486907j), (-0.30194776224929665-0.13263761985638922j), (-0.6233657091294399+0.44684364446587943j), (-0.3450340301594258+0.11542147033108141j)),
354 ((-0.014881287063154947-0.18928627620951555j), (-0.015185483586684478+0.8972647988323046j), (-0.4351552758945989-0.7299460860379636j), (-0.12326133732628419+0.012329124057677388j))),
355 (((0.10476345838581014-0.14636495344507483j), (-0.32803930125358216+0.27809153512314866j), (0.22528172636268207+0.3494691827944507j), (-0.5310240602410343+0.04119281216138804j)),
356 ((-0.5533642323509493+0.2906558493993484j), (-0.33436396580317507+0.4888660226122262j), (-0.4290629671820184+0.09348041559022413j), (-0.1635189281331263+0.08219415853032563j)),
357 ((-0.48564277336559514-0.39389189119028456j), (-0.07859439546331881-0.5417512106196164j), (-0.2634745687747664+0.6393823484701674j), (-0.4717227533107514+0.7886365869114986j)),
358 ((0.1574555874287038-0.15735823857163656j), (-0.3407071004516933-0.00848408628817443j), (0.111461150743281-0.4496138761616306j), (-0.08146922125654954+0.5259628325969007j))),
359 (((0.34656176542518824+0.07880355128877725j), (-0.258503112094004+0.23322070678863926j), (-0.6883175179734812+0.06684313489266447j), (-0.04692875801791596+0.7384728581195434j)),
360 ((-0.3413224116842536-0.07621317699837815j), (0.23082091132507632-0.7397247652890888j), (-0.7325151537847703-0.2399819049396238j), (-0.13092551439092603-0.2541771655857984j)),
361 ((-0.6621690601235584-0.3959496844857878j), (-0.18349053313548802-0.8753348282719295j), (-0.03908532595157577+0.35883701301557147j), (-0.051099789459096545+0.22309220396282636j)),
362 ((0.255858259117678+0.5962976405338435j), (-0.4167005907396837-0.7228120687439701j), (-0.4251792094268322-0.5598290555324366j), (-0.02547169493326129-0.10035815157656547j)))))
363 else:
364 if rank==0:
365 return (0.16343477325759478,)
366 elif rank==1:
367 return (-0.414447461350212, 0.5940893953018536)
368 elif rank==2:
369 return ((-0.18517072101415805, 0.20812345616476052),
370 (-0.5546197008728526, -0.5564107547626429))
371 elif rank==3:
372 return (((0.39959975888207894, -0.6577401243413907, 0.4280968882108843),
373 (0.22892610169500252, -0.29400534047234894, -0.3596253597614875),
374 (-0.352145347223075, -0.22330947752937103, 0.6040999239623353)),
375 ((0.5820901702251168, 0.5118427342586129, -0.784142756428528),
376 (0.32306580123331297, 0.5718638969764223, 0.35139290436334764),
377 (-0.38744644765122205, 0.6230529976422874, -0.4451744915244834)),
378 ((-0.1680467743981198, 0.8270861936315199, 0.2604978984507546),
379 (-0.3179202431655108, 0.592515989853744, 0.37531069237770537),
380 (-0.5594567456296533, -0.5354189906699913, -0.6879940596903789)))
381 elif rank==4:
382 return ((((0.07653880859335448, -0.8506240072658446, 0.5669507117736834, 0.5069631117128448),
383 (0.7231092428343939, -0.18235569823019526, 0.46022740126490647, 0.8492333455592396),
384 (0.6170052818637486, -0.8808747630127647, 0.1563085221153727, 0.8244613246958687),
385 (0.4294616619386404, -0.12118821840316875, 0.7616687854731052, 0.6728140330125063)),
386 ((0.6436880168986288, -0.25021445743624676, 0.11998265803070028, 0.8312669978628259),
387 (0.6870391868795935, -0.41825547772474664, 0.601722908359805, 0.10996760961876721),
388 (0.30815741382372003, -0.8484037060918963, 0.6225223666523892, 0.25636768516056313),
389 (-0.5403219505752949, 0.784036866371234, 0.11777309540223573, 0.4039156719922558)),
390 ((0.5543818190876664, 0.5654917578606441, 0.6110438985958697, 0.09343833716996176),
391 (0.663012375502168, 0.2314869852119426, 0.23762537471584116, 0.6933683606475624),
392 (-0.29276295759188187, 0.714837865189284, 0.1872658031279304, 0.1702169706800615),
393 (-0.4542436592804883, 0.07976845049430197, 0.08816046717012539, 0.462262050647425)),
394 ((0.506450528739594, 0.4062122557330939, 0.5462416476803083, 0.25191742530295563),
395 (0.3393578341507891, 0.2825671991633298, 0.13447310100386736, 0.5860351833019655),
396 (0.6612450693192753, 0.6774796280346236, 0.2676680871992434, 0.507190159923532),
397 (0.6953428609343382, 0.7171619543885263, 0.6260223993304953, 0.331615476564711))),
398 (((-0.27573547448763347, 0.5077386283774998, 0.4453961872519076, 0.43130840985234026),
399 (-0.580315177591782, 0.5652609083059623, 0.8511780780181941, 0.33371199932631807),
400 (0.699271673783864, 0.49366804495096395, 0.06797744724509305, 0.5353269755409358),
401 (-0.6252936853093409, 0.8905733967820801, 0.3089031678403189, 0.5261014470187029)),
402 ((-0.7404002858536928, 0.2048176759131214, 0.4980581903575471, 0.42894050825990854),
403 (0.45779709857247547, -0.7620468819613082, 0.6247644411339963, 0.6305323474999456),
404 (0.7909315252937255, -0.3012402477673979, 0.4525703288970107, 0.9352115724287626),
405 (0.31693114412209444, -0.37281844304816186, 0.7318694959034, 0.19786924305064665)),
406 ((0.3274437623324882, -0.33087589095095155, 0.8556630658488849, 0.524447118150698),
407 (0.41163320939179787, -0.9238459438767593, 0.21861731917563137, 0.4424459362963088),
408 (0.5776510801231114, 0.6065647351222803, -0.639307289457621, 0.7314330090773533),
409 (0.27421408841108247, 0.12621566941798637, -0.46606608860175, 0.08985539889445235)),
410 ((0.25771437676193215, 0.8671956551054035, -0.7024115898342955, 0.6180265239465382),
411 (0.3536132615270657, 0.4678494273732346, -0.5440963329219566, 0.5386557403677203),
412 (0.425277398166178, 0.5397867882224323, -0.21245876299659439, 0.8499599729452116),
413 (0.282819828736375, 0.616976644425216, 0.45750716248923645, 0.10388406898090359))),
414 (((0.480212232724941, -0.8937086550918505, -0.6399122280175192, -0.3926739182869949),
415 (0.5866305704975537, 0.37523483543667685, 0.34455787558391154, 0.7468191968550546),
416 (-0.7561559742324413, 0.6618299652906166, 0.5497360987548463, 0.44000411823919794),
417 (0.5489342296514085, 0.33299878380451237, -0.6851907132585857, -0.8837744966993399)),
418 ((0.2449050432846066, 0.7225682113974873, -0.42149169327348723, -0.5241172273711572),
419 (0.7461632214743219, 0.3773660518547119, 0.5911139199924735, 0.12543356040664694),
420 (-0.4374385476373295, -0.7523855940695361, 0.4381969239605094, 0.37308327852970813),
421 (-0.21637181734766117, 0.49874174259134, 0.3912614640116107, 0.4526617072173223)),
422 ((0.7151470272616507, 0.43893562960939475, 0.4654984531602598, 0.026153794290457506),
423 (0.7899612010454996, 0.4349102788459652, 0.7453956466392258, 0.47431536809150776),
424 (0.42979681026390004, -0.571667413005515, 0.608322709782375, 0.4374481254420103),
425 (0.33514856567435775, 0.5877137248653976, 0.9386863487830309, 0.1386415730993477)),
426 ((0.35219579066973905, -0.6168773605138196, 0.40504448843510976, 0.424824210157774),
427 (0.7812627665326543, 0.19452639019667187, 0.6000050187112531, 0.7539670503073901),
428 (0.2981680001911141, 0.5123292320600974, 0.6035479676835969, 0.5180365031497639),
429 (0.4958302538856905, -0.5666881217462356, 0.3057862327558582, 0.16322148534649822))),
430 (((0.5219568172234907, 0.6691120408133714, 0.5415030041267854, 0.5178254487487362),
431 (0.550999473408774, 0.3224491374840088, 0.40632316238837907, 0.5316822545746088),
432 (0.15782246477014253, -0.39011414803016886, 0.5923055243411701, 0.33403984110147705),
433 (0.5476956624940421, 0.353567340179472, 0.7751336150761081, 0.3769351266082521)),
434 ((0.26092129669846587, 0.38531106190825626, 0.43089380185467957, 0.3517745063606868),
435 (0.6068795949566435, -0.7313287811237782, 0.7817415065395071, 0.539725422031037),
436 (-0.4681995762086918, 0.8081081299514932, 0.45349678068383653, 0.1676286251112078),
437 (0.9418725604754995, 0.7388572732026134, 0.44262594936532146, 0.7474149440129483)),
438 ((0.8132968384251593, -0.5972218943821608, -0.5919410574164853, -0.35599895731169406),
439 (0.7520654612132684, 0.45483154483372135, 0.4059225646226807, 0.4001021311571795),
440 (0.241190931159322, 0.8294262552595144, 0.6807436275202874, -0.3970641092078186),
441 (0.41214139959674073, -0.49530207420971023, 0.2603640589059204, -0.5320822386899074)),
442 ((0.4852677073030271, 0.5126350217914364, 0.5251827072400477, 0.4107256987588376),
443 (0.5923200155158566, -0.7301177285915048, -0.774241876159728, 0.6746581037497406),
444 (0.3573798122820507, 0.169636160666647, -0.5725299039287078, 0.23182444091612892),
445 (0.3601137116698788, -0.07438414986800912, -0.4165677125316061, 0.0790530879666291))))
446
447 def get_python_input2(self, rank, cplx):
448 if not cplx:
449 if rank==0:
450 return (-0.22889838791916658,)
451 elif rank==1:
452 return (-0.49012030903632825, 0.6031662135176437)
453 elif rank==2:
454 return ((-0.6891705183553265, 0.7417620269931902), (-0.5710307758197861, 0.39980890346586717))
455 elif rank==3:
456 return (((0.450166488818521, 0.40335229027346475, -0.34323251080578104),
457 (0.2842555722086943, 0.519038548037327, -0.22356691063536377),
458 (0.6233434523085559, -0.6939552082789993, 0.20717775496120844)),
459 ((0.6635014413084468, -0.12427061907674535, 0.4316471005230688),
460 (-0.3462206066776269, 0.5812789855981269, 0.1513383660423066),
461 (0.40921125173698586, -0.6302181341512401, 0.4857376224901844)),
462 ((-0.5156818720590722, 0.3810418328134193, 0.5228685660307542),
463 (0.44668606111653875, -0.8552520337523355, -0.30378907822454826),
464 (-0.572442375071903, 0.13397389728880899, 0.)))
465 elif rank==4:
466 return ((((0.45433363368861773, 0.6498884169562154, 0.8968304717142223, 0.8907734241559906),
467 (0.4777438965822781, 0.19219763395957137, 0.47760828704065156, 0.099611811950238),
468 (0.28320121503596124, 0.6794412465012807, 0.13188620716114968, 0.40410020187234463),
469 (0.170095604634749, 0.6491679236703396, 0.48405171480791914, -0.48480616171976565)),
470 ((0.40796761374598983, 0.5888935058511742, 0.810959910176321, -0.3519432924326292),
471 (0.6778803492879535, 0.15159482372964073, 0.7609511790213423, -0.4291829232233251),
472 (-0.6597430856795399, 0.5416080050562327, -0.7316035149420569, 0.17492295472360206),
473 (0.3585956180854316, 0.4506986634961759, -0.3068624306617866, 0.6450035140643098)),
474 ((0.7690325599562085, 0.6582789850176016, -0.6556413596206179, 0.615423012961261),
475 (0.3947622967482572, 0.3604341682179244, -0.5689343825826134, -0.22003697279869047),
476 (-0.6004909191668832, 0.48591852805780483, 0.6670811381503408, -0.33418084981888524),
477 (-0.5696228030807892, 0.8349733556806979, 0.08716776292987743, -0.6103200906618154)),
478 ((0.32673151927490685, 0.3650741778596788, 0.4719563946069752, -0.2624495178810215),
479 (-0.6911360309172416, 0.629718040535628, 0.37138298773280687, 0.7867876295855086),
480 (-0.6768502043234856, 0.32903587935447837, 0.6229889864689531, 0.5226994780805113),
481 (-0.6571446582814051, 0.30807025622961254, 0.3025565918384279, 0.5316791314282434))),
482 (((0.7110156690310308, 0.07897654694359649, 0.49671935812956247, 0.15989919493282642),
483 (0.4454758263127157, -0.8468596115253173, -0.4603369168686832, 0.7835562740584727),
484 (0.1973500874759318, -0.6890077016392274, -0.38353764662415646, 0.2602210860778308),
485 (0.3062963684983607, -0.5485723785169033, -0.7558085192193574, 0.7260373711224899)),
486 ((0.6292337309967168, -0.6298019421801468, 0.5769038995707547, 0.805909547222589),
487 (0.2956786092814956, -0.8516163380649984, 0.0433563110406362, 0.5562648421367056),
488 (-0.44398600437607083, -0.3132864322653825, 0.1309184523859448, 0.09487956033144461),
489 (-0.39347200269496224, 0.6744128343886427, -0.17787462973897294, 0.6844498649820736)),
490 ((-0.4668129815805621, 0.46840442065095245, -0.6348701936076414, 0.534532796163385),
491 (0.5401302006866129, 0.42361490419012787, 0.3055178484323608, 0.4099049291060996),
492 (0.15643756091005653, 0.5538397868668722, 0.5793672234228313, 0.5343825930606839),
493 (0.567145595353928, 0.7936293829906991, 0.5159699957715731, -0.11524767048966807)),
494 ((0.46983068856527466, 0.829272105469925, 0.8242448082292821, 0.3155783126108229),
495 (0.46679344399363587, -0.35498575768428703, 0.8195558132407107, 0.044710380043836144),
496 (0.7228682303918399, 0.5956512578344273, 0.5842273233950968, -0.46445592272801267),
497 (0.48424480615111076, -0.43589572454719294, 0.2739525289177576, 0.5141521147948742))),
498 (((0.5353156164778932, -0.827716346014944, 0.2661170502005538, 0.6240217001592496),
499 (0.5889586875315378, -0.6056309378106368, 0.38460210470822326, 0.3257073061066195),
500 (0.38605597818925463, 0.5566287156895975, 0.8868213070850919, -0.10818212758613992),
501 (0.44934219884516874, 0.7722925534790802, 0.6824771465971564, -0.4861304182325704)),
502 ((0.35670465647772914, 0.40563319853724733, 0.9215374519881303, 0.3261075398074149),
503 (0.5466590188369063, 0.8063505325979616, 0.2505468000914572, -0.27573025774136484),
504 (0.743952777599612, -0.5916038948220598, 0.5814331576314142, -0.25330559867360414),
505 (-0.9281192928557953, -0.5526121099889816, 0.7663168620517609, 0.27644519542436335)),
506 ((0.4312170339514421, 0.39670998093753257, 0.6147975692316388, 0.49353631380425866),
507 (0.2914782490250003, 0.34495461015075896, 0.724277583477783, 0.7656114513280461),
508 (0.2967100926835535, -0.3708225100005513, 0.4557999563503535, 0.21401134707432434),
509 (-0.33196574382892885, 0.6509108525238382, 0.44580359408187276, 0.6130947882235365)),
510 ((0.11173436827791464, 0.6700051363761477, 0.12807937551069665, 0.7174522662954508),
511 (0.40082249771839484, -0.6435832868289147, 0.47429720113534696, 0.44533186804848607),
512 (0.4625441865293232, 0.24229257632548656, 0.655276132353378, 0.27883861657454045),
513 (0.638496711915504, 0.5391658143407168, 0.6794910638048037, 0.18819631783938193))),
514 (((0.49500523167298044, -0.7621808699493068, 0.8002303121407335, 0.4339016426795843),
515 (0.6899502135654372, 0.9438297115207196, 0.39545080237118185, 0.43835240439976453),
516 (-0.5324364296711654, -0.7403526206887153, 0.421079060947922, 0.28183735731097076),
517 (0.7641745784203584, -0.8052630361187237, 0.4113425938410049, 0.4873541423815537)),
518 ((0.4763043550807671, 0.8818320340667569, 0.4376950912132615, 0.5155236207246434),
519 (0.4770314956120568, 0.6995239422377975, 0.29342906280323733, 0.2207382366023154),
520 (0.47119152389910457, 0.5643383062697325, 0.19014363807175272, 0.47728067160438753),
521 (0.293549802812087, 0.3091310044125135, 0.8079461149429534, 0.30540675213143226)),
522 ((-0.6562012019806969, -0.5762140611417803, -0.8922117406714833, -0.5644163171621817),
523 (0.28018207838767606, -0.6980601983118322, 0.9321643060248082, -0.6857895197253853),
524 (0.30248864387340907, 0.37739756004900193, -0.5011312641768506, 0.19190880686969636),
525 (-0.36857760657786354, 0.6980580453947155, -0.4162678161352499, 0.6651932863378893)),
526 ((-0.2969663268640197, 0.5012850908098417, -0.5630486821046159, 0.5994825528795871),
527 (-0.45367000863631446, 0.24430658191105983, -0.277060548382701, 0.5169546884489187),
528 (-0.9278462241176814, 0.5112886572173754, -0.3908093365092602, 0.7815138913982161),
529 (-0.32136995201761503, 0.2619940057725135, -0.35043110649096515, 0.9241246395431221))))
530 else:
531 if rank==0:
532 return (0.22889838791916658j,)
533 elif rank==1:
534 return (-0.49012030903632825, 0.6031662135176437j)
535 elif rank==2:
536 return ((0.6891705183553265, 0.7417620269931902j), (0.5710307758197861j, 0.39980890346586717))
537 elif rank==3:
538 return ((((0.07547574295591059+0.525876939609691j), (0.6637422951496057+0.7388772645580287j), (-0.11575430357267835+0.3396973817710597j)),
539 ((0.489975174033296-0.7778617185395662j), (-0.8582089062218037+0.7890680975791542j), (-0.34130307486775563+0.3651975276800719j)),
540 ((0.6269390600608432+0.28192633671923134j), (0.6386868409229303+0.8545339974263741j), (0.8227777914187108+0.9768191533988598j))),
541 (((0.3925840042771697+0.8092934421771397j), (0.27266165100309064+0.32623317563034737j), (-0.8740927141261398-0.4161371090973831j)),
542 ((0.6702575659927514-0.450686130655044j), (0.474828305773418+0.7656845168857629j), (0.15253090291865834+0.46008109446176876j)),
543 ((0.6094857432227104+0.5897008435426775j), (0.5134349957841884+0.09305616116877985j), (0.7954114232091216-0.4633804802000654j))),
544 (((-0.29941397426915045-0.666629677984151j), (0.41045211458021535+0.6422008897066637j), (0.7608807908849147-0.2263883386308603j)),
545 ((0.21016378700056504+0.8009138519791235j), (0.10548646537128033+0.43289764157877525j), (0.4083797466047874+0.9040107808706966j)),
546 ((-0.8930070536981469+0.4674003925883036j), (-0.7258863558039299-0.38206684572695093j), (0.40771065599848233+0.14217138669583038j))))
547
548 elif rank==4:
549 return (((((-0.38981592692954015-0.2856117645961309j), (-0.035094151427129905-0.265178716783423j), (-0.34532231395177504+0.36673987839501265j), (0.2041672227930209-0.6128500993893164j)),
550 ((-0.12421070955162938+0.026349493748204833j), (-0.3415725798389704-0.0775430038163134j), (0.17048268853378434-0.08862480715498033j), (-0.1106967683514759-0.10379778205326462j)),
551 ((0.7298716846009465+0.20776829436005195j), (-0.33435577984609854+0.039072521387463754j), (-0.05886662990481739-0.05072122421891534j), (0.18354830862254912+0.4606377888934907j)),
552 ((-0.0767806399525307-0.8221389203690308j), (0.190835818629008+0.16192941104126957j), (0.17778866234180712+0.2584570168682756j), (0.07671782176673747-0.8469237188822869j))),
553 (((-0.35597391704713033+0.25043169560436107j), (0.41228040156904044-0.3258644927079958j), (0.3255845547364652-0.04129891413069664j), (-0.49623171650577047-0.28943245984704047j)),
554 ((-0.29908631455896795+0.32223868604261874j), (0.22549183711675158-0.07473853585711632j), (0.8473949873724411-0.1266457939975455j), (-0.28218966494496867-0.7447571699002506j)),
555 ((0.43626155573856107-0.22452973659230602j), (-0.13852005024639502-0.2549763508471894j), (0.40223991129540115+0.6286067642439117j), (0.05222020648272985+0.36124142226658207j)),
556 ((-0.5521041254588972+0.04526366394953618j), (0.028005364473586924+0.664136776905772j), (0.19982797953123066+0.6970088780138949j), (-0.27592458615859916+0.05358189338835073j))),
557 (((-0.01401304893255595-0.2592802467152746j), (0.38457288044239724+0.022898781579736238j), (0.11747849077927963+0.02982853498608895j), (0.43510885272308897-0.5971898990476139j)),
558 ((-0.1386049812442307+0.48221564332109246j), (0.12985640511010177-0.46733815759024744j), (0.36035270943159226+0.030123486580092673j), (0.13433570628907954-0.3548300324692315j)),
559 ((0.3630171981969085-0.10489930496648125j), (-0.19285139550925268-0.22152540990095826j), (0.067448080460355-0.22485851852233463j), (-0.22642725802173436-0.8030852201557207j)),
560 ((-0.4923572157490467+0.6941947968511506j), (-0.3083492643827028-0.21029535607801164j), (0.04516826032767807+0.16347006444443446j), (-0.4979722425636467+0.2600475135508704j))),
561 (((-0.9146464795838944-0.4811995164563062j), (0.12372743851535117-0.19857635465689238j), (-0.32654984398293085+0.1399970385669752j), (0.5030023710839411-0.15390603274578885j)),
562 ((0.12140042439229626-0.1677658216785154j), (0.15883782681413416+0.33379103634910656j), (0.185779713490287-0.3870952578769751j), (-0.06711575082420218+0.06791735335184867j)),
563 ((-0.39839017930339415-0.5701893857302205j), (0.517636015942468+0.2847028688489578j), (0.3792093531943226+0.6747299891837335j), (0.3790566911887919-0.5890859768662702j)),
564 ((0.10419770368967918-0.5497491933319889j), (0.037156668670760284-0.08813180251072528j), (0.3918645219248724+0.294242167456119j), (0.46981783997943394-0.1336764441655952j)))),
565 ((((0.033498149202913496+0.5105612554548389j), (-0.00671182242426005-0.34435078880309433j), (-0.0373284784284601-0.5412680712938157j), (-0.21266128835217923+0.7435692921379757j)),
566 ((-0.6338796544785741-0.1519302355817751j), (0.19056981672575435-0.2151423521624617j), (-0.2906156104811447-0.06976477293942895j), (0.11015974132120787+0.034078789456797876j)),
567 ((-0.802973040360448+0.25982604363200634j), (0.4470120196869066+0.1070242653063358j), (-0.17139489854864864+0.280001955020894j), (0.481238612220953-0.1754485899809457j)),
568 ((-0.2395451407327337+0.17708193346527168j), (-0.5161417899394428-0.1119365768848799j), (0.48501626047241986+0.14129638224677343j), (-0.8906342486796647+0.5959903703773012j))),
569 (((0.4573784894991153+0.5594852951634348j), (0.5713680069309577-0.5494425630562785j), (0.08288855869575895-0.46808758933789407j), (0.0881202973963836+0.030710301266941187j)),
570 ((-0.06642229051907478-0.22323447873665903j), (-0.7628208743574287-0.6371785162956514j), (-0.2246568157836294+0.3567254755305702j), (0.68327814761898-0.27973991174997725j)),
571 ((0.2784159984258674-0.17498289569648884j), (0.004730953615886158+0.07715287138774296j), (0.0773670863004613-0.6360012413426752j), (-0.0647551047878423+0.6906328131396173j)),
572 ((0.558480058973719-0.04481293285577537j), (0.09684530531415203-0.40763537195877164j), (-0.3913240230298858-0.004438441098584933j), (0.031510290166036015-0.30876711061254836j))),
573 (((-0.588734853251181+0.36452828173265184j), (-0.19810928581934018+0.20823750547135322j), (-0.45274761144312026-0.17983105119023213j), (-0.11229734410645587+0.2560770621269597j)),
574 ((-0.4038055786345742+0.7025954299708754j), (0.6537842056064525-0.34973368012330475j), (0.35464537317028266-0.21682856487173952j), (-0.01815814374546676+0.4718839114346507j)),
575 ((-0.36336965745600625+0.3759504695343794j), (0.2248053726148399+0.22029644112859348j), (-0.09064428722611384-0.08254509314972736j), (0.12418920854260185-0.5471431985662905j)),
576 ((-0.5200354642412095+0.5425236434272582j), (0.4144201383368241-0.03221161184797661j), (0.10973679214385457+0.2887677216157485j), (0.8119344460935665-0.3782880124387231j))),
577 (((0.5132990185785542+0.1269895435922086j), (-0.8779926345719881-0.5240101078639017j), (-0.1083296281261924-0.8147529275948924j), (0.09647199912137994+0.6723852222785147j)),
578 ((0.2928885382594636-0.17353985395496885j), (-0.21364153320667634-0.03557466867344006j), (0.09421518259275086+0.6153556681629657j), (0.42459824192798623-0.17443990666881448j)),
579 ((-0.5143367641601848-0.474941950841561j), (-0.2759320986482162-0.8250929199965524j), (0.21922685784092444-0.5600860240181191j), (-0.8569179028983865-0.16482185283148332j)),
580 ((0.5268959167118139+0.55401274233894j), (0.08678495563788746-0.11915652486681427j), (-0.35416282616502737-0.4847172453257278j), (0.17111904837721448-0.8480796973331977j)))),
581 ((((0.5469697524334143+0.02787502521930041j), (0.2605342686105838-0.0738711527960102j), (-0.39955538445037275-0.37613379994879603j), (-0.013180544897028024-0.5858094274207383j)),
582 ((0.2506641890300212-0.1324021828426094j), (0.2972858012659867+0.21562443620437732j), (-0.6161716236733459-0.16509522040718683j), (-0.18102929570881354-0.6067237673008904j)),
583 ((-0.13192637373724614-0.6510388019746922j), (-0.5546497186031663+0.15957406458683243j), (0.3605761118213213+0.25686768414528705j), (0.401508970393731-0.5108236410388888j)),
584 ((0.39953367426110775+0.2252371577830028j), (-0.3347746193719203+0.2263747029817541j), (0.43746847580536263+0.5388066331831217j), (-0.07344964656116226+0.5473468419762271j))),
585 (((-0.6996969040609468+0.7213293709800207j), (-0.37557411707556654+0.1506412600826108j), (0.46608440397755446+0.013185375483020345j), (0.29865953531762246+0.19232124238469206j)),
586 ((-0.06222220564236847+0.5694069457780013j), (-0.5368962596793275+0.36703072903452505j), (-0.05182804478010006+0.3840540087750902j), (0.16375632553791997-0.4661212952339301j)),
587 ((-0.4041070739038938-0.04037225736899819j), (0.24215413306521716-0.06631187616668377j), (-0.2663745437846935+0.611183098942953j), (0.337942638568164-0.5670011153091816j)),
588 ((0.3876032723274968-0.08306424304240201j), (0.2173881180889634+0.4512865759999062j), (0.8795902664110721+0.8614312675002035j), (0.2870339354260544-0.11303384551216167j))),
589 (((-0.1319661103321904-0.1378309763195904j), (-0.03263197183994404+0.03651637220786119j), (-0.33530432503994767-0.007463082947573474j), (-0.3110039705203388+0.17231544573803292j)),
590 ((-0.07377573914613977+0.3678250464292866j), (0.3280327212275782-0.08984395132040435j), (-0.4492548090143319-0.3165726498892033j), (0.4186631970202508+0.14692250754002467j)),
591 ((0.12300006190073354+0.8465896476419659j), (-0.3266430699658883+0.9258477806121458j), (0.1270817126276501+0.7278063130820139j), (0.04390487289582379-0.07072636756748818j)),
592 ((0.8411822363338441+0.3271788959517308j), (0.14233232632431592-0.8034008469283107j), (-0.012057809815140041-0.07447549854466373j), (-0.5078787065469428-0.3322994351304549j))),
593 (((0.2823845584710901+0.3169641678915194j), (-0.14926005618963878-0.06141784434383113j), (-0.3336711008317823+0.608644554614276j), (0.042858723261329-0.25353753207960283j)),
594 ((-0.19596385250682435+0.29611929225848677j), (0.9379729841249024-0.5720585057483617j), (0.20515378855823352-0.5330821799545553j), (-0.45689594348515183-0.5221745972924456j)),
595 ((0.005913178294852495-0.04464774171993757j), (-0.3515104653551274-0.8716563770921714j), (-0.5644652537988155+0.4413367915251234j), (-0.32684204426160013-0.6404138884316928j)),
596 ((-0.20862357692064337-0.008586491450952471j), (0.7110044208850719-0.0260275339943824j), (0.33195949443404427-0.060726068233408204j), (-0.24054180926541135-0.22750131116864736j)))),
597 ((((-0.19779207637655705-0.06170675636552225j), (0.24801124896429994+0.52301594517833j), (0.3359762170142643+0.006887001901350498j), (-0.5044830473838094-0.023633199563395157j)),
598 ((0.35936388285588383-0.12044000986333014j), (0.06567318357927132+0.23081033720558908j), (-0.006063340342035706-0.43355358359223595j), (0.560747142959132-0.019735739750161296j)),
599 ((0.16778778206380363+0.4393001381475511j), (-0.19115676223578515+0.023171844709636735j), (-0.10056678281864495+0.11175155826135519j), (-0.24878623491611496+0.8172452900981119j)),
600 ((-0.4955653304024539-0.35864956392371916j), (-0.002728871185003978+0.3416061368260671j), (0.12387109110953831-0.2654493686440327j), (0.10889405520664741+0.1218720709206873j))),
601 (((0.07498012788575437+0.251986782960711j), (0.3511927502553568+0.27907917288389616j), (-0.6319086362942079-0.11628342415274562j), (-0.02365411536311457+0.7887319952841338j)),
602 ((0.38406832355686993+0.03416295519609358j), (0.35717793709754475+0.7751423080742306j), (0.29135030536626805+0.15668909755462013j), (0.14503883313378096-0.030524299930524523j)),
603 ((0.3331132451297607-0.03848385697279688j), (0.0750244753960323+0.10077551583585709j), (-0.15490975501427928-0.1798249796504282j), (0.9066796997830194-0.6602275207883976j)),
604 ((0.1471293723064081+0.10463425812772786j), (-0.5961028228889094+0.5480663905625878j), (0.0026089287349913004-0.5747699075005761j), (0.2899525342736272+0.1268195775198908j))),
605 (((-0.13364076045805806-0.17688339222579297j), (0.6013848685157083+0.3493674941578545j), (0.22523028276047052-0.21939576800830496j), (0.09111222639027305+0.7894981102504295j)),
606 ((0.6016850426953799+0.043886903791527376j), (-0.5060405108831854-0.5381151561460222j), (-0.4760569419146623+0.40666832623996363j), (-0.5318516495722876+0.16837803612551516j)),
607 ((0.024034551466941778-0.2166311876229967j), (0.26494031063742085-0.002375780112287895j), (-0.4730046544996984+0.6644551176991773j), (-0.39157195926624855+0.6199256868216445j)),
608 ((-0.04324867778353203-0.08087976286625231j), (0.1578599942534593-0.5156287674297576j), (-0.15005517462767193-0.09424179596026594j), (-0.13944975064956378-0.17543248499412656j))),
609 (((-0.5648616238096438+0.46394478768979586j), (-0.41003938415951235-0.33614785565882677j), (-0.3893130130095368+0.05645367151196268j), (0.3821121473593535+0.17991382827274327j)),
610 ((-0.5139083991747512+0.789121431720947j), (-0.6171117805874629+0.3660741433822048j), (0.05303400234375011+0.5094418060177022j), (-0.3545806168076585+0.4629656377266379j)),
611 ((0.2658032276104465+0.4237937984173149j), (0.18183157447480658+0.06623748664233398j), (0.12546831548404336-0.10575754034359075j), (-0.6833387940577664+0.23947306785979094j)),
612 ((-0.20503554348285624+0.21628529049971312j), (0.23649982943904524-0.6159980174662008j), (-0.20651357702330975+0.08458167450189069j), (0.j)))))
613
614 def get_python_input3(self, rank, cplx):
615 if not cplx:
616 if rank==0:
617 return (0.37126864363799594,)
618 elif rank==1:
619 return (0.6234908821535466, 0.6138798448505429)
620 elif rank==2:
621 return ((0.46458697075264, 0.47521353725342), (0.2769991834092879, 0.7655903776259643))
622 elif rank==3:
623 return (((-0.7087306338233754, 0.5091993546185136, 0.7823132790082358),
624 (0.7809687239325918, -0.7618301393180559, 0.13846012311583666),
625 (0.24584408982123662, -0.30175410391822816, -0.6508820239463049)),
626 ((0.0799357328507963, 0.4268164046934606, -0.3340669557843154),
627 (-0.5352665915599666, -0.4796035531201281, -0.31521200922735726),
628 (0.6181927127971525, 0.5813500010909463, 0.6485259530707308)),
629 ((-0.607591622470962, 0.5134390179382666, -0.7761053727330762),
630 (0.30315911281007185, -0.7772739725828741, 0.21981237010097954),
631 (0.5720780258224234, -0.7199923733581466, -0.8038912730779739)))
632 elif rank==4:
633 return ((((0.45368972429803434, 0.43658224238126836, 0.327332664787118, 0.1659399779578305),
634 (0.5908203393014015, 0.6287596060266886, 0.26557881193403204, 0.7640693855123928),
635 (0.6550472925659366, 0.4051939492486867, 0.39695234748477226, 0.7984350907853707),
636 (0.45152587205177463, -0.6915126698433964, -0.1408991785923076, 0.5555466803377823)),
637 ((-0.7111217974645967, 0.22442551434498154, 0.33601178864915354, 0.21277504641255832),
638 (0.10220061513651632, 0.4523774178793611, 0.4079018667540423, -0.909554257065248),
639 (0.6139494095517375, 0.3083569476979329, 0.6376629339543685, -0.28647430781873456),
640 (-0.36486444793373635, 0.3134770531471723, 0.19207850462685053, 0.2742209367740796)),
641 ((0.5206089841634276, 0.24952538894537638, 0.0933758645493489, 0.24304014487798284),
642 (0.2039225828898289, 0.423378042043955, 0.21847415387885974, 0.4823494123271024),
643 (0.49781756385165377, 0.42765522168555026, -0.4737414300227722, -0.5398374124738391),
644 (0.2640617374368053, 0.34880253282719476, 0.32357380359477705, -0.7111559522372015)),
645 ((0.23761918672652063, 0.1593578505403827, 0.6530063992033186, 0.9079894778799892),
646 (-0.8250545394400823, 0.4861804550261372, -0.3406365725750848, 0.42480466462889144),
647 (0.47203132507512685, 0.20818156589620632, 0.20161698569028383, 0.42806013456132413),
648 (0.7792675299565863, 0.3736959703075082, 0.19761992623295196, 0.4235372420916027))),
649 (((0.6459817009885405, 0.2610419659851719, 0.39888588458573665, 0.6358114313716404),
650 (0.6789108524310596, 0.4760144991501489, 0.5132407231875976, -0.7445121079875354),
651 (-0.3165090047475903, 0.1882290433512482, -0.30270840337500193, 0.4773827304127968),
652 (0.27248041023839426, 0.5356669773887297, -0.5759298824759524, 0.27026295067501754)),
653 ((0.2225815420544881, 0.6296933698530776, 0.6420994781708316, 0.5292910401325328),
654 (0.4838814244753861, 0.3015763358329324, 0.5966105067811018, 0.437555952383517),
655 (0.2508886824465943, -0.3688703869280175, 0.44848941714873286, 0.6968286221703255),
656 (0.7458127375857659, 0.5565367320025696, -0.5221639609134333, -0.5043229193744858)),
657 ((0.2704586652152375, 0.23622061144754075, 0.5668874045788246, -0.7383427762361463),
658 (0.3326338826927772, -0.5180692401299339, 0.6853188934444896, -0.5105611442225273),
659 (0.32729714889258044, 0.7634733351662765, 0.2667323956085834, 0.3813499428619923),
660 (-0.707758750914661, 0.23317899979615478, -0.6728060312412778, -0.5045011288076484)),
661 ((-0.2758755420358796, -0.6849112850328907, 0.7208465949939953, 0.5465246847493163),
662 (0.5382081700827642, 0.4626841039902129, 0.38537277159039474, -0.5918003106653552),
663 (0.7410792569612943, -0.848695963275266, -0.35215371840141596, 0.7859807920638692),
664 (0.439754658119384, -0.09885040884202281, -0.20324265625602897, 0.6393707779383961))),
665 (((0.45932643067605416, 0.4867064483724215, -0.2492845750953945, 0.4071869028109893),
666 (0.518352199566693, 0.6265341328104177, 0.5719047743470251, -0.8284284690707643),
667 (0.1255527780884896, -0.133522460155736, 0.5939516968011829, 0.6970674969748756),
668 (0.821986273583169, 0.3881563859122813, 0.16941736964779366, -0.288738726812057)),
669 ((0.48102730273877786, 0.1522385344365771, 0.5752150637264031, 0.39522973755221524),
670 (-0.732520712427958, -0.49190588963815157, 0.6125760080831428, 0.2716702847832281),
671 (-0.8159103581398756, 0.34507912842082983, 0.7075657623779936, 0.29530894172611916),
672 (0.5278442353318813, -0.6539972004065213, -0.48897529954240776, 0.7932403888940815)),
673 ((0.831358889394934, 0.48050345824229945, -0.6410388202892018, 0.8982570057418652),
674 (0.30388123939085465, 0.727912073121657, -0.543834760379716, -0.6710456332208439),
675 (0.4417259323277584, -0.5717441377950038, 0.3664067245442036, 0.3280925201821242),
676 (-0.5400907637568426, 0.43207844188064887, -0.732946675152238, -0.5339092194505695)),
677 ((-0.22369526225631464, 0.5665529520090573, 0.2653373517286637, 0.6914637769007175),
678 (0.22138531453529892, 0.17362665833183274, 0.11873401018627547, 0.48731998406078203),
679 (0.5508721228465998, -0.3492961556670177, -0.5692351404720578, 0.5107492266892075),
680 (0.17584863513461835, -0.35755945941346623, 0.7650117785966029, 0.48316674832514844))),
681 (((0.2982202413301988, 0.2348830652298031, 0.3114442699257422, -0.20218169729319738),
682 (0.6846710473822368, -0.8119003553529898, 0.1790804504032915, 0.4781252356617314),
683 (-0.3766941501672641, 0.5437027703705374, -0.24423050827666176, 0.3323763024031741),
684 (0.8189980567608663, -0.5888920746029481, 0.17138276940268463, 0.5475256795584624)),
685 ((0.4569907243510988, 0.5255497422421722, -0.1680676291815795, -0.2879601796868399),
686 (0.5419471765149858, 0.8765158329632898, -0.21847500231364173, 0.6219663103942495),
687 (0.8993300494227338, 0.5256551743041176, 0.4312579142909404, -0.28503463714017396),
688 (-0.6601304123050094, 0.9681225089321629, 0.6110831795473397, 0.630733896684101)),
689 ((0.7252549854189686, -0.48905018110325815, 0.3949054499635516, 0.6883221515509466),
690 (0.3510020242244332, 0.5964593467774927, -0.665927090247577, -0.19851750424804993),
691 (0.49702295298466764, -0.32952301722148614, 0.6578112215358343, 0.629875436683738),
692 (0.5228582859488041, 0.48834135369831744, -0.8107618558028835, 0.012956020032133924)),
693 ((-0.3966015859408982, 0.19901168720580728, 0.6930890007374754, 0.7839579709117346),
694 (0.8623235889093344, 0.5661301336086426, -0.6547115325958021, -0.6689861941430038),
695 (-0.5105113993916237, 0.7066840336625683, 0.8004786600943815, 0.5266845579213677),
696 (0.689553296868146, -0.773301352126767, -0.7364812118860565, 0.5377502245784462))))
697 else:
698 if rank==0:
699 return (0.37126864363799594j,)
700 elif rank==1:
701 return (-0.6234908821535466, -0.6138798448505429j)
702 elif rank==2:
703 return ((0.46458697075264j, 0.47521353725342), (-0.2769991834092879j, 0.7655903776259643))
704 elif rank==3:
705 return ((((0.1454277130999836-0.7320274919853249j), (0.6111728482069096+0.3264747748994178j), (-0.5638648912195857-0.17450334170489668j)),
706 ((0.36745011107568193-0.36335598004419434j), (0.17683177117302507+0.17980667188917787j), (0.1975971229124449+0.4658291218212517j)),
707 ((-0.2014605099933947+0.2948257187520392j), (-0.744292187546457-0.06353546214852701j), (0.5315307768500955+0.20979695600906234j))),
708 (((0.6658801836076347-0.5765177344716341j), (0.49015610705744417-0.5133880244308395j), (-0.1502312930208003+0.1561733784845012j)),
709 ((-0.661348002857287-0.029644750992120383j), (0.006584637699976192-0.4781943559540154j), (0.12266084950784173+0.46542904661542706j)),
710 ((-0.41697557600280255-0.3537461357888442j), (0.26272750067625794-0.43630595153076535j), (-0.21367481541695688-0.2618183771588106j))),
711 (((-0.22338538892626414-0.10818049912878436j), (-0.040383727106552136+0.48764341091162444j), (0.014766392396017403+0.8223651913211714j)),
712 ((0.003228290936111433-0.37610619147220625j), (-0.01103811298925661-0.39851348234329986j), (0.20163130848248234-0.49523755760391885j)),
713 ((0.37812723691663375+0.354147330172629j), (0.08116710042198705+0.1643297763093502j), (0.015047687899757523-0.05023160033399521j))))
714 elif rank==4:
715 return ((((0.45368972429803434, 0.43658224238126836j, 0.327332664787118, 0.1659399779578305),
716 (0.5908203393014015, 0.6287596060266886, 0.26557881193403204, 0.7640693855123928),
717 (0.6550472925659366, 0.4051939492486867, 0.39695234748477226, 0.7984350907853707),
718 (0.45152587205177463, 0.6915126698433964, 0.1408991785923076, 0.5555466803377823)),
719 ((0.7111217974645967, -0.224425514+0.12j, -0.336011788-035j, 0.21277504641255832),
720 (0.10220061513651632, 0.4523774178793611, 0.4079018667540423, 0.909554257065248),
721 (0.6139494095517375, 0.3083569476979329, 0.6376629339543685, 0.28647430781873456),
722 (0.36486444793373635, -0.31347705-0.8765j, 0.19207850462685053, 0.2742209367740796)),
723 ((0.5206089841634276, 0.24952538894537638, 0.0933758645493489, 0.24304014487798284),
724 (-0.2039225828898289, 0.423378042043955, 0.21847415387885974, 0.4823494123271024),
725 (0.49781756385165377, 0.42765522168555026j, 0.4737414300227722, 0.5398374124738391),
726 (0.2640617374368053, 0.34880253282719476, 0.32357380359477705, 0.7111559522372015)),
727 ((0.23761918672652063, -0.1593578505403827, 0.6530063992033186, 0.9079894778799892),
728 (0.8250545394400823, 0.4861804550261372, 0.3406365725750848, 0.42480466462889144),
729 (0.47203132507512685, 0.20818156589620632, 0.20161698569028383, 0.42806013456132413),
730 (0.7792675299565863, -0.3736959703075082, -0.19761992623295196, 0.4235372420916027))),
731 (((0.6459817009885405, 0.2610419659851719, -0.39888588458573665, 0.6358114313716404),
732 (0.6789108524310596, 0.4760144991501489, 0.5132407231875976, 0.7445121079875354),
733 (0.3165090047475903, 0.1882290433512482, 0.30270840337500193, 0.4773827304127968),
734 (0.27248041023839426, 0.5356669773887297, 0.5759298824759524, 0.27026295067501754)),
735 ((-0.2225815420544881, 0.6296933698530776, 0.6420994781708316, 0.5292910401325328),
736 (0.4838814244753861, 0.3015763358329324, 0.5966105067811018, 0.437555952383517),
737 (0.2508886824465943, 0.3688703869280175j, 0.44848941714873286, 0.6968286221703255),
738 (0.7458127375857659, 0.5565367320025696, 0.5221639609134333, 0.5043229193744858)),
739 ((0.2704586652152375, 0.23622061144754075, 0.5668874045788246, 0.7383427762361463),
740 (0.3326338826927772, 0.5180692401299339, -0.6853188934444896, 0.5105611442225273),
741 (0.32729714889258044, 0.7634733351662765, 0.2667323956085834, 0.3813499428619923),
742 (0.707758750914661, 0.23317899979615478, 0.6728060312412778, 0.5045011288076484)),
743 ((0.2758755420358796, 0.6849112850328907, 0.7208465949939953, 0.5465246847493163),
744 (0.5382081700827642, 0.4626841039902129, 0.38537277159039474, 0.5918003106653552),
745 (0.7410792569612943, 0.848695963275266, 0.35215371840141596, 0.7859807920638692),
746 (0.439754658119384, 0.09885040884202281, 0.20324265625602897, 0.6393707779383961))),
747 (((0.45932643067605416, 0.4867064483724215, 0.2492845750953945, 0.4071869028109893),
748 (0.518352199566693, 0.6265341328104177, 0.5719047743470251, 0.8284284690707643),
749 (0.1255527780884896, 0.133522460155736, 0.5939516968011829, 0.6970674969748756),
750 (0.821986273583169, 0.3881563859122813, 0.16941736964779366, 0.288738726812057)),
751 ((0.48102730273877786, 0.1522385344365771, 0.5752150637264031, 0.39522973755221524),
752 (0.732520712427958, 0.49190588963815157, 0.6125760080831428, 0.2716702847832281),
753 (0.8159103581398756, 0.34507912842082983, 0.7075657623779936, 0.29530894172611916),
754 (0.5278442353318813, 0.6539972004065213, 0.48897529954240776, 0.7932403888940815)),
755 ((0.831358889394934, 0.48050345824229945, 0.6410388202892018, 0.8982570057418652),
756 (0.30388123939085465, 0.727912073121657, 0.543834760379716, 0.6710456332208439),
757 (0.4417259323277584, 0.5717441377950038, 0.3664067245442036, 0.3280925201821242),
758 (0.5400907637568426, 0.43207844188064887, 0.732946675152238, 0.5339092194505695)),
759 ((0.22369526225631464, 0.5665529520090573, 0.2653373517286637, 0.6914637769007175),
760 (0.22138531453529892, 0.17362665833183274, 0.11873401018627547, 0.48731998406078203),
761 (0.5508721228465998, 0.3492961556670177, 0.5692351404720578, 0.5107492266892075),
762 (0.17584863513461835, 0.35755945941346623, 0.7650117785966029, 0.48316674832514844))),
763 (((0.2982202413301988, 0.2348830652298031, 0.3114442699257422, 0.20218169729319738),
764 (0.6846710473822368, 0.8119003553529898, 0.1790804504032915, 0.4781252356617314),
765 (0.3766941501672641, 0.5437027703705374, 0.24423050827666176, 0.3323763024031741),
766 (0.8189980567608663, 0.5888920746029481, 0.17138276940268463, 0.5475256795584624)),
767 ((0.4569907243510988, 0.5255497422421722, 0.1680676291815795, 0.2879601796868399),
768 (0.5419471765149858, 0.8765158329632898, 0.21847500231364173, 0.6219663103942495),
769 (0.8993300494227338, 0.5256551743041176, 0.4312579142909404, 0.28503463714017396),
770 (0.6601304123050094, 0.9681225089321629, 0.6110831795473397, 0.630733896684101)),
771 ((0.7252549854189686, 0.48905018110325815, 0.3949054499635516, 0.6883221515509466),
772 (0.3510020242244332, 0.5964593467774927, 0.665927090247577, 0.19851750424804993),
773 (0.49702295298466764, 0.32952301722148614, 0.6578112215358343, 0.629875436683738),
774 (0.5228582859488041, 0.48834135369831744, 0.8107618558028835, 0.012956020032133924)),
775 ((0.3966015859408982, 0.19901168720580728, 0.6930890007374754, 0.7839579709117346),
776 (0.8623235889093344, 0.5661301336086426, 0.6547115325958021, 0.6689861941430038),
777 (0.5105113993916237, 0.7066840336625683, 0.8004786600943815, 0.5266845579213677),
778 (0.689553296868146j, 0.773301352126767j, 0.7364812118860565j, 0.5377502245784462))))
779
780
781 def get_array_inputL(self, rank, cplx):
782 z=self.get_python_inputL(rank, cplx)
783 return (numpy.array(z),numpy.array(z))
784
785 def get_array_input1(self, rank, cplx):
786 z=self.get_python_input1(rank, cplx)
787 return (numpy.array(z),numpy.array(z))
788
789 def get_array_input2(self, rank, cplx):
790 z=self.get_python_input2(rank, cplx)
791 return (numpy.array(z),numpy.array(z))
792
793 def get_array_input3(self, rank, cplx):
794 z=self.get_python_input3(rank, cplx)
795 return (numpy.array(z),numpy.array(z))
796
797 def get_const_inputL(self, rank, fs, cplx):
798 z=self.get_python_inputL(rank, cplx)
799 d=Data(z, fs)
800 return (d, numpy.array(z))
801
802 def get_const_input1(self, rank, fs, cplx):
803 z=self.get_python_input1(rank, cplx)
804 d=Data(z, fs)
805 return (d, numpy.array(z))
806
807 def get_const_input2(self, rank, fs, cplx):
808 z=self.get_python_input2(rank, cplx)
809 d=Data(z, fs)
810 return (d, numpy.array(z))
811
812 def get_expanded_inputL(self, rank, fs, cplx):
813 base=self.get_python_inputL(rank, cplx)
814 x=fs.getX()[0]
815 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
816 r=base*mask+(1-mask)*base
817 return (r, base)
818
819 def get_expanded_input1(self, rank, fs, cplx):
820 base=self.get_python_input1(rank, cplx)
821 x=fs.getX()[0]
822 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
823 r=base*mask+(1-mask)*base
824 return (r, base)
825
826 def get_tagged_inputL(self, rank, fs, cplx):
827 z=self.get_python_inputL(rank, cplx)
828 ref=self.get_array_inputL(rank, cplx)[0]
829 d=Data(z, fs)
830 d.tag()
831 return (d, ref)
832
833 def get_tagged_input1(self, rank, fs, cplx):
834 z=self.get_python_input1(rank, cplx)
835 ref=self.get_array_input1(rank, cplx)[0]
836 d=Data(z, fs)
837 d.tag()
838 return (d, ref)
839
840 def execute_ce_params(self, pars):
841 for v in pars:
842 a=v[0]
843 op=v[1]
844 misccheck=v[2]
845 ref=v[3]
846 oraclecheck=v[4]
847 description=v[5]
848 res=eval(op)
849 if misccheck is not None:
850 miscres=eval(misccheck)
851 if not miscres:
852 print("Failed check:"+misccheck)
853 print(type(a))
854 print(" vs ")
855 print(type(res))
856 print(" values:")
857 print(a)
858 print(res)
859 self.assertTrue(miscres,"Failed check for "+description)
860 oraclevalue=eval(oraclecheck)
861 oracleres=Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue)
862 if not oracleres:
863 print("Wrong result:"+oraclecheck)
864 print(type(res))
865 print(" vs ")
866 print(type(oraclevalue))
867 print(" values:")
868 print(res)
869 print(" vs ")
870 print(oraclevalue)
871 self.assertTrue(oracleres,"wrong result for "+description)
872
873 def execute_ce_throws(self, pars):
874 for v in pars:
875 a=v[0]
876 op=v[1]
877 misccheck=v[2]
878 ref=v[3]
879 oraclecheck=v[4]
880 description=v[5]
881 expected_exceptions=v[6]
882 if expected_exceptions is None:
883 expected_exceptions=(TypeError, RuntimeError) # These are used for unsupported complex
884 with self.assertRaises(Exception) as err:
885 res=eval(op)
886 # unfortunately, we don't return a single exception type in this case
887 self.assertTrue(type(err.exception) in expected_exceptions, "Exception was raised but it was of unexpected type ("+str(type(err.exception))+")")
888
889 def execute_t_params(self, pars):
890 for v in pars:
891 description=v[0]
892 a=v[1]
893 tagcount=1
894 for step in v[3:]:
895 a.setTaggedValue(tagcount, step[0])
896 op=step[1]
897 misccheck=step[2]
898 ref=step[3]
899 oraclecheck=step[4]
900 res=eval(op)
901 if misccheck is not None:
902 self.assertTrue(eval(misccheck), "Check failed for "+description+" checking "+misccheck)
903 if oraclecheck is not None:
904 oraclevalue=eval(oraclecheck)
905 else:
906 oraclevalue=ref
907 if not Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue):
908 print(v)
909 print(" This step ")
910 print(step)
911 print("Failed comparison:")
912 print(res)
913 print(" vs ")
914 print(oraclevalue)
915 print(" a= ")
916 print(a)
917 print(" ref== ")
918 print(ref)
919 print(" oraclecheck= ")
920 print(oraclecheck)
921 self.assertTrue(Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue),"wrong result for "+description+" for tag "+str(tagcount))
922 tagcount+=1
923
924
925 def execute_t_throws(self, pars):
926 for v in pars:
927 description=v[0]
928 a=v[1]
929 tagcount=1
930 expected_exceptions=v[2]
931 if expected_exceptions is None:
932 expected_exceptions=(TypeError, RuntimeError) # These are used for unsupported complex
933 for step in v[3:]:
934 a.setTaggedValue(tagcount, step[0])
935 op=step[1]
936 misccheck=step[2]
937 ref=step[3]
938 oraclecheck=step[4]
939 with self.assertRaises(Exception) as err:
940 res=eval(op)
941 self.assertTrue(type(err.exception) in expected_exceptions, "Exception was raised but it was of unexpected type ("+str(type(err.exception))+")")
942 tagcount+=1
943
944 def generate_operation_test_batch(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, update2, input_trans=None, no_scalars=False, multisteptag=True, minrank=0, maxrank=4,
945 expect_raise_on_ranks=None, expected_exceptions=None):
946 """
947 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
948 or tested to see if they raise (False)
949 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
950 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
951 opname is a string used to describe the operation being tested eg "inf"
952 update1 and update2 are strings giving code used to update a variable rmerge to
953 account for tag additions for tagged data.
954 eg: update1="r2.min()"
955 update2="min(rmerge, r3.min())"
956 would result in rmerge=eval(update1) running after the first tag is calculatedand
957 rmerge=eval(update2) running after the second
958 """
959 if input_trans is None:
960 input_trans=lambda x: x
961 if expect_raise_on_ranks is None:
962 expect_raise_on_ranks=()
963 pars=[]
964 epars=[] # operations which should throw
965 if not no_scalars:
966 (f1,f2)=self.get_scalar_input1(False)
967 f1=input_trans(f1)
968 f2=input_trans(f2)
969 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - scalar", expected_exceptions))
970 if supportcplx:
971 (f1,f2)=self.get_scalar_input1(True)
972 f1=input_trans(f1)
973 f2=input_trans(f2)
974 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar",expected_exceptions))
975 else:
976 (f1,f2)=self.get_scalar_input1(True)
977 f1=input_trans(f1)
978 f2=input_trans(f2)
979 epars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar", expected_exceptions))
980 for c in (False, True):
981 if c:
982 cs="complex "
983 else:
984 cs=""
985 for rank in range(minrank, maxrank+1):
986 dest=pars
987 if rank in expect_raise_on_ranks or (c and not supportcplx):
988 dest=epars
989 if not no_scalars:
990 (a, r)=self.get_array_input1(rank, c)
991 a=input_trans(a)
992 r=input_trans(r)
993 p=(a, opstring, misccheck, numpy.array(r), oraclecheck, opname+" - "+cs+"array rank "+str(rank), expected_exceptions)
994 dest.append(p)
995 (a, r)=self.get_const_input1(rank, self.functionspace, c)
996 a=input_trans(a)
997 r=input_trans(numpy.array(r))
998 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Constant Data rank "+str(rank), expected_exceptions)
999 dest.append(p)
1000 (a, r)=self.get_expanded_input1(rank, self.functionspace, c)
1001 a=input_trans(a)
1002 r=input_trans(numpy.array(r))
1003 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Expanded Data rank "+str(rank), expected_exceptions)
1004 dest.append(p)
1005 self.execute_ce_params(pars)
1006 self.execute_ce_throws(epars)
1007 del pars
1008 del epars
1009 tpars=[] # tagged versions
1010 epars=[]
1011 for c in (False, True):
1012 if c:
1013 cs="complex "
1014 else:
1015 cs=""
1016 for rank in range(minrank, maxrank+1):
1017 dest=tpars
1018 if rank in expect_raise_on_ranks or (c and not supportcplx):
1019 dest=epars
1020 test=[opname+" - "+cs+"tagged rank "+str(rank),]
1021 (a, r)=self.get_tagged_input1(rank, self.functionspace, c)
1022 a=input_trans(a)
1023 r=input_trans(numpy.array(r))
1024 test.append(a)
1025 test.append(expected_exceptions)
1026 # arguments are new tagged value, operation, extra check, reference_value, reference_check
1027 (t2, r2)=self.get_array_input2(rank, c)
1028 t2=input_trans(t2)
1029 r2=input_trans(numpy.array(r2))
1030 rmerge=eval(update1)
1031 test.append((t2, opstring, misccheck, rmerge, None,))
1032 if multisteptag:
1033 (t3, r3)=self.get_array_input3(rank, c)
1034 t3=input_trans(t3)
1035 r3=input_trans(numpy.array(r3))
1036 rmerge=eval(update2)
1037 test.append((t3, opstring, misccheck, rmerge, None,))
1038 dest.append(test)
1039 self.execute_t_params(tpars)
1040 self.execute_t_throws(epars)
1041
1042
1043 def generate_operation_test_batch_large(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, update2, input_trans=None, no_scalars=False, multisteptag=True, minrank=0, maxrank=4, expect_raise_on_ranks=None, expected_exceptions=None):
1044 """
1045 (At time of writing) This is the same as generate_operation_test_batch but using
1046 inputL to add some large (magnitude) values into the mix.
1047 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
1048 or tested to see if they raise (False)
1049 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
1050 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1051 opname is a string used to describe the operation being tested eg "inf"
1052 update1 and update2 are strings giving code used to update a variable rmerge to
1053 account for tag additions for tagged data.
1054 eg: update1="r2.min()"
1055 update2="min(rmerge, r3.min())"
1056 would result in rmerge=eval(update1) running after the first tag is calculatedand
1057 rmerge=eval(update2) running after the second
1058 """
1059 if input_trans is None:
1060 input_trans=lambda x: x
1061 if expect_raise_on_ranks is None:
1062 expect_raise_on_ranks=()
1063 pars=[]
1064 epars=[] # operations which should throw
1065 if not no_scalars:
1066 (f1,f2)=self.get_scalar_inputL(False)
1067 f1=input_trans(f1)
1068 f2=input_trans(f2)
1069 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - scalar", expected_exceptions))
1070 if supportcplx:
1071 (f1,f2)=self.get_scalar_inputL(True)
1072 f1=input_trans(f1)
1073 f2=input_trans(f2)
1074 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar", expected_exceptions))
1075 else:
1076 (f1,f2)=self.get_scalar_inputL(True)
1077 f1=input_trans(f1)
1078 f2=input_trans(f2)
1079 epars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar", expected_exceptions))
1080 for c in (False, True):
1081 dest=pars
1082 if c:
1083 cs="complex "
1084 else:
1085 cs=""
1086 for rank in range(minrank, maxrank+1):
1087 dest=pars
1088 if rank in expect_raise_on_ranks or (c and not supportcplx):
1089 dest=epars
1090 if not no_scalars:
1091 (a, r)=self.get_array_inputL(rank, c)
1092 a=input_trans(a)
1093 r=input_trans(r)
1094 p=(a, opstring, misccheck, numpy.array(r), oraclecheck, opname+" - "+cs+"array rank "+str(rank), expected_exceptions)
1095 dest.append(p)
1096 (a, r)=self.get_const_inputL(rank, self.functionspace, c)
1097 a=input_trans(a)
1098 r=input_trans(numpy.array(r))
1099 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Constant Data rank "+str(rank), expected_exceptions)
1100 dest.append(p)
1101 (a, r)=self.get_expanded_inputL(rank, self.functionspace, c)
1102 a=input_trans(a)
1103 r=input_trans(numpy.array(r))
1104 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Expanded Data rank "+str(rank), expected_exceptions)
1105 dest.append(p)
1106 self.execute_ce_params(pars)
1107 self.execute_ce_throws(epars)
1108 del pars
1109 del epars
1110 tpars=[] # tagged versions
1111 epars=[]
1112 for c in (False, True):
1113 dest=tpars
1114 if c:
1115 cs="complex "
1116 if not supportcplx:
1117 dest=epars
1118 else:
1119 cs=""
1120 for rank in range(minrank, maxrank+1):
1121 dest=tpars
1122 if rank in expect_raise_on_ranks or (c and not supportcplx):
1123 dest=epars
1124 test=[opname+" - "+cs+"tagged rank "+str(rank),]
1125 (a, r)=self.get_tagged_inputL(rank, self.functionspace, c)
1126 a=input_trans(a)
1127 r=input_trans(numpy.array(r))
1128 test.append(a)
1129 test.append(expected_exceptions)
1130 # arguments are new tagged value, operation, extra check, reference_value, reference_check
1131 (t2, r2)=self.get_array_inputL(rank, c)
1132 t2=input_trans(t2)
1133 r2=input_trans(numpy.array(r2))
1134 rmerge=eval(update1)
1135 test.append((t2, opstring, misccheck, rmerge, None,))
1136 if multisteptag:
1137 (t3, r3)=self.get_array_input3(rank, c)
1138 t3=input_trans(t3)
1139 r3=input_trans(numpy.array(r3))
1140 rmerge=eval(update2)
1141 test.append((t3, opstring, misccheck, rmerge, None,))
1142 dest.append(test)
1143 self.execute_t_params(tpars)
1144 self.execute_t_throws(epars)
1145
1146 class Test_util_base(Test_util_values):
1147 """
1148 basic tests on util.py
1149 """
1150 #=========================================================
1151 # File writer
1152 #=========================================================
1153 def setup(self):
1154 self.workdir=ESCRIPT_WORKDIR
1155
1156 def __checkContent(self,fn,ref_cont):
1157 cont=open(fn,'r').readlines()
1158 self.assertTrue(len(cont)==len(ref_cont),"wrong number of records")
1159 for i in range(len(cont)):
1160 self.assertTrue(cont[i].strip()==ref_cont[i],"wrong records %s"%i)
1161 def test_FileWriter_W(self):
1162 fn=os.path.join(self.workdir, "filewriter_w.txt")
1163 self.assertRaises(IOError,FileWriter,fn="",append=False)
1164 f=FileWriter(fn,append=False)
1165 self.assertTrue(f.name==fn, "wrong file name.")
1166 self.assertTrue(f.mode=='w', "wrong mode")
1167 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1168 self.assertTrue(not f.closed,"file shuold not be closed.")
1169 f.write("line1"+f.newlines)
1170 f.flush()
1171 self.__checkContent(fn,["line1"])
1172 f.writelines(["line2"+f.newlines, "line3"+f.newlines])
1173 f.close()
1174 self.assertTrue(f.closed,"file shuold be closed.")
1175 self.__checkContent(fn,["line1", "line2", "line3"])
1176 MPIBarrierWorld()
1177 if getMPIRankWorld()==0: os.unlink(fn)
1178
1179 def test_FileWriter_A(self):
1180 fn=os.path.join(self.workdir, "filewriter_a.txt")
1181 if getMPIRankWorld()==0: open(fn,'w').write("line1"+os.linesep)
1182 self.assertRaises(IOError,FileWriter,fn="",append=True)
1183 f=FileWriter(fn,append=True)
1184 self.assertTrue(f.name==fn, "wrong file name.")
1185 self.assertTrue(f.mode=='a', "wrong mode")
1186 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1187 self.assertTrue(not f.closed,"file shuold not be closed.")
1188 f.write("line2"+f.newlines)
1189 f.flush()
1190 self.__checkContent(fn,["line1", "line2"])
1191 f.writelines(["line3"+f.newlines, "line4"+f.newlines])
1192 f.close()
1193 self.assertTrue(f.closed,"file shuold be closed.")
1194 self.__checkContent(fn,["line1", "line2", "line3", "line4"])
1195 MPIBarrierWorld()
1196 if getMPIRankWorld()==0: os.unlink(fn)
1197
1198 def test_FileWriter_A_loc(self):
1199 fn=os.path.join(self.workdir, "filewriter_a_loc.txt")
1200 if getMPIRankWorld()>0:
1201 fn2=fn+".%s"%getMPIRankWorld()
1202 else:
1203 fn2=fn
1204 open(fn2,'w').write("line1"+os.linesep)
1205 self.assertRaises(IOError,FileWriter,fn="",append=True, createLocalFiles=True)
1206 f=FileWriter(fn,append=True,createLocalFiles=True)
1207 self.assertTrue(f.name==fn, "wrong file name.")
1208 self.assertTrue(f.mode=='a', "wrong mode")
1209 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1210 self.assertTrue(not f.closed,"file shuold not be closed.")
1211 f.write("line2"+f.newlines)
1212 f.flush()
1213 self.__checkContent(fn2,["line1", "line2"])
1214 f.writelines(["line3"+f.newlines, "line4"+f.newlines])
1215 f.close()
1216 self.assertTrue(f.closed,"file shuold be closed.")
1217 self.__checkContent(fn2,["line1", "line2", "line3", "line4"])
1218 os.unlink(fn2)
1219
1220 def test_FileWriter_W_loc(self):
1221 fn=os.path.join(self.workdir, "filewriter_w_loc.txt")
1222 if getMPIRankWorld()>0:
1223 fn2=fn+".%s"%getMPIRankWorld()
1224 else:
1225 fn2=fn
1226 self.assertRaises(IOError,FileWriter,fn="",append=True, createLocalFiles=True)
1227 f=FileWriter(fn,append=False,createLocalFiles=True)
1228 self.assertTrue(f.name==fn, "wrong file name.")
1229 self.assertTrue(f.mode=='w', "wrong mode")
1230 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1231 self.assertTrue(not f.closed,"file shuold not be closed.")
1232 f.write("line1"+f.newlines)
1233 f.flush()
1234 self.__checkContent(fn2,["line1"])
1235 f.writelines(["line2"+f.newlines, "line3"+f.newlines])
1236 f.close()
1237 self.assertTrue(f.closed,"file shuold be closed.")
1238 self.__checkContent(fn2,["line1", "line2", "line3"])
1239 os.unlink(fn2)
1240
1241 #=========================================================
1242 # constants
1243 #=========================================================
1244 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1245 def test_kronecker_1(self):
1246 val=kronecker(d=1)
1247 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1248 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1249 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1250 def test_kronecker_2(self):
1251 val=kronecker(d=2)
1252 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1253 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1254 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1255 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1256 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1257 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1258 def test_kronecker_3(self):
1259 val=kronecker(d=3)
1260 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1261 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1262 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1263 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1264 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1265 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1266 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1267 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1268 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1269 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1270 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1271 def test_kronecker_domain(self):
1272 val=kronecker(d=self.domain)
1273 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1274 self.assertEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
1275 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1276 def test_kronecker_functionspace(self):
1277 val=kronecker(d=self.functionspace)
1278 self.assertTrue(isinstance(val,escript.Data),"wrong type of result.")
1279 self.assertEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
1280 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1281 def test_identityTensor_1(self):
1282 val=identityTensor(d=1)
1283 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1284 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1285 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1286 def test_identityTensor_2(self):
1287 val=identityTensor(d=2)
1288 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1289 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1290 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1291 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1292 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1293 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1294 def test_identityTensor_3(self):
1295 val=identityTensor(d=3)
1296 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1297 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1298 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1299 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1300 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1301 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1302 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1303 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1304 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1305 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1306 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1307 def test_identityTensor_domain(self):
1308 val=identityTensor(d=self.domain)
1309 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1310 self.assertEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
1311 if self.domain.getDim()==2:
1312 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1313 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1314 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1315 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1316 if self.domain.getDim()==3:
1317 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1318 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1319 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1320 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1321 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1322 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1323 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1324 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1325 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1326 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1327 def test_identityTensor_functionspace(self):
1328 val=identityTensor(d=self.functionspace)
1329 self.assertTrue(isinstance(val,escript.Data),"wrong type of result.")
1330 self.assertEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
1331 if self.domain.getDim()==2:
1332 self.assertTrue(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
1333 self.assertTrue(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
1334 self.assertTrue(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
1335 self.assertTrue(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
1336 if self.domain.getDim()==3:
1337 self.assertTrue(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
1338 self.assertTrue(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
1339 self.assertTrue(Lsup(val[0,2]-0.0)<=self.RES_TOL,"wrong value for (0,2)")
1340 self.assertTrue(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
1341 self.assertTrue(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
1342 self.assertTrue(Lsup(val[1,2]-0.0)<=self.RES_TOL,"wrong value for (1,2)")
1343 self.assertTrue(Lsup(val[2,0]-0.0)<=self.RES_TOL,"wrong value for (2,0)")
1344 self.assertTrue(Lsup(val[2,1]-0.0)<=self.RES_TOL,"wrong value for (2,1)")
1345 self.assertTrue(Lsup(val[2,2]-1.0)<=self.RES_TOL,"wrong value for (2,2)")
1346 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1347 def test_identityTensor4_1(self):
1348 val=identityTensor4(d=1)
1349 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1350 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1351 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1352 def test_identityTensor4_2(self):
1353 val=identityTensor4(d=2)
1354 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1355 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1356 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1357 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1358 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1359 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1360 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1361 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1362 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1363 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1364 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1365 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1366 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1367 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1368 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
1369 self.assertEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
1370 self.assertEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
1371 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1372 def test_identityTensor4_3(self):
1373 val=identityTensor4(d=3)
1374 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1375 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1376 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1377 self.assertEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")
1378 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1379 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1380 self.assertEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")
1381 self.assertEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")
1382 self.assertEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")
1383 self.assertEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")
1384 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1385 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1386 self.assertEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")
1387 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1388 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1389 self.assertEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")
1390 self.assertEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")
1391 self.assertEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")
1392 self.assertEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")
1393 self.assertEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")
1394 self.assertEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")
1395 self.assertEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")
1396 self.assertEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")
1397 self.assertEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")
1398 self.assertEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")
1399 self.assertEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")
1400 self.assertEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")
1401 self.assertEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")
1402 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1403 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1404 self.assertEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")
1405 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1406 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1407 self.assertEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")
1408 self.assertEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")
1409 self.assertEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")
1410 self.assertEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")
1411 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1412 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
1413 self.assertEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")
1414 self.assertEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
1415 self.assertEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
1416 self.assertEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")
1417 self.assertEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")
1418 self.assertEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")
1419 self.assertEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")
1420 self.assertEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")
1421 self.assertEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")
1422 self.assertEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")
1423 self.assertEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")
1424 self.assertEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")
1425 self.assertEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")
1426 self.assertEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")
1427 self.assertEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")
1428 self.assertEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")
1429 self.assertEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")
1430 self.assertEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")
1431 self.assertEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")
1432 self.assertEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")
1433 self.assertEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")
1434 self.assertEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")
1435 self.assertEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")
1436 self.assertEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")
1437 self.assertEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")
1438 self.assertEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")
1439 self.assertEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")
1440 self.assertEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")
1441 self.assertEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")
1442 self.assertEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")
1443 self.assertEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")
1444 self.assertEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")
1445 self.assertEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")
1446 self.assertEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")
1447 self.assertEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")
1448 self.assertEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")
1449 self.assertEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")
1450 self.assertEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")
1451 self.assertEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")
1452 self.assertEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")
1453 self.assertEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")
1454 self.assertEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")
1455 self.assertEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")
1456 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1457 def test_identityTensor4_domain(self):
1458 val=identityTensor4(d=self.domain)
1459 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1460 self.assertEqual(val.shape,(self.domain.getDim(),self.domain.getDim(),self.domain.getDim(),self.domain.getDim()),"wrong shape.")
1461 if self.domain.getDim()==2:
1462 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1463 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1464 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1465 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1466 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1467 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1468 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1469 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1470 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1471 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1472 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1473 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1474 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1475 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
1476 self.assertEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
1477 self.assertEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
1478 if self.domain.getDim()==3:
1479 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1480 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1481 self.assertEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")
1482 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1483 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1484 self.assertEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")
1485 self.assertEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")
1486 self.assertEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")
1487 self.assertEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")
1488 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1489 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1490 self.assertEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")
1491 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1492 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1493 self.assertEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")
1494 self.assertEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")
1495 self.assertEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")
1496 self.assertEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")
1497 self.assertEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")
1498 self.assertEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")
1499 self.assertEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")
1500 self.assertEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")
1501 self.assertEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")
1502 self.assertEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")
1503 self.assertEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")
1504 self.assertEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")
1505 self.assertEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")
1506 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1507 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1508 self.assertEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")
1509 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1510 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1511 self.assertEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")
1512 self.assertEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")
1513 self.assertEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")
1514 self.assertEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")
1515 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1516 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
1517 self.assertEqual(val[1,1,0,2],0.0,"wrong value for (1,1,0,2)")
1518 self.assertEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
1519 self.assertEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
1520 self.assertEqual(val[1,1,1,2],0.0,"wrong value for (1,1,1,2)")
1521 self.assertEqual(val[1,1,2,0],0.0,"wrong value for (1,1,2,0)")
1522 self.assertEqual(val[1,1,2,1],0.0,"wrong value for (1,1,2,1)")
1523 self.assertEqual(val[1,1,2,2],0.0,"wrong value for (1,1,2,2)")
1524 self.assertEqual(val[1,2,0,0],0.0,"wrong value for (1,2,0,0)")
1525 self.assertEqual(val[1,2,0,1],0.0,"wrong value for (1,2,0,1)")
1526 self.assertEqual(val[1,2,0,2],0.0,"wrong value for (1,2,0,2)")
1527 self.assertEqual(val[1,2,1,0],0.0,"wrong value for (1,2,1,0)")
1528 self.assertEqual(val[1,2,1,1],0.0,"wrong value for (1,2,1,1)")
1529 self.assertEqual(val[1,2,1,2],1.0,"wrong value for (1,2,1,2)")
1530 self.assertEqual(val[1,2,2,0],0.0,"wrong value for (1,2,2,0)")
1531 self.assertEqual(val[1,2,2,1],0.0,"wrong value for (1,2,2,1)")
1532 self.assertEqual(val[1,2,2,2],0.0,"wrong value for (1,2,2,2)")
1533 self.assertEqual(val[2,0,0,0],0.0,"wrong value for (2,0,0,0)")
1534 self.assertEqual(val[2,0,0,1],0.0,"wrong value for (2,0,0,1)")
1535 self.assertEqual(val[2,0,0,2],0.0,"wrong value for (2,0,0,2)")
1536 self.assertEqual(val[2,0,1,0],0.0,"wrong value for (2,0,1,0)")
1537 self.assertEqual(val[2,0,1,1],0.0,"wrong value for (2,0,1,1)")
1538 self.assertEqual(val[2,0,1,2],0.0,"wrong value for (2,0,1,2)")
1539 self.assertEqual(val[2,0,2,0],1.0,"wrong value for (2,0,2,0)")
1540 self.assertEqual(val[2,0,2,1],0.0,"wrong value for (2,0,2,1)")
1541 self.assertEqual(val[2,0,2,2],0.0,"wrong value for (2,0,2,2)")
1542 self.assertEqual(val[2,1,0,0],0.0,"wrong value for (2,1,0,0)")
1543 self.assertEqual(val[2,1,0,1],0.0,"wrong value for (2,1,0,1)")
1544 self.assertEqual(val[2,1,0,2],0.0,"wrong value for (2,1,0,2)")
1545 self.assertEqual(val[2,1,1,0],0.0,"wrong value for (2,1,1,0)")
1546 self.assertEqual(val[2,1,1,1],0.0,"wrong value for (2,1,1,1)")
1547 self.assertEqual(val[2,1,1,2],0.0,"wrong value for (2,1,1,2)")
1548 self.assertEqual(val[2,1,2,0],0.0,"wrong value for (2,1,2,0)")
1549 self.assertEqual(val[2,1,2,1],1.0,"wrong value for (2,1,2,1)")
1550 self.assertEqual(val[2,1,2,2],0.0,"wrong value for (2,1,2,2)")
1551 self.assertEqual(val[2,2,0,0],0.0,"wrong value for (2,2,0,0)")
1552 self.assertEqual(val[2,2,0,1],0.0,"wrong value for (2,2,0,1)")
1553 self.assertEqual(val[2,2,0,2],0.0,"wrong value for (2,2,0,2)")
1554 self.assertEqual(val[2,2,1,0],0.0,"wrong value for (2,2,1,0)")
1555 self.assertEqual(val[2,2,1,1],0.0,"wrong value for (2,2,1,1)")
1556 self.assertEqual(val[2,2,1,2],0.0,"wrong value for (2,2,1,2)")
1557 self.assertEqual(val[2,2,2,0],0.0,"wrong value for (2,2,2,0)")
1558 self.assertEqual(val[2,2,2,1],0.0,"wrong value for (2,2,2,1)")
1559 self.assertEqual(val[2,2,2,2],1.0,"wrong value for (2,2,2,2)")
1560 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1561 def test_identityTensor4_functionspace(self):
1562 val=identityTensor4(d=self.functionspace)
1563 self.assertTrue(isinstance(val,escript.Data),"wrong type of result.")
1564 self.assertEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
1565 if self.domain.getDim()==2:
1566 self.assertTrue(Lsup(val[0,0,0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0,0,0)")
1567 self.assertTrue(Lsup(val[0,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,1)")
1568 self.assertTrue(Lsup(val[0,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,0)")
1569 self.assertTrue(Lsup(val[0,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,1)")
1570 self.assertTrue(Lsup(val[0,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,0)")
1571 self.assertTrue(Lsup(val[0,1,0,1]-1.0)<=self.RES_TOL,"wrong value for (0,1,0,1)")
1572 self.assertTrue(Lsup(val[0,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,0)")
1573 self.assertTrue(Lsup(val[0,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,1)")
1574 self.assertTrue(Lsup(val[1,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,0)")
1575 self.assertTrue(Lsup(val[1,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,1)")
1576 self.assertTrue(Lsup(val[1,0,1,0]-1.0)<=self.RES_TOL,"wrong value for (1,0,1,0)")
1577 self.assertTrue(Lsup(val[1,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,1)")
1578 self.assertTrue(Lsup(val[1,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,0)")
1579 self.assertTrue(Lsup(val[1,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,1)")
1580 self.assertTrue(Lsup(val[1,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,0)")
1581 self.assertTrue(Lsup(val[1,1,1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1,1,1)")
1582 if self.domain.getDim()==3:
1583 self.assertTrue(Lsup(val[0,0,0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0,0,0)")
1584 self.assertTrue(Lsup(val[0,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,1)")
1585 self.assertTrue(Lsup(val[0,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,0,2)")
1586 self.assertTrue(Lsup(val[0,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,0)")
1587 self.assertTrue(Lsup(val[0,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,1)")
1588 self.assertTrue(Lsup(val[0,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,1,2)")
1589 self.assertTrue(Lsup(val[0,0,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,0)")
1590 self.assertTrue(Lsup(val[0,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,1)")
1591 self.assertTrue(Lsup(val[0,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,0,2,2)")
1592 self.assertTrue(Lsup(val[0,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,0)")
1593 self.assertTrue(Lsup(val[0,1,0,1]-1.0)<=self.RES_TOL,"wrong value for (0,1,0,1)")
1594 self.assertTrue(Lsup(val[0,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,0,2)")
1595 self.assertTrue(Lsup(val[0,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,0)")
1596 self.assertTrue(Lsup(val[0,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,1)")
1597 self.assertTrue(Lsup(val[0,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,1,2)")
1598 self.assertTrue(Lsup(val[0,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,0)")
1599 self.assertTrue(Lsup(val[0,1,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,1)")
1600 self.assertTrue(Lsup(val[0,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,1,2,2)")
1601 self.assertTrue(Lsup(val[0,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,0,0)")
1602 self.assertTrue(Lsup(val[0,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,0,1)")
1603 self.assertTrue(Lsup(val[0,2,0,2]-1.0)<=self.RES_TOL,"wrong value for (0,2,0,2)")
1604 self.assertTrue(Lsup(val[0,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,0)")
1605 self.assertTrue(Lsup(val[0,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,1)")
1606 self.assertTrue(Lsup(val[0,2,1,2]-0.0)<=self.RES_TOL,"wrong value for (0,2,1,2)")
1607 self.assertTrue(Lsup(val[0,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,0)")
1608 self.assertTrue(Lsup(val[0,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,1)")
1609 self.assertTrue(Lsup(val[0,2,2,2]-0.0)<=self.RES_TOL,"wrong value for (0,2,2,2)")
1610 self.assertTrue(Lsup(val[1,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,0)")
1611 self.assertTrue(Lsup(val[1,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,1)")
1612 self.assertTrue(Lsup(val[1,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,0,2)")
1613 self.assertTrue(Lsup(val[1,0,1,0]-1.0)<=self.RES_TOL,"wrong value for (1,0,1,0)")
1614 self.assertTrue(Lsup(val[1,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,1)")
1615 self.assertTrue(Lsup(val[1,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,1,2)")
1616 self.assertTrue(Lsup(val[1,0,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,0)")
1617 self.assertTrue(Lsup(val[1,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,1)")
1618 self.assertTrue(Lsup(val[1,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,0,2,2)")
1619 self.assertTrue(Lsup(val[1,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,0)")
1620 self.assertTrue(Lsup(val[1,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,1)")
1621 self.assertTrue(Lsup(val[1,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,0,2)")
1622 self.assertTrue(Lsup(val[1,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,0)")
1623 self.assertTrue(Lsup(val[1,1,1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1,1,1)")
1624 self.assertTrue(Lsup(val[1,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,1,2)")
1625 self.assertTrue(Lsup(val[1,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,0)")
1626 self.assertTrue(Lsup(val[1,1,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,1)")
1627 self.assertTrue(Lsup(val[1,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,1,2,2)")
1628 self.assertTrue(Lsup(val[1,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,0)")
1629 self.assertTrue(Lsup(val[1,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,1)")
1630 self.assertTrue(Lsup(val[1,2,0,2]-0.0)<=self.RES_TOL,"wrong value for (1,2,0,2)")
1631 self.assertTrue(Lsup(val[1,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,1,0)")
1632 self.assertTrue(Lsup(val[1,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,1,1)")
1633 self.assertTrue(Lsup(val[1,2,1,2]-1.0)<=self.RES_TOL,"wrong value for (1,2,1,2)")
1634 self.assertTrue(Lsup(val[1,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,0)")
1635 self.assertTrue(Lsup(val[1,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,1)")
1636 self.assertTrue(Lsup(val[1,2,2,2]-0.0)<=self.RES_TOL,"wrong value for (1,2,2,2)")
1637 self.assertTrue(Lsup(val[2,0,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,0)")
1638 self.assertTrue(Lsup(val[2,0,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,1)")
1639 self.assertTrue(Lsup(val[2,0,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,0,2)")
1640 self.assertTrue(Lsup(val[2,0,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,0)")
1641 self.assertTrue(Lsup(val[2,0,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,1)")
1642 self.assertTrue(Lsup(val[2,0,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,1,2)")
1643 self.assertTrue(Lsup(val[2,0,2,0]-1.0)<=self.RES_TOL,"wrong value for (2,0,2,0)")
1644 self.assertTrue(Lsup(val[2,0,2,1]-0.0)<=self.RES_TOL,"wrong value for (2,0,2,1)")
1645 self.assertTrue(Lsup(val[2,0,2,2]-0.0)<=self.RES_TOL,"wrong value for (2,0,2,2)")
1646 self.assertTrue(Lsup(val[2,1,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,0)")
1647 self.assertTrue(Lsup(val[2,1,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,1)")
1648 self.assertTrue(Lsup(val[2,1,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,0,2)")
1649 self.assertTrue(Lsup(val[2,1,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,0)")
1650 self.assertTrue(Lsup(val[2,1,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,1)")
1651 self.assertTrue(Lsup(val[2,1,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,1,2)")
1652 self.assertTrue(Lsup(val[2,1,2,0]-0.0)<=self.RES_TOL,"wrong value for (2,1,2,0)")
1653 self.assertTrue(Lsup(val[2,1,2,1]-1.0)<=self.RES_TOL,"wrong value for (2,1,2,1)")
1654 self.assertTrue(Lsup(val[2,1,2,2]-0.0)<=self.RES_TOL,"wrong value for (2,1,2,2)")
1655 self.assertTrue(Lsup(val[2,2,0,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,0)")
1656 self.assertTrue(Lsup(val[2,2,0,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,1)")
1657 self.assertTrue(Lsup(val[2,2,0,2]-0.0)<=self.RES_TOL,"wrong value for (2,2,0,2)")
1658 self.assertTrue(Lsup(val[2,2,1,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,0)")
1659 self.assertTrue(Lsup(val[2,2,1,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,1)")
1660 self.assertTrue(Lsup(val[2,2,1,2]-0.0)<=self.RES_TOL,"wrong value for (2,2,1,2)")
1661 self.assertTrue(Lsup(val[2,2,2,0]-0.0)<=self.RES_TOL,"wrong value for (2,2,2,0)")
1662 self.assertTrue(Lsup(val[2,2,2,1]-0.0)<=self.RES_TOL,"wrong value for (2,2,2,1)")
1663 self.assertTrue(Lsup(val[2,2,2,2]-1.0)<=self.RES_TOL,"wrong value for (2,2,2,2)")
1664 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1665 def test_unitVector_1(self):
1666 val=unitVector(i=0,d=1)
1667 self.assertEqual(val[0],1.0,"wrong value for 0 in the 0 vector")
1668 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1669 def test_unitVector_2(self):
1670 val=unitVector(i=0,d=2)
1671 self.assertEqual(val[0],1.0,"wrong value for 0 in the 0 vector")
1672 self.assertEqual(val[1],0.0,"wrong value for 1 in the 0 vector")
1673 val=unitVector(i=1,d=2)
1674 self.assertEqual(val[0],0.0,"wrong value for 0 in the 1 vector")
1675 self.assertEqual(val[1],1.0,"wrong value for 1 in the 1 vector")
1676 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1677 def test_unitVector_3(self):
1678 val=unitVector(i=0,d=3)
1679 self.assertEqual(val[0],1.0,"wrong value for 0 in the 0 vector")
1680 self.assertEqual(val[1],0.0,"wrong value for 1 in the 0 vector")
1681 self.assertEqual(val[2],0.0,"wrong value for 2 in the 0 vector")
1682 val=unitVector(i=1,d=3)
1683 self.assertEqual(val[0],0.0,"wrong value for 0 in the 1 vector")
1684 self.assertEqual(val[1],1.0,"wrong value for 1 in the 1 vector")
1685 self.assertEqual(val[2],0.0,"wrong value for 2 in the 1 vector")
1686 val=unitVector(i=2,d=3)
1687 self.assertEqual(val[0],0.0,"wrong value for 0 in the 2 vector")
1688 self.assertEqual(val[1],0.0,"wrong value for 1 in the 2 vector")
1689 self.assertEqual(val[2],1.0,"wrong value for 2 in the 2 vector")
1690 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1691 def test_unitVector_domain(self):
1692 val=unitVector(i=0,d=self.domain)
1693 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1694 self.assertEqual(val.shape,(self.domain.getDim(),),"wrong shape.")
1695 if self.domain.getDim()==2:
1696 self.