/[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 6545 - (show annotations)
Fri Mar 24 00:21:35 2017 UTC (8 months, 3 weeks ago) by jfenwick
File MIME type: text/x-python
File size: 178960 byte(s)
Fixing the last commit.   (I did test it)
1
2 ##############################################################################
3 #
4 # Copyright (c) 2003-2017 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-2017 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 def makeTagged(self, fs, v1, v2):
84 """
85 Helper routine which makes a DataTagged containing the two values
86 (v1 as default and v2 as tag 1).
87 """
88 d=Data(v1, fs)
89 d.setTaggedValue(1, v2)
90 return d
91
92 def get_scalar_inputL(self, cplx):
93 if not cplx:
94 v1=33489.58300735649
95 else:
96 v1=(9824.950442887115-46215.48181304759j)
97 return (v1,v1)
98
99 def get_python_inputL(self, rank, cplx):
100 if cplx:
101 if rank==0:
102 return (-3960.4642291825876+70893.2937559552j,)
103 if rank==1:
104 return ((59731.62346830329-82535.93558513945j), (97413.28611726397-71163.21858234056j))
105 if rank==2:
106 return (((22662.9306818+10450.1928396j), (-5876.588037489+31316.069231294925j)),
107 ((-48775.88574400305+21535.3746218j), (36479.6003269178-39287.306108j)))
108 if rank==3:
109 return ((((-50847.97960-9062.27j), (-63529.6088+55171.4663j), (215.4-10185.37j)),
110 ((40080.58380528418-34586.4289827135j), (-27276.009276950237-61855.16687539085j), (-34721.25780748475+82851.2788274762j)),
111 ((43010.5425+18456.0305j), (-8655.17674+4404.157j), (23658.850518231033-20372.09007648639j))),
112 (((43347.843141+58591.16j), (25836.3146-5995.971j), (-28969.5+31065.035j)),
113 ((-31942.46+61141.334j), (-84655.794+49812.188j), (63001.6-44321.65j)),
114 ((-19368.317+29114.8j), (-84938.09+83917.34j), (30356.3+48962.755j))),
115 (((-50756.5-28925.102j), (3348.16+79354.6j), (30159.52+6881.75j)),
116 ((59025.953-39.831j), (-237.942-53.93j), (9308.8+36247.003775959376j)),
117 ((12068.153033533716-68009.47095735556j), (7693.602018284684-23713.22567007532j), (44993.89718529736-3807.1609666917066j))))
118 if rank==4:
119 return (((((36743.82175242095+26778.737326529765j), (-29754.182129388544+25393.077634889414j), (-7835.209676340906+49819.26015705921j), (33964.789417447566-32778.45444590585j)),
120 ((-44579.370809357875-68703.24361188836j), (-149.28320431357133-64698.83715098185j), (38295.13314270778+58425.02740389345j), (-59088.20438563965-81586.99049191552j)),
121 ((22892.612062358283-24715.70868029048j), (13367.867311961876+20860.578306432217j), (-47859.40778589482+71392.8351064374j), (-2304.287041885458+49294.11306179231j)),
122 ((-62640.841478880255+36871.688232087705j), (10655.923749286507-23128.560897714342j), (-4131.801825297647+4443.2840182007785j), (-27903.670838787744-3117.482981970883j))),
123 (((57034.38962108706+38044.26403584313j), (-4462.844355084104+18211.587917962242j), (4313.178312608696-12868.233657189892j), (46374.72869675713-11812.40480331378j)),
124 ((322.189068738895+47179.67709271595j), (72322.13544947651-3662.5467369358375j), (-9231.467186395414+76230.40517770775j), (-41704.75682501451+32558.11893996234j)),
125 ((79487.23328596324-7366.42862253316j), (10481.924314965669-15120.283604848068j), (26960.83136881994-41071.566704782505j), (-24115.39190283895-7711.336401151741j)),
126 ((22474.95612418659+15623.165463453799j), (25929.087385707462+38175.58304877044j), (-8177.232611463696+21287.640323926986j), (34229.957465479616+34000.54107560321j))),
127 (((26772.169008338446-23226.644157592586j), (44355.462946645705+38435.617150983846j), (82270.23681598579+57228.460214922394j), (-61649.67759149854-29496.646828970726j)),
128 ((33208.12540969731-42543.11381431012j), (-37368.19634070844+36983.91078521421j), (-53479.67762639474+69192.57351520905j), (-16987.119998626833-24907.621827720854j)),
129 ((58265.74226484515+21428.598358311836j), (-25451.773790957814+34641.52936103524j), (49737.44278424142+46668.70872917027j), (-19763.07777821306-55742.60412333406j)),
130 ((39696.62704009203+11792.880723760507j), (45040.78931593459+1353.15524889082j), (38919.41458390256+5018.601358823813j), (24700.01773615746+18638.158415414437j))),
131 (((-27357.697301503198+67993.98776577965j), (43358.65691551873-60981.94828910699j), (-36961.845280498295+73544.32798356535j), (-7005.460088561973+56718.32085849555j)),
132 ((-45794.83454061549-24789.54243897248j), (-35553.771747041705+281.20812003471656j), (741.8214864204201-48926.27892674535j), (15258.748935604614+5750.3134710095765j)),
133 ((13578.214948777008+49023.37779316875j), (-52997.87500887418-28291.632747669166j), (34523.01328904568+70373.31760549065j), (-8549.195292188699+38710.00933198735j)),
134 ((-8724.746595711767+39671.57400059246j), (54220.76682697828+52787.45089736888j), (-2929.7928072663053-14645.947666259133j), (6967.3562262647465+20575.621108094565j)))),
135 ((((41255.3128726088-4735.07598620026j), (17330.015550087788+39190.403383224395j), (-2409.2939922655205+33755.22845153985j), (-84016.4244828014-28839.63999275923j)),
136 ((-7567.298951515288+24481.103774662595j), (-25149.082523503632-8583.669927251554j), (47788.23750305794+37492.05579481191j), (-19575.167208193656+21113.148224316566j)),
137 ((-8076.55304084401+75096.61990916729j), (42138.65038370111-27451.77036345769j), (17599.47893995483-6322.617589222951j), (43000.60101023788+54422.76834543564j)),
138 ((-24961.480874041634-2122.019874702237j), (6425.889470030932+5622.557974648473j), (-65254.39721134174+59644.00375157643j), (-26617.634404672892-53495.819302484895j))),
139 (((-54060.398876227686+55992.77686553825j), (-29817.626727209106-29704.79980981775j), (-6767.670138070098+10024.257522469488j), (-30133.80524111932+40328.89815642918j)),
140 ((50000.78584499907-5894.192721755971j), (-3021.8049413580593-70247.81603731646j), (695.299152508218+58895.55560166443j), (-16680.2648353032-87022.82137596376j)),
141 ((14249.594063942364-1274.074993916045j), (12234.307608613788-18357.139710977237j), (32290.96562094186+38793.36224883628j), (67656.21258170376-9760.573070193976j)),
142 ((-45601.023706816115-74319.21757213926j), (55876.22452146437-61120.98256716965j), (58027.41230717529+10786.688485100865j), (-3495.6762613661413-46756.553429873304j))),
143 (((92894.48804954227+23902.59394418483j), (1353.988548653011-92567.68243719656j), (65397.064463537616+10248.124624835778j), (567.8160836168245+78786.59184031615j)),
144 ((-40282.49291521364+79825.32258981027j), (-40310.88688269715+455.4179428850184j), (-11166.391823961778+2764.918200738073j), (78697.6368921528-685.3372273494751j)),
145 ((70892.98538412598+78843.94735644812j), (-64882.52692417733+80256.3932249126j), (26045.841803168907-12175.162753092736j), (-58159.5440761434-67887.15729778618j)),
146 ((8775.14598500292+16795.25423101084j), (13155.934674011907+16737.126752117358j), (15975.852541323125+14513.776915618466j), (-25215.109458495746+8530.276446405784j))),
147 (((25795.767870170166-31056.851297134257j), (4037.894742402088-83.2035600123636j), (-19413.455650262404+40693.39115961014j), (-63145.75424957367+34735.00168222326j)),
148 ((17181.9690394505+18815.796074907106j), (45370.782381827026+55332.61058358025j), (-15112.046450780603-88000.14177105221j), (81609.38175982882+21862.010369853655j)),
149 ((-55560.45495276697-8487.570486260593j), (-1240.3046453718998-36806.93746782728j), (2314.7751094353007+66709.2996375249j), (73913.798692593+17715.330241595133j)),
150 ((-6756.64963479065-17680.06798381319j), (-68433.87475450675-1521.61274877697j), (-38429.70821819296-59684.70774465629j), (679.6723316871648-5141.593014362268j)))),
151 ((((6009.97586310716+60604.30942478338j), (32396.109723949165-43790.651419414105j), (28779.550340574773+51904.28569017858j), (22898.47954312162+24374.281930383077j)),
152 ((43337.67939273335-5975.004215923647j), (-20668.774830910013-76079.20355770885j), (28645.123677151292+25672.909247014104j), (-31717.682104715685+9732.221717787586j)),
153 ((53661.13842896042+72923.84155787138j), (35385.072072520015-6307.198139944798j), (30479.544507534592+62234.1254985712j), (-1034.7905621764367+40286.709890159545j)),
154 ((-81367.55312016135+16928.505901155673j), (-7815.888755622378+6045.680730129257j), (23493.410721616994+56525.86301109548j), (64379.29795689413-41596.85817228346j))),
155 (((10077.706189869234-14023.344225890105j), (9787.45494885469+1980.526605239269j), (-41789.42734084199+33109.62355852481j), (77722.47714091674+16230.914008263571j)),
156 ((33929.99686388744+69324.24249861641j), (-42944.721176775936+77239.49498876408j), (-24531.218551429585+33511.72101875048j), (38167.50870231599+48640.295148756864j)),
157 ((5153.059156082629+82411.43319343394j), (46237.63154724835-24482.044081531683j), (-42350.512586094905+21364.573202395462j), (27884.705448024964+27406.374083228744j)),
158 ((26735.822927676723-16229.136581069019j), (-20377.70277018177-48828.24171348816j), (-31499.21640336576-14810.9243228345j), (-7904.957576446148-20229.149437926535j))),
159 (((16522.705470639165+17310.831386237332j), (-76148.34984139015+80969.93773509384j), (-24811.00749069672+38047.29320608019j), (20992.172136102876-22605.533994627098j)),
160 ((-20970.94805191878-11158.194764479718j), (-24776.365668172788+15335.11508002579j), (31475.965557547286+42101.17185492054j), (-5067.057332858472-32895.81793448307j)),
161 ((2682.2679111504112+39461.2760464704j), (8347.197026209295+5913.884037792421j), (-33487.63388762134-63339.09288353257j), (-57157.881248657024+1556.61791639906j)),
162 ((-41068.04079080766+48584.07702236999j), (8498.148930898213+14312.48564445498j), (-21316.05107180962+87054.88334056246j), (-21471.236761054563-59830.259831579846j))),
163 (((29431.72773241329-33178.12936911729j), (26409.71652118041+55871.26981512072j), (66462.49459072504+84224.15533504078j), (54448.348792259174+24319.32902355393j)),
164 ((-71328.38862684023+23367.89957869296j), (-59401.71170696309+49485.585597715195j), (41883.2210796735+19719.46171899562j), (-18795.333157237168-68982.70021560306j)),
165 ((59112.62708481629-45457.26410539314j), (-88790.25871362776-25685.393578202435j), (23696.552787236098+41921.596338817966j), (55010.09931039718-93443.28701025742j)),
166 ((39099.27462555075-21859.303492325664j), (-13175.71402014888+48223.91127425416j), (-5568.289447947842-299.0850724438933j), (-20467.28086020409+30095.8347308894j)))),
167 ((((-16018.868474730582-47768.31986595277j), (51712.37041771119-18503.457760090154j), (-49051.6111606494+23687.829560421436j), (-71984.9830420537+396.65467472762975j)),
168 ((10108.4516848598+51857.057322104636j), (-7216.241612916012+72110.85192662141j), (54626.45574269543-59774.72883503144j), (-657.6522009949113+60897.80850184188j)),
169 ((-7989.0171800768585-89431.37235259652j), (-24705.702245950946+70622.38482297733j), (-63459.904012077815-42658.85544672633j), (50226.10296539047+34122.54286740055j)),
170 ((41218.241998490725+14373.480195603668j), (-54370.32919269195+6808.202490824406j), (-1527.4828551954124+54636.12386175628j), (14472.837501920381-52333.2803360176j))),
171 (((-2746.8539660817187-74513.82700384625j), (-61015.83534421826+53680.73473922199j), (-79322.89757472202-30783.74464730559j), (-46747.1238366321-74773.91885253192j)),
172 ((38500.41669416314-55405.667973400086j), (1396.4878373664105+24775.37482803031j), (58020.02299122539+48560.59423440633j), (-29555.466456927898-2523.0682893230987j)),
173 ((-34617.908388179705-12964.332502930381j), (-45031.80883921236+65602.1489634705j), (-25153.44844444198-12070.474688363538j), (-21543.782061126898-86119.31236007596j)),
174 ((71651.55622950022+37553.55829666175j), (73215.11980883317-718.055454765301j), (7065.864625805567-92990.91593148846j), (11751.07053047308-7707.306990859142j))),
175 (((-43076.79837010652+24177.23355451846j), (6793.467392677732-20449.573606641366j), (-71013.01101746038-6225.881152518472j), (74055.17870813374+66606.15686348274j)),
176 ((11557.138464109157+5388.5729086161155j), (36732.06100793248-37022.585715349574j), (2921.611354480643+55496.19455947708j), (55058.90849766818+18274.262129668554j)),
177 ((-58815.802612553605-3016.8034868425602j), (11211.939776371626+85380.70520152281j), (5184.476190878297-46247.039507761j), (66267.98054810712-61671.71978896645j)),
178 ((-5378.665820848371+9328.328146237982j), (43895.1264174895-68770.39938502887j), (-17511.997277418195+58343.13845945775j), (-85449.25399769237+5421.878678659821j))),
179 (((39759.129208538325-36375.49825029998j), (14116.074449609747-3690.404237582101j), (726.610813691339+20601.83416877652j), (-39703.3656455713+3717.592156691331j)),
180 ((59401.5216214189+24249.24110262998j), (32483.925202512517+12478.691995073255j), (-32680.63271733308-27669.460617493503j), (-49228.06429579756+18669.428245068033j)),
181 ((44330.3653675318-76.05447174097935j), (-77173.70951748395-14072.79466329544j), (44365.91092729417+30775.448092456412j), (-27126.74998375852-42673.613992010614j)),
182 ((69065.27619440478+6707.326801963689j), (30689.082128804977-86800.51053515819j), (49475.52450098609+20399.323850453336j), (-29667.120261194417+8908.992755905914j)))))
183 else:
184 if rank==0:
185 return (1968.4370221151426,)
186 if rank==1:
187 return (-24899.54037082102, -25.31549006801)
188 if rank==2:
189 return ((1830.692020877672, 4256.807988523855), (31330.447580824955, 30088.386511638193))
190 if rank==3:
191 return (((22464.14939770715, 9326.07497133658, -58843.28039835674),
192 (-39132.51601559524, -28984.021248456513, 87606.99636934511),
193 (82483.31416277925, 58484.471708777906, 28659.10377643413)),
194 ((-48055.05693146407, 36954.49346593733, 25658.428739633804),
195 (-45374.680239837886, -11967.766802782062, 40707.17918100887),
196 (-9272.611657965084, 95545.34560025277, 36552.65523613798)),
197 ((-91272.06575583504, 61258.36210240262, 23700.008344466856),
198 (-76559.99183386622, 74506.2742834793, -40042.39145376187),
199 (54893.50655552275, -60408.00584363263, -68208.21135366432)))
200 if rank==4:
201 return ((((-2613.5684369694354, 384.9724701708765, 17359.719572324335, -63393.27571171061),
202 (41041.42067423142, -14993.16104673734, -27399.273319594344, 60051.2377656026),
203 (18566.32422588553, -73825.83739655794, 95319.0187027347, -27646.03157540709),
204 (-88007.8178172775, 60759.47561504975, 31822.15287970184, -38852.10105560179)),
205 ((-89386.29724076603, 79511.70453673883, 1325.344653112319, 14210.631402891566),
206 (9099.55295712997, 30612.395205911307, -5512.258312859951, -43371.59702594321),
207 (24961.325742358764, 6843.62962861413, -43588.35638871549, 37139.61080792606),
208 (-59901.00300911518, -59802.81275754453, -26119.701955513825, 70973.81339014533)),
209 ((10824.815145545523, -37682.56858486531, -14732.374901197414, -14286.141738580205),
210 (-43004.59056324265, 59441.985441533616, -83687.96499450768, 4325.869356595635),
211 (-56783.42265829212, -28959.61168144866, -83740.97480554663, -10729.510064491638),
212 (-38480.61835393819, -50636.84578373406, -3588.0738023085723, 56239.74544740876)),
213 ((18228.900850710852, -16632.129655349723, 8015.163471499967, -4521.799739700364),
214 (-51505.380752985875, -1524.7016267364233, -19342.421346891773, -48490.57412835015),
215 (-73047.79149393305, -35239.98425352734, -35458.1734620065, 55659.41536985519),
216 (-13074.184715655007, 6436.319756047014, -28485.17418228225, -11128.300314215841))),
217 (((321.6371242800669, 35572.05942103493, 9515.23626081155, -4433.077669837556),
218 (26761.084128710136, 10867.52013173081, -19183.162620251198, -68559.41235027292),
219 (11484.667574519088, 51828.050682516754, 38005.19565254123, -76175.23771370867),
220 (-5227.790707720851, 71440.84429737684, -50336.09378326664, 37678.70778115371)),
221 ((-45566.74581644684, 5908.975208284799, 22576.958775978783, -50020.73251106653),
222 (-26017.058082686533, -25299.281527364627, 40976.696154446676, -13431.16881318092),
223 (-46649.16989082289, -65794.20117285698, 64119.987425361716, 5497.440022742972),
224 (-2203.2985446707025, -57513.79981817989, 41574.749087273776, 48387.40101623114)),
225 ((-18416.741032524515, -47640.69430896508, 19679.029797917596, -34810.30464977612),
226 (62831.92844082225, 27725.457434774376, -3134.438446956716, 49315.595365086476),
227 (-73623.94099730175, 20978.640264794405, -5573.772319421056, 36086.56272512534),
228 (28660.57533284233, -58241.55583429358, -51661.45261125069, -50693.33103010448)),
229 ((56426.23453986164, 78359.73594286482, -38576.297999959155, 8913.910887926046),
230 (-88189.29548286308, 2602.1208204264694, -15718.494307329529, 39115.51872697051),
231 (50134.74938380022, -42828.424427019796, 39528.932684095016, 71074.105860494),
232 (10360.78422517216, 3628.4946464838577, 866.6535588603292, 31553.01858562138))),
233 (((52390.293064785874, -12243.173190398476, 12973.542140497811, 24679.210914480092),
234 (-39068.25465569209, 11375.555598436607, -11948.963084895935, 23180.6696549638),
235 (7750.742802840003, -4544.655806011273, 17257.229884485423, -38718.29755209083),
236 (-54962.39017442457, -32692.842165301, 79228.7545707964, -46958.08883925094)),
237 ((58808.04021951867, 31679.09607989699, 60465.22396617634, 3778.4799478359637),
238 (17712.329884018807, 17874.74312645469, 14954.738052270157, -44753.01307496137),
239 (24417.93508883397, -25931.24652138863, -27186.302587945494, 37605.82669369904),
240 (-20116.370032880397, 22395.271847421376, 39918.504300252374, 43365.55907616498)),
241 ((-29680.436323581554, -7156.784950690315, -27141.447127045933, 65196.42918411147),
242 (-10851.323062587486, -12918.348059911383, -61892.308397834146, -49367.20478221224),
243 (-12048.985149625369, 61619.01673500164, 19594.218775417554, 52093.668037218595),
244 (-38465.24637072596, -9188.19710817252, -7828.463839086282, -62406.93767988804)),
245 ((-35787.91825329978, 23117.81737012358, -49967.17854684144, -9030.162340133553),
246 (-31476.492123520133, -42646.47087585365, -80893.4161545868, -38123.68731593444),
247 (23794.505773755358, -1648.5505688887642, -18076.67754352292, -50552.198666715994),
248 (31218.595116869503, 36051.76246348336, -23827.05367940539, 6983.787679924746))),
249 (((-22717.871470141312, 41000.10860057993, 57170.77347009425, -45870.224065572766),
250 (-75749.5782286584, 82016.05469083885, 15364.324776823589, -34421.772637849994),
251 (56091.35037369725, 69020.64428824343, -54982.82912975482, 26461.710610700044),
252 (-6865.449808598962, 1458.33269652327, 19976.42644646119, 71857.51352483299)),
253 ((-19816.540187252496, 8015.999325965924, 73384.47295519276, -29811.76619356322),
254 (-13116.527286368713, -76148.43320182734, 694.6129571919591, -51487.98727764331),
255 (-18216.321286892955, 19089.44846330423, -49851.57024753545, -23061.547216296094),
256 (4069.367521493099, 4460.02510964268, -70628.47512058845, -5320.222269188191)),
257 ((55551.601997272795, 15131.970379855833, 9132.149357120768, -1748.749782567771),
258 (25571.39049857318, -22269.3336119335, -40013.90106400979, -41645.300687720875),
259 (19942.423484201456, -77721.3403094917, -49049.37211887518, -42125.028417728725),
260 (-20331.591530993654, 18849.729202127564, -11172.361078239031, -42378.721186597744)),
261 ((-28162.219784186906, 27005.38411136302, 28047.626970074954, -48907.05914121462),
262 (21561.00249540838, 16819.379648924267, 21373.309752767862, 81217.52472263864),
263 (14530.50392089595, -38878.60235910026, 18507.98920090188, 38187.90762089445),
264 (24234.820876412356, 50390.96325142998, 5976.493423496679, -16545.42618485792))))
265
266 def get_scalar_input1(self, cplx):
267 if not cplx:
268 v1=0.6081355033581688
269 else:
270 v1=(0.27562178672620385+0.42446484939332796j)
271 return (v1,v1)
272
273 def get_scalar_input2(self, cplx):
274 if not cplx:
275 v2=0.5327268994219874
276 else:
277 v2=(0.49976275640416334+0.4141087840210876j)
278 return (v2,v2)
279
280 def get_scalar_input3(self, cplx):
281 if not cplx:
282 v3=0.4903827487969067
283 else:
284 v3=(0.4130410618402195+0.7195601418761082j)
285 return (v3,v3)
286
287 def get_scalar_input4(self, cplx):
288 if not cplx:
289 v3=-0.4555987934301202
290 else:
291 v3=(-0.2562657772006671-0.09989064526858904j)
292 return (v3,v3)
293
294 def get_python_input1(self, rank, cplx):
295 if cplx:
296 if rank==0:
297 return (-0.8493106430566671+0.5498588650604705j,)
298 elif rank==1:
299 return (0.5213538174366878+0.45097055421243537j, 0.25896216831911634-0.5966874048733529j)
300 elif rank==2:
301 return (((-0.20984377987310687+0.024810300993445944j), (0.024805532005481523+0.015098314700385806j)),
302 ((0.2292639954026584-0.7100972341857507j), (0.08682454615283863+0.12332238221542291j)))
303 elif rank==3:
304 return ((((-0.6550500854131598-0.2127087989155373j), (-0.017627543683440106-0.3665841375380333j), (0.12492952051741912+0.05374046981620606j)),
305 ((-0.11197479851035519-0.5608269924316476j), (-0.5419470859968003+0.07356518546227997j), (-0.42635110929148823+0.47738396333288513j)),
306 ((-0.16556333483163588+0.009959138144123747j), (-0.17095759700320223+0.19563542216810015j), (0.38543550056193654-0.7475542165987907j))),
307 (((-0.773039591137402+0.001304882415888442j), (0.005692414753365238+0.7073228171031704j), (0.16149889599978962-0.5779399189029897j)),
308 ((-0.39240472327059983+0.5661946692113213j), (0.15619153376084327-0.2043397442335695j), (0.12989734566943012-0.6797045089189742j)),
309 ((-0.2953545934396431+0.00897241164565632j), (0.2424492369208724-0.3012099081809274j), (-0.5052331641775911-0.7560269073586534j))),
310 (((-0.4330063069118393+0.4662418513842146j), (0.14640515390237896+0.21280275920042335j), (-0.6848374766215319+0.688509731931129j)),
311 ((-0.7009542857194253+0.5090290863675988j), (-0.08777137326709294-0.0642088074588476j), (-0.22469168662839534-0.20497222057853204j)),
312 ((-0.004895060324627054-0.0007149461427655712j), (0.5733987472263198-0.020876347517763794j), (0.14677839835678597-0.33748939337229644j))))
313 elif rank==4:
314 return (((((0.790344350-0.675690862j), (-0.33969014424346+0.004667354999j), (-0.353898037-0.23103247j), (-0.173453149+0.350472j)),
315 ((0.262318036+0.493920836j), (0.122221063-0.2126j), (-0.2002867+0.62847794j), (0.2585201923791-0.1055537993243j)),
316 ((0.1024287918-0.07259437049j), (0.3338564+0.44847000j), (0.0433384-0.2616078j), (-0.1717597+0.2503709670077j)),
317 ((-0.768778331-0.076403010j), (0.251991719+0.62985777j), (0.4514933+0.47696252j), (-0.0351486+0.023037350246j))),
318 (((-0.4863645-0.24921801802j), (-0.023444472-0.5599386j), (-0.56592+0.4275706j), (0.41222370286-0.34867238925j)),
319 ((-0.5252590+0.04977251205j), (-0.33737953+0.27293775j), (0.66428+0.87048705j), (0.0672260574-0.416242856449j)),
320 ((0.148783460-0.4520517585j), (-0.41537536+0.16140391j), (0.6278127+0.263838j), (-0.07760387-0.1831155602152j)),
321 ((0.0470026875+0.481795665j), (0.0215979296-0.081945318j), (0.7913869-0.0861j), (0.39466-0.36695690929153635j))),
322 (((-0.143371038+0.36692459j), (-0.05936024660+0.57744203j), (0.35210125-0.3062606j), (0.09250628940+0.2787772j)),
323 ((0.5220814-0.12741648j), (-0.054402209613+0.8726141525j), (0.19115503+0.059924j), (0.34340959513-0.13436584j)),
324 ((-0.854710-0.3580477j), (-0.45614757+0.0726810109j), (-0.11809521670+0.15075834042j), (-0.028270996-0.13039829j)),
325 ((-0.4935554755+0.6616606j), (-0.77712599-0.292285j), (-0.29938802+0.958714551j), (0.1306040901396+0.5467211724j))),
326 (((-0.490711642822499-0.0679784225903799j), (-0.028147241164195536-0.03995809530085381j), (-0.28811330815221536-0.6815443637070895j), (0.07421744086779403+0.7402073156785812j)),
327 ((-0.20556698745139912+0.15621646747170792j), (0.09192542596753261+0.12253579257228409j), (-0.3264483145179087-0.946630282004219j), (0.224192041112648-0.90380956121387j)),
328 ((-0.23224656797256493-0.6768140280012414j), (0.2451768408209073+0.17488492564153224j), (-0.6851697787753819-0.08406614036650228j), (0.20088414272093424+0.1669900873662492j)),
329 ((-0.36057308512412345+0.4226878583624143j), (0.4490488492756204+0.11240390126422484j), (0.03234540063577107+0.5512325765639803j), (-0.5756238638317961-0.46042879607009257j)))),
330 ((((0.24124399378525585-0.8745635773731907j), (-0.19374525735285986+0.5380787997061398j), (-0.4489085299026162-0.6296073456803736j), (0.056570144039872594-0.135671341894538j)),
331 ((0.05530486113034205-0.45284053426797866j), (-0.04502323738051783+0.0630304737860885j), (0.004887893978963609+0.5713368827301133j), (0.18732743423207876-0.7143408881411377j)),
332 ((-0.3712234322764927+0.24908466763268566j), (0.6364022966205971-0.21808571418727385j), (-0.5670900710572193+0.6348611392807915j), (0.9245683140013828+0.3899090325528184j)),
333 ((-0.6094870272364956-0.2685532809269351j), (0.6287315177811945+0.4264823533706973j), (0.1676715780106749-0.48029733292855326j), (-0.5376630517471747-0.7182359990772386j))),
334 (((-0.018779747197580465+0.6114308512727638j), (0.3732084851158033-0.4786089418474003j), (-0.5663664323873074+0.39392462282467033j), (0.13538143997466878-0.12985823792228446j)),
335 ((-0.4780490757496574-0.39805216916921526j), (-0.2797090849741719+0.93720217986173j), (0.6203622207514078-0.15823957110011522j), (0.6060182605777774+0.018214531480017393j)),
336 ((-0.3696664461011986+0.07708468475820063j), (0.3066672994071602-0.345863819817513j), (-0.18002308351634988+0.6758164917135244j), (-0.3299795335012433+0.3472073085359665j)),
337 ((-0.018635553181191034-0.2527645838168162j), (0.10050559250760827-0.2682102608362037j), (0.15675656210201427-0.8704771160865176j), (0.2060240187990353+0.1525158024705776j))),
338 (((0.17233488629737193-0.11594210469295985j), (0.06281516668626441-0.2603634509290429j), (-0.05642743012335105-0.655594777161181j), (0.6959785793264961+0.19699171017512973j)),
339 ((-0.17348338509217032-0.6986792371372937j), (-0.8346643961801311-0.3680194342368177j), (0.12864312443903647-0.32156359553027614j), (0.6861567331359726-0.010430013106866087j)),
340 ((-0.6222917331694062+0.112713903157314j), (-0.12621654439609742+0.28520452943867913j), (0.44508284456518865-0.7522188187153122j), (-0.2636591190438452-0.040926078833506185j)),
341 ((-0.19805372118683406+0.5858778783604968j), (0.8721978764710994-0.548302441850661j), (-0.15430327558703272-0.01201209901149869j), (-0.3670274756811238+0.5474051336552919j))),
342 (((0.25034760722181615-0.15703084151927404j), (-0.14637027923589074+0.2928912738619156j), (0.46416445476921286+0.08042093992929411j), (-0.506840204775922-0.1186965040818393j)),
343 ((-0.37679950234230697-0.2701183493158177j), (0.043782673009088335+0.06734842807447794j), (0.2517828293729589-0.46888255931621403j), (0.6737055518213005-0.812365808946925j)),
344 ((-0.2661639821601073+0.13557351739334367j), (0.7392306869051049+0.5132140781139445j), (0.8364137600747349+0.15412542220542547j), (-0.5220472284167044-0.3618612888730691j)),
345 ((0.13970939326026943-0.3036727447660489j), (-0.38759251152342933+0.18775991991684293j), (-0.2487083238049208-0.4778652656270306j), (0.1390512499757498-0.9134653209907141j)))),
346 ((((0.04833008268979544+0.15219347436054742j), (0.26103655160455086-0.3757461116008425j), (-0.12150273403936784-0.617683120749172j), (0.06086845258368434+0.5631830804862105j)),
347 ((0.5300453373682147+0.4166351114705461j), (-0.6851243348127105+0.6918703698362535j), (-0.7710255671005614+0.10134603710624956j), (-0.26008427165733317+0.39542364464404867j)),
348 ((0.5854498106749348+0.549731062650827j), (0.2519939415821417-0.43527531634423966j), (-0.6267811606157699+0.8585285100484663j), (0.07940474123690222-0.5124720092697812j)),
349 ((0.30776303313314646-0.15530657580599816j), (0.007522269998118669+0.35668611429959896j), (-0.1919814476250188-0.30177638543157503j), (-0.1646298733419591-0.7159546806725978j))),
350 (((-0.30218788472478486+0.7760123719336528j), (-0.6314508280105797-0.1304090779644247j), (0.47461359141937576+0.4479088939414325j), (-0.06334668969380608+0.1323481666947287j)),
351 ((-0.7546949847971307+0.1756014222789699j), (0.25493728708952623-0.1282474899023487j), (0.390011965026524+0.4028431671750171j), (0.06598509493063165+0.7155111116236064j)),
352 ((0.07881709314826968-0.24405932002231845j), (0.36802109324120846-0.15749901166866498j), (-0.4450424875753707+0.7030178139999255j), (0.27329963141708635-0.7119309406610871j)),
353 ((-0.30933381776423374-0.11542316873853986j), (-0.0254248179097315-0.7313241377455038j), (0.10700540112141-0.4660169963118146j), (-0.3013644469437623+0.17540339691654783j))),
354 (((0.0008073119623276392-0.05721575120619815j), (-0.08090870209548084-0.5957005266957907j), (0.17886979689341065+0.08798138279240286j), (-0.47326181867795214-0.39061153265097337j)),
355 ((-0.6240780356387126+0.931178282425864j), (0.49774084728858903-0.6554241240698137j), (-0.5514724615982707-0.1357900974308276j), (0.9476110679732384-0.8254384162767912j)),
356 ((0.339181898243627-0.26749719725842025j), (-0.8452885480367868+0.6880217962554664j), (0.6160319781793868-0.21382367328363683j), (-0.10773724739140955+0.12900692439104278j)),
357 ((-0.4524239681624962-0.05106064389660214j), (0.3502260661172907-0.28486272434416593j), (-0.22611152371676513-0.4473111544777272j), (-0.07889011849494199-0.902189430409641j))),
358 (((-0.4549255061524088+0.8204137745689758j), (0.6262794891433104-0.07873980006902381j), (-0.2099285569580429-0.5700098959028401j), (0.6485809522680817+0.09567054692828636j)),
359 ((0.20594301199461984+0.4902067661467834j), (0.3329644191869927-0.02188884849814343j), (-0.22921000231707434+0.3393725843732417j), (0.5813376839449342+0.09312340842380451j)),
360 ((-0.44184373889384854-0.22572260324605908j), (-0.2865930601221123+0.2963815667447778j), (0.23401187102772336-0.14690195925951866j), (0.5821368881041176+0.7899842539077798j)),
361 ((0.21512923589171906-0.5017618261731809j), (-0.29710734954707296+0.3058974064324922j), (-0.3522028959822211-0.5211544989239631j), (0.0833888296839771+0.47110470479799904j)))),
362 ((((-0.12192871299046759-0.7328491805867747j), (0.7012790193629233+0.7216675552235499j), (0.07746694166806012+0.07187177179945092j), (-0.11596083131875812-0.3402549730235054j)),
363 ((0.4419525909212654-0.41264178907481297j), (-0.9540280899180219-0.0931626138838092j), (0.5850822884122122+0.023613319021177137j), (0.6204747822108139+0.4817530149691007j)),
364 ((0.12857240889181254+0.26765277556782874j), (-0.5905959060433874+0.30391448875145577j), (-0.33009606966351646-0.5133049903372606j), (0.3911371567574641-0.5699531083068055j)),
365 ((-0.06951047741648464+0.09185412570082496j), (0.23412720494006845-0.15301303449597714j), (-0.3632868271203742-0.0854806981764501j), (-0.06898965841232252-0.08895516025337646j))),
366 (((-0.30228646550028415+0.06630530646305488j), (0.1386457118575627-0.48419676726390337j), (-0.22729071025997294-0.7643686926101503j), (-0.3622425543437594+0.8590754571587876j)),
367 ((-0.22721539776726385-0.36036034464849565j), (0.31497309604817325+0.3597772211828737j), (0.5069787174234794-0.8219928876404512j), (0.11194139062149588+0.26293050464964796j)),
368 ((0.4612090001013647+0.27388506472486907j), (-0.30194776224929665-0.13263761985638922j), (-0.6233657091294399+0.44684364446587943j), (-0.3450340301594258+0.11542147033108141j)),
369 ((-0.014881287063154947-0.18928627620951555j), (-0.015185483586684478+0.8972647988323046j), (-0.4351552758945989-0.7299460860379636j), (-0.12326133732628419+0.012329124057677388j))),
370 (((0.10476345838581014-0.14636495344507483j), (-0.32803930125358216+0.27809153512314866j), (0.22528172636268207+0.3494691827944507j), (-0.5310240602410343+0.04119281216138804j)),
371 ((-0.5533642323509493+0.2906558493993484j), (-0.33436396580317507+0.4888660226122262j), (-0.4290629671820184+0.09348041559022413j), (-0.1635189281331263+0.08219415853032563j)),
372 ((-0.48564277336559514-0.39389189119028456j), (-0.07859439546331881-0.5417512106196164j), (-0.2634745687747664+0.6393823484701674j), (-0.4717227533107514+0.7886365869114986j)),
373 ((0.1574555874287038-0.15735823857163656j), (-0.3407071004516933-0.00848408628817443j), (0.111461150743281-0.4496138761616306j), (-0.08146922125654954+0.5259628325969007j))),
374 (((0.34656176542518824+0.07880355128877725j), (-0.258503112094004+0.23322070678863926j), (-0.6883175179734812+0.06684313489266447j), (-0.04692875801791596+0.7384728581195434j)),
375 ((-0.3413224116842536-0.07621317699837815j), (0.23082091132507632-0.7397247652890888j), (-0.7325151537847703-0.2399819049396238j), (-0.13092551439092603-0.2541771655857984j)),
376 ((-0.6621690601235584-0.3959496844857878j), (-0.18349053313548802-0.8753348282719295j), (-0.03908532595157577+0.35883701301557147j), (-0.051099789459096545+0.22309220396282636j)),
377 ((0.255858259117678+0.5962976405338435j), (-0.4167005907396837-0.7228120687439701j), (-0.4251792094268322-0.5598290555324366j), (-0.02547169493326129-0.10035815157656547j)))))
378 else:
379 if rank==0:
380 return (0.16343477325759478,)
381 elif rank==1:
382 return (-0.414447461350212, 0.5940893953018536)
383 elif rank==2:
384 return ((-0.18517072101415805, 0.20812345616476052),
385 (-0.5546197008728526, -0.5564107547626429))
386 elif rank==3:
387 return (((0.39959975888207894, -0.6577401243413907, 0.4280968882108843),
388 (0.22892610169500252, -0.29400534047234894, -0.3596253597614875),
389 (-0.352145347223075, -0.22330947752937103, 0.6040999239623353)),
390 ((0.5820901702251168, 0.5118427342586129, -0.784142756428528),
391 (0.32306580123331297, 0.5718638969764223, 0.35139290436334764),
392 (-0.38744644765122205, 0.6230529976422874, -0.4451744915244834)),
393 ((-0.1680467743981198, 0.8270861936315199, 0.2604978984507546),
394 (-0.3179202431655108, 0.592515989853744, 0.37531069237770537),
395 (-0.5594567456296533, -0.5354189906699913, -0.6879940596903789)))
396 elif rank==4:
397 return ((((0.07653880859335448, -0.8506240072658446, 0.5669507117736834, 0.5069631117128448),
398 (0.7231092428343939, -0.18235569823019526, 0.46022740126490647, 0.8492333455592396),
399 (0.6170052818637486, -0.8808747630127647, 0.1563085221153727, 0.8244613246958687),
400 (0.4294616619386404, -0.12118821840316875, 0.7616687854731052, 0.6728140330125063)),
401 ((0.6436880168986288, -0.25021445743624676, 0.11998265803070028, 0.8312669978628259),
402 (0.6870391868795935, -0.41825547772474664, 0.601722908359805, 0.10996760961876721),
403 (0.30815741382372003, -0.8484037060918963, 0.6225223666523892, 0.25636768516056313),
404 (-0.5403219505752949, 0.784036866371234, 0.11777309540223573, 0.4039156719922558)),
405 ((0.5543818190876664, 0.5654917578606441, 0.6110438985958697, 0.09343833716996176),
406 (0.663012375502168, 0.2314869852119426, 0.23762537471584116, 0.6933683606475624),
407 (-0.29276295759188187, 0.714837865189284, 0.1872658031279304, 0.1702169706800615),
408 (-0.4542436592804883, 0.07976845049430197, 0.08816046717012539, 0.462262050647425)),
409 ((0.506450528739594, 0.4062122557330939, 0.5462416476803083, 0.25191742530295563),
410 (0.3393578341507891, 0.2825671991633298, 0.13447310100386736, 0.5860351833019655),
411 (0.6612450693192753, 0.6774796280346236, 0.2676680871992434, 0.507190159923532),
412 (0.6953428609343382, 0.7171619543885263, 0.6260223993304953, 0.331615476564711))),
413 (((-0.27573547448763347, 0.5077386283774998, 0.4453961872519076, 0.43130840985234026),
414 (-0.580315177591782, 0.5652609083059623, 0.8511780780181941, 0.33371199932631807),
415 (0.699271673783864, 0.49366804495096395, 0.06797744724509305, 0.5353269755409358),
416 (-0.6252936853093409, 0.8905733967820801, 0.3089031678403189, 0.5261014470187029)),
417 ((-0.7404002858536928, 0.2048176759131214, 0.4980581903575471, 0.42894050825990854),
418 (0.45779709857247547, -0.7620468819613082, 0.6247644411339963, 0.6305323474999456),
419 (0.7909315252937255, -0.3012402477673979, 0.4525703288970107, 0.9352115724287626),
420 (0.31693114412209444, -0.37281844304816186, 0.7318694959034, 0.19786924305064665)),
421 ((0.3274437623324882, -0.33087589095095155, 0.8556630658488849, 0.524447118150698),
422 (0.41163320939179787, -0.9238459438767593, 0.21861731917563137, 0.4424459362963088),
423 (0.5776510801231114, 0.6065647351222803, -0.639307289457621, 0.7314330090773533),
424 (0.27421408841108247, 0.12621566941798637, -0.46606608860175, 0.08985539889445235)),
425 ((0.25771437676193215, 0.8671956551054035, -0.7024115898342955, 0.6180265239465382),
426 (0.3536132615270657, 0.4678494273732346, -0.5440963329219566, 0.5386557403677203),
427 (0.425277398166178, 0.5397867882224323, -0.21245876299659439, 0.8499599729452116),
428 (0.282819828736375, 0.616976644425216, 0.45750716248923645, 0.10388406898090359))),
429 (((0.480212232724941, -0.8937086550918505, -0.6399122280175192, -0.3926739182869949),
430 (0.5866305704975537, 0.37523483543667685, 0.34455787558391154, 0.7468191968550546),
431 (-0.7561559742324413, 0.6618299652906166, 0.5497360987548463, 0.44000411823919794),
432 (0.5489342296514085, 0.33299878380451237, -0.6851907132585857, -0.8837744966993399)),
433 ((0.2449050432846066, 0.7225682113974873, -0.42149169327348723, -0.5241172273711572),
434 (0.7461632214743219, 0.3773660518547119, 0.5911139199924735, 0.12543356040664694),
435 (-0.4374385476373295, -0.7523855940695361, 0.4381969239605094, 0.37308327852970813),
436 (-0.21637181734766117, 0.49874174259134, 0.3912614640116107, 0.4526617072173223)),
437 ((0.7151470272616507, 0.43893562960939475, 0.4654984531602598, 0.026153794290457506),
438 (0.7899612010454996, 0.4349102788459652, 0.7453956466392258, 0.47431536809150776),
439 (0.42979681026390004, -0.571667413005515, 0.608322709782375, 0.4374481254420103),
440 (0.33514856567435775, 0.5877137248653976, 0.9386863487830309, 0.1386415730993477)),
441 ((0.35219579066973905, -0.6168773605138196, 0.40504448843510976, 0.424824210157774),
442 (0.7812627665326543, 0.19452639019667187, 0.6000050187112531, 0.7539670503073901),
443 (0.2981680001911141, 0.5123292320600974, 0.6035479676835969, 0.5180365031497639),
444 (0.4958302538856905, -0.5666881217462356, 0.3057862327558582, 0.16322148534649822))),
445 (((0.5219568172234907, 0.6691120408133714, 0.5415030041267854, 0.5178254487487362),
446 (0.550999473408774, 0.3224491374840088, 0.40632316238837907, 0.5316822545746088),
447 (0.15782246477014253, -0.39011414803016886, 0.5923055243411701, 0.33403984110147705),
448 (0.5476956624940421, 0.353567340179472, 0.7751336150761081, 0.3769351266082521)),
449 ((0.26092129669846587, 0.38531106190825626, 0.43089380185467957, 0.3517745063606868),
450 (0.6068795949566435, -0.7313287811237782, 0.7817415065395071, 0.539725422031037),
451 (-0.4681995762086918, 0.8081081299514932, 0.45349678068383653, 0.1676286251112078),
452 (0.9418725604754995, 0.7388572732026134, 0.44262594936532146, 0.7474149440129483)),
453 ((0.8132968384251593, -0.5972218943821608, -0.5919410574164853, -0.35599895731169406),
454 (0.7520654612132684, 0.45483154483372135, 0.4059225646226807, 0.4001021311571795),
455 (0.241190931159322, 0.8294262552595144, 0.6807436275202874, -0.3970641092078186),
456 (0.41214139959674073, -0.49530207420971023, 0.2603640589059204, -0.5320822386899074)),
457 ((0.4852677073030271, 0.5126350217914364, 0.5251827072400477, 0.4107256987588376),
458 (0.5923200155158566, -0.7301177285915048, -0.774241876159728, 0.6746581037497406),
459 (0.3573798122820507, 0.169636160666647, -0.5725299039287078, 0.23182444091612892),
460 (0.3601137116698788, -0.07438414986800912, -0.4165677125316061, 0.0790530879666291))))
461
462 def get_python_input2(self, rank, cplx):
463 if not cplx:
464 if rank==0:
465 return (-0.22889838791916658,)
466 elif rank==1:
467 return (-0.49012030903632825, 0.6031662135176437)
468 elif rank==2:
469 return ((-0.6891705183553265, 0.7417620269931902), (-0.5710307758197861, 0.39980890346586717))
470 elif rank==3:
471 return (((0.450166488818521, 0.40335229027346475, -0.34323251080578104),
472 (0.2842555722086943, 0.519038548037327, -0.22356691063536377),
473 (0.6233434523085559, -0.6939552082789993, 0.20717775496120844)),
474 ((0.6635014413084468, -0.12427061907674535, 0.4316471005230688),
475 (-0.3462206066776269, 0.5812789855981269, 0.1513383660423066),
476 (0.40921125173698586, -0.6302181341512401, 0.4857376224901844)),
477 ((-0.5156818720590722, 0.3810418328134193, 0.5228685660307542),
478 (0.44668606111653875, -0.8552520337523355, -0.30378907822454826),
479 (-0.572442375071903, 0.13397389728880899, 0.)))
480 elif rank==4:
481 return ((((0.45433363368861773, 0.6498884169562154, 0.8968304717142223, 0.8907734241559906),
482 (0.4777438965822781, 0.19219763395957137, 0.47760828704065156, 0.099611811950238),
483 (0.28320121503596124, 0.6794412465012807, 0.13188620716114968, 0.40410020187234463),
484 (0.170095604634749, 0.6491679236703396, 0.48405171480791914, -0.48480616171976565)),
485 ((0.40796761374598983, 0.5888935058511742, 0.810959910176321, -0.3519432924326292),
486 (0.6778803492879535, 0.15159482372964073, 0.7609511790213423, -0.4291829232233251),
487 (-0.6597430856795399, 0.5416080050562327, -0.7316035149420569, 0.17492295472360206),
488 (0.3585956180854316, 0.4506986634961759, -0.3068624306617866, 0.6450035140643098)),
489 ((0.7690325599562085, 0.6582789850176016, -0.6556413596206179, 0.615423012961261),
490 (0.3947622967482572, 0.3604341682179244, -0.5689343825826134, -0.22003697279869047),
491 (-0.6004909191668832, 0.48591852805780483, 0.6670811381503408, -0.33418084981888524),
492 (-0.5696228030807892, 0.8349733556806979, 0.08716776292987743, -0.6103200906618154)),
493 ((0.32673151927490685, 0.3650741778596788, 0.4719563946069752, -0.2624495178810215),
494 (-0.6911360309172416, 0.629718040535628, 0.37138298773280687, 0.7867876295855086),
495 (-0.6768502043234856, 0.32903587935447837, 0.6229889864689531, 0.5226994780805113),
496 (-0.6571446582814051, 0.30807025622961254, 0.3025565918384279, 0.5316791314282434))),
497 (((0.7110156690310308, 0.07897654694359649, 0.49671935812956247, 0.15989919493282642),
498 (0.4454758263127157, -0.8468596115253173, -0.4603369168686832, 0.7835562740584727),
499 (0.1973500874759318, -0.6890077016392274, -0.38353764662415646, 0.2602210860778308),
500 (0.3062963684983607, -0.5485723785169033, -0.7558085192193574, 0.7260373711224899)),
501 ((0.6292337309967168, -0.6298019421801468, 0.5769038995707547, 0.805909547222589),
502 (0.2956786092814956, -0.8516163380649984, 0.0433563110406362, 0.5562648421367056),
503 (-0.44398600437607083, -0.3132864322653825, 0.1309184523859448, 0.09487956033144461),
504 (-0.39347200269496224, 0.6744128343886427, -0.17787462973897294, 0.6844498649820736)),
505 ((-0.4668129815805621, 0.46840442065095245, -0.6348701936076414, 0.534532796163385),
506 (0.5401302006866129, 0.42361490419012787, 0.3055178484323608, 0.4099049291060996),
507 (0.15643756091005653, 0.5538397868668722, 0.5793672234228313, 0.5343825930606839),
508 (0.567145595353928, 0.7936293829906991, 0.5159699957715731, -0.11524767048966807)),
509 ((0.46983068856527466, 0.829272105469925, 0.8242448082292821, 0.3155783126108229),
510 (0.46679344399363587, -0.35498575768428703, 0.8195558132407107, 0.044710380043836144),
511 (0.7228682303918399, 0.5956512578344273, 0.5842273233950968, -0.46445592272801267),
512 (0.48424480615111076, -0.43589572454719294, 0.2739525289177576, 0.5141521147948742))),
513 (((0.5353156164778932, -0.827716346014944, 0.2661170502005538, 0.6240217001592496),
514 (0.5889586875315378, -0.6056309378106368, 0.38460210470822326, 0.3257073061066195),
515 (0.38605597818925463, 0.5566287156895975, 0.8868213070850919, -0.10818212758613992),
516 (0.44934219884516874, 0.7722925534790802, 0.6824771465971564, -0.4861304182325704)),
517 ((0.35670465647772914, 0.40563319853724733, 0.9215374519881303, 0.3261075398074149),
518 (0.5466590188369063, 0.8063505325979616, 0.2505468000914572, -0.27573025774136484),
519 (0.743952777599612, -0.5916038948220598, 0.5814331576314142, -0.25330559867360414),
520 (-0.9281192928557953, -0.5526121099889816, 0.7663168620517609, 0.27644519542436335)),
521 ((0.4312170339514421, 0.39670998093753257, 0.6147975692316388, 0.49353631380425866),
522 (0.2914782490250003, 0.34495461015075896, 0.724277583477783, 0.7656114513280461),
523 (0.2967100926835535, -0.3708225100005513, 0.4557999563503535, 0.21401134707432434),
524 (-0.33196574382892885, 0.6509108525238382, 0.44580359408187276, 0.6130947882235365)),
525 ((0.11173436827791464, 0.6700051363761477, 0.12807937551069665, 0.7174522662954508),
526 (0.40082249771839484, -0.6435832868289147, 0.47429720113534696, 0.44533186804848607),
527 (0.4625441865293232, 0.24229257632548656, 0.655276132353378, 0.27883861657454045),
528 (0.638496711915504, 0.5391658143407168, 0.6794910638048037, 0.18819631783938193))),
529 (((0.49500523167298044, -0.7621808699493068, 0.8002303121407335, 0.4339016426795843),
530 (0.6899502135654372, 0.9438297115207196, 0.39545080237118185, 0.43835240439976453),
531 (-0.5324364296711654, -0.7403526206887153, 0.421079060947922, 0.28183735731097076),
532 (0.7641745784203584, -0.8052630361187237, 0.4113425938410049, 0.4873541423815537)),
533 ((0.4763043550807671, 0.8818320340667569, 0.4376950912132615, 0.5155236207246434),
534 (0.4770314956120568, 0.6995239422377975, 0.29342906280323733, 0.2207382366023154),
535 (0.47119152389910457, 0.5643383062697325, 0.19014363807175272, 0.47728067160438753),
536 (0.293549802812087, 0.3091310044125135, 0.8079461149429534, 0.30540675213143226)),
537 ((-0.6562012019806969, -0.5762140611417803, -0.8922117406714833, -0.5644163171621817),
538 (0.28018207838767606, -0.6980601983118322, 0.9321643060248082, -0.6857895197253853),
539 (0.30248864387340907, 0.37739756004900193, -0.5011312641768506, 0.19190880686969636),
540 (-0.36857760657786354, 0.6980580453947155, -0.4162678161352499, 0.6651932863378893)),
541 ((-0.2969663268640197, 0.5012850908098417, -0.5630486821046159, 0.5994825528795871),
542 (-0.45367000863631446, 0.24430658191105983, -0.277060548382701, 0.5169546884489187),
543 (-0.9278462241176814, 0.5112886572173754, -0.3908093365092602, 0.7815138913982161),
544 (-0.32136995201761503, 0.2619940057725135, -0.35043110649096515, 0.9241246395431221))))
545 else:
546 if rank==0:
547 return (0.22889838791916658j,)
548 elif rank==1:
549 return (-0.49012030903632825, 0.6031662135176437j)
550 elif rank==2:
551 return ((0.6891705183553265, 0.7417620269931902j), (0.5710307758197861j, 0.39980890346586717))
552 elif rank==3:
553 return ((((0.07547574295591059+0.525876939609691j), (0.6637422951496057+0.7388772645580287j), (-0.11575430357267835+0.3396973817710597j)),
554 ((0.489975174033296-0.7778617185395662j), (-0.8582089062218037+0.7890680975791542j), (-0.34130307486775563+0.3651975276800719j)),
555 ((0.6269390600608432+0.28192633671923134j), (0.6386868409229303+0.8545339974263741j), (0.8227777914187108+0.9768191533988598j))),
556 (((0.3925840042771697+0.8092934421771397j), (0.27266165100309064+0.32623317563034737j), (-0.8740927141261398-0.4161371090973831j)),
557 ((0.6702575659927514-0.450686130655044j), (0.474828305773418+0.7656845168857629j), (0.15253090291865834+0.46008109446176876j)),
558 ((0.6094857432227104+0.5897008435426775j), (0.5134349957841884+0.09305616116877985j), (0.7954114232091216-0.4633804802000654j))),
559 (((-0.29941397426915045-0.666629677984151j), (0.41045211458021535+0.6422008897066637j), (0.7608807908849147-0.2263883386308603j)),
560 ((0.21016378700056504+0.8009138519791235j), (0.10548646537128033+0.43289764157877525j), (0.4083797466047874+0.9040107808706966j)),
561 ((-0.8930070536981469+0.4674003925883036j), (-0.7258863558039299-0.38206684572695093j), (0.40771065599848233+0.14217138669583038j))))
562
563 elif rank==4:
564 return (((((-0.38981592692954015-0.2856117645961309j), (-0.035094151427129905-0.265178716783423j), (-0.34532231395177504+0.36673987839501265j), (0.2041672227930209-0.6128500993893164j)),
565 ((-0.12421070955162938+0.026349493748204833j), (-0.3415725798389704-0.0775430038163134j), (0.17048268853378434-0.08862480715498033j), (-0.1106967683514759-0.10379778205326462j)),
566 ((0.7298716846009465+0.20776829436005195j), (-0.33435577984609854+0.039072521387463754j), (-0.05886662990481739-0.05072122421891534j), (0.18354830862254912+0.4606377888934907j)),
567 ((-0.0767806399525307-0.8221389203690308j), (0.190835818629008+0.16192941104126957j), (0.17778866234180712+0.2584570168682756j), (0.07671782176673747-0.8469237188822869j))),
568 (((-0.35597391704713033+0.25043169560436107j), (0.41228040156904044-0.3258644927079958j), (0.3255845547364652-0.04129891413069664j), (-0.49623171650577047-0.28943245984704047j)),
569 ((-0.29908631455896795+0.32223868604261874j), (0.22549183711675158-0.07473853585711632j), (0.8473949873724411-0.1266457939975455j), (-0.28218966494496867-0.7447571699002506j)),
570 ((0.43626155573856107-0.22452973659230602j), (-0.13852005024639502-0.2549763508471894j), (0.40223991129540115+0.6286067642439117j), (0.05222020648272985+0.36124142226658207j)),
571 ((-0.5521041254588972+0.04526366394953618j), (0.028005364473586924+0.664136776905772j), (0.19982797953123066+0.6970088780138949j), (-0.27592458615859916+0.05358189338835073j))),
572 (((-0.01401304893255595-0.2592802467152746j), (0.38457288044239724+0.022898781579736238j), (0.11747849077927963+0.02982853498608895j), (0.43510885272308897-0.5971898990476139j)),
573 ((-0.1386049812442307+0.48221564332109246j), (0.12985640511010177-0.46733815759024744j), (0.36035270943159226+0.030123486580092673j), (0.13433570628907954-0.3548300324692315j)),
574 ((0.3630171981969085-0.10489930496648125j), (-0.19285139550925268-0.22152540990095826j), (0.067448080460355-0.22485851852233463j), (-0.22642725802173436-0.8030852201557207j)),
575 ((-0.4923572157490467+0.6941947968511506j), (-0.3083492643827028-0.21029535607801164j), (0.04516826032767807+0.16347006444443446j), (-0.4979722425636467+0.2600475135508704j))),
576 (((-0.9146464795838944-0.4811995164563062j), (0.12372743851535117-0.19857635465689238j), (-0.32654984398293085+0.1399970385669752j), (0.5030023710839411-0.15390603274578885j)),
577 ((0.12140042439229626-0.1677658216785154j), (0.15883782681413416+0.33379103634910656j), (0.185779713490287-0.3870952578769751j), (-0.06711575082420218+0.06791735335184867j)),
578 ((-0.39839017930339415-0.5701893857302205j), (0.517636015942468+0.2847028688489578j), (0.3792093531943226+0.6747299891837335j), (0.3790566911887919-0.5890859768662702j)),
579 ((0.10419770368967918-0.5497491933319889j), (0.037156668670760284-0.08813180251072528j), (0.3918645219248724+0.294242167456119j), (0.46981783997943394-0.1336764441655952j)))),
580 ((((0.033498149202913496+0.5105612554548389j), (-0.00671182242426005-0.34435078880309433j), (-0.0373284784284601-0.5412680712938157j), (-0.21266128835217923+0.7435692921379757j)),
581 ((-0.6338796544785741-0.1519302355817751j), (0.19056981672575435-0.2151423521624617j), (-0.2906156104811447-0.06976477293942895j), (0.11015974132120787+0.034078789456797876j)),
582 ((-0.802973040360448+0.25982604363200634j), (0.4470120196869066+0.1070242653063358j), (-0.17139489854864864+0.280001955020894j), (0.481238612220953-0.1754485899809457j)),
583 ((-0.2395451407327337+0.17708193346527168j), (-0.5161417899394428-0.1119365768848799j), (0.48501626047241986+0.14129638224677343j), (-0.8906342486796647+0.5959903703773012j))),
584 (((0.4573784894991153+0.5594852951634348j), (0.5713680069309577-0.5494425630562785j), (0.08288855869575895-0.46808758933789407j), (0.0881202973963836+0.030710301266941187j)),
585 ((-0.06642229051907478-0.22323447873665903j), (-0.7628208743574287-0.6371785162956514j), (-0.2246568157836294+0.3567254755305702j), (0.68327814761898-0.27973991174997725j)),
586 ((0.2784159984258674-0.17498289569648884j), (0.004730953615886158+0.07715287138774296j), (0.0773670863004613-0.6360012413426752j), (-0.0647551047878423+0.6906328131396173j)),
587 ((0.558480058973719-0.04481293285577537j), (0.09684530531415203-0.40763537195877164j), (-0.3913240230298858-0.004438441098584933j), (0.031510290166036015-0.30876711061254836j))),
588 (((-0.588734853251181+0.36452828173265184j), (-0.19810928581934018+0.20823750547135322j), (-0.45274761144312026-0.17983105119023213j), (-0.11229734410645587+0.2560770621269597j)),
589 ((-0.4038055786345742+0.7025954299708754j), (0.6537842056064525-0.34973368012330475j), (0.35464537317028266-0.21682856487173952j), (-0.01815814374546676+0.4718839114346507j)),
590 ((-0.36336965745600625+0.3759504695343794j), (0.2248053726148399+0.22029644112859348j), (-0.09064428722611384-0.08254509314972736j), (0.12418920854260185-0.5471431985662905j)),
591 ((-0.5200354642412095+0.5425236434272582j), (0.4144201383368241-0.03221161184797661j), (0.10973679214385457+0.2887677216157485j), (0.8119344460935665-0.3782880124387231j))),
592 (((0.5132990185785542+0.1269895435922086j), (-0.8779926345719881-0.5240101078639017j), (-0.1083296281261924-0.8147529275948924j), (0.09647199912137994+0.6723852222785147j)),
593 ((0.2928885382594636-0.17353985395496885j), (-0.21364153320667634-0.03557466867344006j), (0.09421518259275086+0.6153556681629657j), (0.42459824192798623-0.17443990666881448j)),
594 ((-0.5143367641601848-0.474941950841561j), (-0.2759320986482162-0.8250929199965524j), (0.21922685784092444-0.5600860240181191j), (-0.8569179028983865-0.16482185283148332j)),
595 ((0.5268959167118139+0.55401274233894j), (0.08678495563788746-0.11915652486681427j), (-0.35416282616502737-0.4847172453257278j), (0.17111904837721448-0.8480796973331977j)))),
596 ((((0.5469697524334143+0.02787502521930041j), (0.2605342686105838-0.0738711527960102j), (-0.39955538445037275-0.37613379994879603j), (-0.013180544897028024-0.5858094274207383j)),
597 ((0.2506641890300212-0.1324021828426094j), (0.2972858012659867+0.21562443620437732j), (-0.6161716236733459-0.16509522040718683j), (-0.18102929570881354-0.6067237673008904j)),
598 ((-0.13192637373724614-0.6510388019746922j), (-0.5546497186031663+0.15957406458683243j), (0.3605761118213213+0.25686768414528705j), (0.401508970393731-0.5108236410388888j)),
599 ((0.39953367426110775+0.2252371577830028j), (-0.3347746193719203+0.2263747029817541j), (0.43746847580536263+0.5388066331831217j), (-0.07344964656116226+0.5473468419762271j))),
600 (((-0.6996969040609468+0.7213293709800207j), (-0.37557411707556654+0.1506412600826108j), (0.46608440397755446+0.013185375483020345j), (0.29865953531762246+0.19232124238469206j)),
601 ((-0.06222220564236847+0.5694069457780013j), (-0.5368962596793275+0.36703072903452505j), (-0.05182804478010006+0.3840540087750902j), (0.16375632553791997-0.4661212952339301j)),
602 ((-0.4041070739038938-0.04037225736899819j), (0.24215413306521716-0.06631187616668377j), (-0.2663745437846935+0.611183098942953j), (0.337942638568164-0.5670011153091816j)),
603 ((0.3876032723274968-0.08306424304240201j), (0.2173881180889634+0.4512865759999062j), (0.8795902664110721+0.8614312675002035j), (0.2870339354260544-0.11303384551216167j))),
604 (((-0.1319661103321904-0.1378309763195904j), (-0.03263197183994404+0.03651637220786119j), (-0.33530432503994767-0.007463082947573474j), (-0.3110039705203388+0.17231544573803292j)),
605 ((-0.07377573914613977+0.3678250464292866j), (0.3280327212275782-0.08984395132040435j), (-0.4492548090143319-0.3165726498892033j), (0.4186631970202508+0.14692250754002467j)),
606 ((0.12300006190073354+0.8465896476419659j), (-0.3266430699658883+0.9258477806121458j), (0.1270817126276501+0.7278063130820139j), (0.04390487289582379-0.07072636756748818j)),
607 ((0.8411822363338441+0.3271788959517308j), (0.14233232632431592-0.8034008469283107j), (-0.012057809815140041-0.07447549854466373j), (-0.5078787065469428-0.3322994351304549j))),
608 (((0.2823845584710901+0.3169641678915194j), (-0.14926005618963878-0.06141784434383113j), (-0.3336711008317823+0.608644554614276j), (0.042858723261329-0.25353753207960283j)),
609 ((-0.19596385250682435+0.29611929225848677j), (0.9379729841249024-0.5720585057483617j), (0.20515378855823352-0.5330821799545553j), (-0.45689594348515183-0.5221745972924456j)),
610 ((0.005913178294852495-0.04464774171993757j), (-0.3515104653551274-0.8716563770921714j), (-0.5644652537988155+0.4413367915251234j), (-0.32684204426160013-0.6404138884316928j)),
611 ((-0.20862357692064337-0.008586491450952471j), (0.7110044208850719-0.0260275339943824j), (0.33195949443404427-0.060726068233408204j), (-0.24054180926541135-0.22750131116864736j)))),
612 ((((-0.19779207637655705-0.06170675636552225j), (0.24801124896429994+0.52301594517833j), (0.3359762170142643+0.006887001901350498j), (-0.5044830473838094-0.023633199563395157j)),
613 ((0.35936388285588383-0.12044000986333014j), (0.06567318357927132+0.23081033720558908j), (-0.006063340342035706-0.43355358359223595j), (0.560747142959132-0.019735739750161296j)),
614 ((0.16778778206380363+0.4393001381475511j), (-0.19115676223578515+0.023171844709636735j), (-0.10056678281864495+0.11175155826135519j), (-0.24878623491611496+0.8172452900981119j)),
615 ((-0.4955653304024539-0.35864956392371916j), (-0.002728871185003978+0.3416061368260671j), (0.12387109110953831-0.2654493686440327j), (0.10889405520664741+0.1218720709206873j))),
616 (((0.07498012788575437+0.251986782960711j), (0.3511927502553568+0.27907917288389616j), (-0.6319086362942079-0.11628342415274562j), (-0.02365411536311457+0.7887319952841338j)),
617 ((0.38406832355686993+0.03416295519609358j), (0.35717793709754475+0.7751423080742306j), (0.29135030536626805+0.15668909755462013j), (0.14503883313378096-0.030524299930524523j)),
618 ((0.3331132451297607-0.03848385697279688j), (0.0750244753960323+0.10077551583585709j), (-0.15490975501427928-0.1798249796504282j), (0.9066796997830194-0.6602275207883976j)),
619 ((0.1471293723064081+0.10463425812772786j), (-0.5961028228889094+0.5480663905625878j), (0.0026089287349913004-0.5747699075005761j), (0.2899525342736272+0.1268195775198908j))),
620 (((-0.13364076045805806-0.17688339222579297j), (0.6013848685157083+0.3493674941578545j), (0.22523028276047052-0.21939576800830496j), (0.09111222639027305+0.7894981102504295j)),
621 ((0.6016850426953799+0.043886903791527376j), (-0.5060405108831854-0.5381151561460222j), (-0.4760569419146623+0.40666832623996363j), (-0.5318516495722876+0.16837803612551516j)),
622 ((0.024034551466941778-0.2166311876229967j), (0.26494031063742085-0.002375780112287895j), (-0.4730046544996984+0.6644551176991773j), (-0.39157195926624855+0.6199256868216445j)),
623 ((-0.04324867778353203-0.08087976286625231j), (0.1578599942534593-0.5156287674297576j), (-0.15005517462767193-0.09424179596026594j), (-0.13944975064956378-0.17543248499412656j))),
624 (((-0.5648616238096438+0.46394478768979586j), (-0.41003938415951235-0.33614785565882677j), (-0.3893130130095368+0.05645367151196268j), (0.3821121473593535+0.17991382827274327j)),
625 ((-0.5139083991747512+0.789121431720947j), (-0.6171117805874629+0.3660741433822048j), (0.05303400234375011+0.5094418060177022j), (-0.3545806168076585+0.4629656377266379j)),
626 ((0.2658032276104465+0.4237937984173149j), (0.18183157447480658+0.06623748664233398j), (0.12546831548404336-0.10575754034359075j), (-0.6833387940577664+0.23947306785979094j)),
627 ((-0.20503554348285624+0.21628529049971312j), (0.23649982943904524-0.6159980174662008j), (-0.20651357702330975+0.08458167450189069j), (0.j)))))
628
629 def get_python_input3(self, rank, cplx):
630 if not cplx:
631 if rank==0:
632 return (0.37126864363799594,)
633 elif rank==1:
634 return (0.6234908821535466, 0.6138798448505429)
635 elif rank==2:
636 return ((0.46458697075264, 0.47521353725342), (0.2769991834092879, 0.7655903776259643))
637 elif rank==3:
638 return (((-0.7087306338233754, 0.5091993546185136, 0.7823132790082358),
639 (0.7809687239325918, -0.7618301393180559, 0.13846012311583666),
640 (0.24584408982123662, -0.30175410391822816, -0.6508820239463049)),
641 ((0.0799357328507963, 0.4268164046934606, -0.3340669557843154),
642 (-0.5352665915599666, -0.4796035531201281, -0.31521200922735726),
643 (0.6181927127971525, 0.5813500010909463, 0.6485259530707308)),
644 ((-0.607591622470962, 0.5134390179382666, -0.7761053727330762),
645 (0.30315911281007185, -0.7772739725828741, 0.21981237010097954),
646 (0.5720780258224234, -0.7199923733581466, -0.8038912730779739)))
647 elif rank==4:
648 return ((((0.45368972429803434, 0.43658224238126836, 0.327332664787118, 0.1659399779578305),
649 (0.5908203393014015, 0.6287596060266886, 0.26557881193403204, 0.7640693855123928),
650 (0.6550472925659366, 0.4051939492486867, 0.39695234748477226, 0.7984350907853707),
651 (0.45152587205177463, -0.6915126698433964, -0.1408991785923076, 0.5555466803377823)),
652 ((-0.7111217974645967, 0.22442551434498154, 0.33601178864915354, 0.21277504641255832),
653 (0.10220061513651632, 0.4523774178793611, 0.4079018667540423, -0.909554257065248),
654 (0.6139494095517375, 0.3083569476979329, 0.6376629339543685, -0.28647430781873456),
655 (-0.36486444793373635, 0.3134770531471723, 0.19207850462685053, 0.2742209367740796)),
656 ((0.5206089841634276, 0.24952538894537638, 0.0933758645493489, 0.24304014487798284),
657 (0.2039225828898289, 0.423378042043955, 0.21847415387885974, 0.4823494123271024),
658 (0.49781756385165377, 0.42765522168555026, -0.4737414300227722, -0.5398374124738391),
659 (0.2640617374368053, 0.34880253282719476, 0.32357380359477705, -0.7111559522372015)),
660 ((0.23761918672652063, 0.1593578505403827, 0.6530063992033186, 0.9079894778799892),
661 (-0.8250545394400823, 0.4861804550261372, -0.3406365725750848, 0.42480466462889144),
662 (0.47203132507512685, 0.20818156589620632, 0.20161698569028383, 0.42806013456132413),
663 (0.7792675299565863, 0.3736959703075082, 0.19761992623295196, 0.4235372420916027))),
664 (((0.6459817009885405, 0.2610419659851719, 0.39888588458573665, 0.6358114313716404),
665 (0.6789108524310596, 0.4760144991501489, 0.5132407231875976, -0.7445121079875354),
666 (-0.3165090047475903, 0.1882290433512482, -0.30270840337500193, 0.4773827304127968),
667 (0.27248041023839426, 0.5356669773887297, -0.5759298824759524, 0.27026295067501754)),
668 ((0.2225815420544881, 0.6296933698530776, 0.6420994781708316, 0.5292910401325328),
669 (0.4838814244753861, 0.3015763358329324, 0.5966105067811018, 0.437555952383517),
670 (0.2508886824465943, -0.3688703869280175, 0.44848941714873286, 0.6968286221703255),
671 (0.7458127375857659, 0.5565367320025696, -0.5221639609134333, -0.5043229193744858)),
672 ((0.2704586652152375, 0.23622061144754075, 0.5668874045788246, -0.7383427762361463),
673 (0.3326338826927772, -0.5180692401299339, 0.6853188934444896, -0.5105611442225273),
674 (0.32729714889258044, 0.7634733351662765, 0.2667323956085834, 0.3813499428619923),
675 (-0.707758750914661, 0.23317899979615478, -0.6728060312412778, -0.5045011288076484)),
676 ((-0.2758755420358796, -0.6849112850328907, 0.7208465949939953, 0.5465246847493163),
677 (0.5382081700827642, 0.4626841039902129, 0.38537277159039474, -0.5918003106653552),
678 (0.7410792569612943, -0.848695963275266, -0.35215371840141596, 0.7859807920638692),
679 (0.439754658119384, -0.09885040884202281, -0.20324265625602897, 0.6393707779383961))),
680 (((0.45932643067605416, 0.4867064483724215, -0.2492845750953945, 0.4071869028109893),
681 (0.518352199566693, 0.6265341328104177, 0.5719047743470251, -0.8284284690707643),
682 (0.1255527780884896, -0.133522460155736, 0.5939516968011829, 0.6970674969748756),
683 (0.821986273583169, 0.3881563859122813, 0.16941736964779366, -0.288738726812057)),
684 ((0.48102730273877786, 0.1522385344365771, 0.5752150637264031, 0.39522973755221524),
685 (-0.732520712427958, -0.49190588963815157, 0.6125760080831428, 0.2716702847832281),
686 (-0.8159103581398756, 0.34507912842082983, 0.7075657623779936, 0.29530894172611916),
687 (0.5278442353318813, -0.6539972004065213, -0.48897529954240776, 0.7932403888940815)),
688 ((0.831358889394934, 0.48050345824229945, -0.6410388202892018, 0.8982570057418652),
689 (0.30388123939085465, 0.727912073121657, -0.543834760379716, -0.6710456332208439),
690 (0.4417259323277584, -0.5717441377950038, 0.3664067245442036, 0.3280925201821242),
691 (-0.5400907637568426, 0.43207844188064887, -0.732946675152238, -0.5339092194505695)),
692 ((-0.22369526225631464, 0.5665529520090573, 0.2653373517286637, 0.6914637769007175),
693 (0.22138531453529892, 0.17362665833183274, 0.11873401018627547, 0.48731998406078203),
694 (0.5508721228465998, -0.3492961556670177, -0.5692351404720578, 0.5107492266892075),
695 (0.17584863513461835, -0.35755945941346623, 0.7650117785966029, 0.48316674832514844))),
696 (((0.2982202413301988, 0.2348830652298031, 0.3114442699257422, -0.20218169729319738),
697 (0.6846710473822368, -0.8119003553529898, 0.1790804504032915, 0.4781252356617314),
698 (-0.3766941501672641, 0.5437027703705374, -0.24423050827666176, 0.3323763024031741),
699 (0.8189980567608663, -0.5888920746029481, 0.17138276940268463, 0.5475256795584624)),
700 ((0.4569907243510988, 0.5255497422421722, -0.1680676291815795, -0.2879601796868399),
701 (0.5419471765149858, 0.8765158329632898, -0.21847500231364173, 0.6219663103942495),
702 (0.8993300494227338, 0.5256551743041176, 0.4312579142909404, -0.28503463714017396),
703 (-0.6601304123050094, 0.9681225089321629, 0.6110831795473397, 0.630733896684101)),
704 ((0.7252549854189686, -0.48905018110325815, 0.3949054499635516, 0.6883221515509466),
705 (0.3510020242244332, 0.5964593467774927, -0.665927090247577, -0.19851750424804993),
706 (0.49702295298466764, -0.32952301722148614, 0.6578112215358343, 0.629875436683738),
707 (0.5228582859488041, 0.48834135369831744, -0.8107618558028835, 0.012956020032133924)),
708 ((-0.3966015859408982, 0.19901168720580728, 0.6930890007374754, 0.7839579709117346),
709 (0.8623235889093344, 0.5661301336086426, -0.6547115325958021, -0.6689861941430038),
710 (-0.5105113993916237, 0.7066840336625683, 0.8004786600943815, 0.5266845579213677),
711 (0.689553296868146, -0.773301352126767, -0.7364812118860565, 0.5377502245784462))))
712 else:
713 if rank==0:
714 return (0.37126864363799594j,)
715 elif rank==1:
716 return (-0.6234908821535466, -0.6138798448505429j)
717 elif rank==2:
718 return ((0.46458697075264j, 0.47521353725342), (-0.2769991834092879j, 0.7655903776259643))
719 elif rank==3:
720 return ((((0.1454277130999836-0.7320274919853249j), (0.6111728482069096+0.3264747748994178j), (-0.5638648912195857-0.17450334170489668j)),
721 ((0.36745011107568193-0.36335598004419434j), (0.17683177117302507+0.17980667188917787j), (0.1975971229124449+0.4658291218212517j)),
722 ((-0.2014605099933947+0.2948257187520392j), (-0.744292187546457-0.06353546214852701j), (0.5315307768500955+0.20979695600906234j))),
723 (((0.6658801836076347-0.5765177344716341j), (0.49015610705744417-0.5133880244308395j), (-0.1502312930208003+0.1561733784845012j)),
724 ((-0.661348002857287-0.029644750992120383j), (0.006584637699976192-0.4781943559540154j), (0.12266084950784173+0.46542904661542706j)),
725 ((-0.41697557600280255-0.3537461357888442j), (0.26272750067625794-0.43630595153076535j), (-0.21367481541695688-0.2618183771588106j))),
726 (((-0.22338538892626414-0.10818049912878436j), (-0.040383727106552136+0.48764341091162444j), (0.014766392396017403+0.8223651913211714j)),
727 ((0.003228290936111433-0.37610619147220625j), (-0.01103811298925661-0.39851348234329986j), (0.20163130848248234-0.49523755760391885j)),
728 ((0.37812723691663375+0.354147330172629j), (0.08116710042198705+0.1643297763093502j), (0.015047687899757523-0.05023160033399521j))))
729 elif rank==4:
730 return ((((0.45368972429803434, 0.43658224238126836j, 0.327332664787118, 0.1659399779578305),
731 (0.5908203393014015, 0.6287596060266886, 0.26557881193403204, 0.7640693855123928),
732 (0.6550472925659366, 0.4051939492486867, 0.39695234748477226, 0.7984350907853707),
733 (0.45152587205177463, 0.6915126698433964, 0.1408991785923076, 0.5555466803377823)),
734 ((0.7111217974645967, -0.224425514+0.12j, -0.336011788-035j, 0.21277504641255832),
735 (0.10220061513651632, 0.4523774178793611, 0.4079018667540423, 0.909554257065248),
736 (0.6139494095517375, 0.3083569476979329, 0.6376629339543685, 0.28647430781873456),
737 (0.36486444793373635, -0.31347705-0.8765j, 0.19207850462685053, 0.2742209367740796)),
738 ((0.5206089841634276, 0.24952538894537638, 0.0933758645493489, 0.24304014487798284),
739 (-0.2039225828898289, 0.423378042043955, 0.21847415387885974, 0.4823494123271024),
740 (0.49781756385165377, 0.42765522168555026j, 0.4737414300227722, 0.5398374124738391),
741 (0.2640617374368053, 0.34880253282719476, 0.32357380359477705, 0.7111559522372015)),
742 ((0.23761918672652063, -0.1593578505403827, 0.6530063992033186, 0.9079894778799892),
743 (0.8250545394400823, 0.4861804550261372, 0.3406365725750848, 0.42480466462889144),
744 (0.47203132507512685, 0.20818156589620632, 0.20161698569028383, 0.42806013456132413),
745 (0.7792675299565863, -0.3736959703075082, -0.19761992623295196, 0.4235372420916027))),
746 (((0.6459817009885405, 0.2610419659851719, -0.39888588458573665, 0.6358114313716404),
747 (0.6789108524310596, 0.4760144991501489, 0.5132407231875976, 0.7445121079875354),
748 (0.3165090047475903, 0.1882290433512482, 0.30270840337500193, 0.4773827304127968),
749 (0.27248041023839426, 0.5356669773887297, 0.5759298824759524, 0.27026295067501754)),
750 ((-0.2225815420544881, 0.6296933698530776, 0.6420994781708316, 0.5292910401325328),
751 (0.4838814244753861, 0.3015763358329324, 0.5966105067811018, 0.437555952383517),
752 (0.2508886824465943, 0.3688703869280175j, 0.44848941714873286, 0.6968286221703255),
753 (0.7458127375857659, 0.5565367320025696, 0.5221639609134333, 0.5043229193744858)),
754 ((0.2704586652152375, 0.23622061144754075, 0.5668874045788246, 0.7383427762361463),
755 (0.3326338826927772, 0.5180692401299339, -0.6853188934444896, 0.5105611442225273),
756 (0.32729714889258044, 0.7634733351662765, 0.2667323956085834, 0.3813499428619923),
757 (0.707758750914661, 0.23317899979615478, 0.6728060312412778, 0.5045011288076484)),
758 ((0.2758755420358796, 0.6849112850328907, 0.7208465949939953, 0.5465246847493163),
759 (0.5382081700827642, 0.4626841039902129, 0.38537277159039474, 0.5918003106653552),
760 (0.7410792569612943, 0.848695963275266, 0.35215371840141596, 0.7859807920638692),
761 (0.439754658119384, 0.09885040884202281, 0.20324265625602897, 0.6393707779383961))),
762 (((0.45932643067605416, 0.4867064483724215, 0.2492845750953945, 0.4071869028109893),
763 (0.518352199566693, 0.6265341328104177, 0.5719047743470251, 0.8284284690707643),
764 (0.1255527780884896, 0.133522460155736, 0.5939516968011829, 0.6970674969748756),
765 (0.821986273583169, 0.3881563859122813, 0.16941736964779366, 0.288738726812057)),
766 ((0.48102730273877786, 0.1522385344365771, 0.5752150637264031, 0.39522973755221524),
767 (0.732520712427958, 0.49190588963815157, 0.6125760080831428, 0.2716702847832281),
768 (0.8159103581398756, 0.34507912842082983, 0.7075657623779936, 0.29530894172611916),
769 (0.5278442353318813, 0.6539972004065213, 0.48897529954240776, 0.7932403888940815)),
770 ((0.831358889394934, 0.48050345824229945, 0.6410388202892018, 0.8982570057418652),
771 (0.30388123939085465, 0.727912073121657, 0.543834760379716, 0.6710456332208439),
772 (0.4417259323277584, 0.5717441377950038, 0.3664067245442036, 0.3280925201821242),
773 (0.5400907637568426, 0.43207844188064887, 0.732946675152238, 0.5339092194505695)),
774 ((0.22369526225631464, 0.5665529520090573, 0.2653373517286637, 0.6914637769007175),
775 (0.22138531453529892, 0.17362665833183274, 0.11873401018627547, 0.48731998406078203),
776 (0.5508721228465998, 0.3492961556670177, 0.5692351404720578, 0.5107492266892075),
777 (0.17584863513461835, 0.35755945941346623, 0.7650117785966029, 0.48316674832514844))),
778 (((0.2982202413301988, 0.2348830652298031, 0.3114442699257422, 0.20218169729319738),
779 (0.6846710473822368, 0.8119003553529898, 0.1790804504032915, 0.4781252356617314),
780 (0.3766941501672641, 0.5437027703705374, 0.24423050827666176, 0.3323763024031741),
781 (0.8189980567608663, 0.5888920746029481, 0.17138276940268463, 0.5475256795584624)),
782 ((0.4569907243510988, 0.5255497422421722, 0.1680676291815795, 0.2879601796868399),
783 (0.5419471765149858, 0.8765158329632898, 0.21847500231364173, 0.6219663103942495),
784 (0.8993300494227338, 0.5256551743041176, 0.4312579142909404, 0.28503463714017396),
785 (0.6601304123050094, 0.9681225089321629, 0.6110831795473397, 0.630733896684101)),
786 ((0.7252549854189686, 0.48905018110325815, 0.3949054499635516, 0.6883221515509466),
787 (0.3510020242244332, 0.5964593467774927, 0.665927090247577, 0.19851750424804993),
788 (0.49702295298466764, 0.32952301722148614, 0.6578112215358343, 0.629875436683738),
789 (0.5228582859488041, 0.48834135369831744, 0.8107618558028835, 0.012956020032133924)),
790 ((0.3966015859408982, 0.19901168720580728, 0.6930890007374754, 0.7839579709117346),
791 (0.8623235889093344, 0.5661301336086426, 0.6547115325958021, 0.6689861941430038),
792 (0.5105113993916237, 0.7066840336625683, 0.8004786600943815, 0.5266845579213677),
793 (0.689553296868146j, 0.773301352126767j, 0.7364812118860565j, 0.5377502245784462))))
794
795
796 def get_python_input4(self, rank, cplx):
797 if not cplx:
798 if rank==0:
799 return (0.9153151043823012,)
800 elif rank==1:
801 return (-0.5162647246320071, -0.06342374260616546)
802 elif rank==2:
803 return ((0.7011839736500342, 0.625639950892529), (-0.17902320165992758, -0.049498389409131205))
804 elif rank==3:
805 return (((0.008309531806355519, 0.22817074073669497, 0.7216964601946423),
806 (0.33084432155377397, -0.48472374994936485, 0.4116921963539759),
807 (0.0257088350105531, -0.2370277105296692, 0.3798801329452163)),
808 ((0.01734050560720546, 0.16286702001136155, -0.6501064087150703),
809 (0.02818311904325488, -0.4169901835040347, 0.4086136135582773),
810 (0.5627838019596704, -0.16279418267275847, 0.581645077262897)),
811 ((0.6948207132066607, 0.23541367609085884, -0.4228977230091847),
812 (0.3216823894305869, 0.37129093662137924, -0.7134833270353387),
813 (0.710538786928389, -0.08441890458925416, -0.458946120570603)))
814 elif rank==4:((((0.37235501675945715, 0.11714100415866135, -0.034600745840691394, -0.15554835015413082),
815 (0.47232144877941096, 0.07592804193006697, 0.3405294503824112, 0.21948666128556615),
816 (-0.5332861513294131, -0.08886798656259431, -0.6083217502772487, 0.2316612945607922),
817 (0.5258922230225587, 0.08708823651373188, 0.4234306811212821, -0.04179959817125434)),
818 ((-0.3035688394279197, 0.49483554648710537, 0.05745994060999282, -0.12747381808333336),
819 (0.39332214767836104, 0.46534190633912254, 0.04365690803996003, 0.7650379849598341),
820 (0.1999985251338784, 0.0842829190391805, -0.16877153378631293, 0.31704188690973756),
821 (-0.329887201245436, -0.6511923884088605, -0.6220851080992487, -0.8494734189039839)),
822 ((-0.3231756242543622, -0.554464792835363, 0.4522418958171174, 0.7395807541527681),
823 (0.5498904829451162, -0.05590161752080769, 0.4965321688385663, 0.5728276202033591),
824 (0.5272647821134722, 0.5774470894044734, -0.12581800958739708, 0.9700828208339976),
825 (0.2893640797543078, -0.5484780137131635, 0.9149540829219327, -0.4070409332163506)),
826 ((0.8068861149817737, -0.08739646094657716, 0.15604945884485388, 0.2159877611783666),
827 (-0.08757552786227041, -0.5362091498098354, 0.1379626847994988, -0.02263864637679258),
828 (-0.05403837215914031, 0.6570928483791509, -0.014539560837078191, 0.1353955668770478),
829 (-0.033528144292161, -0.471223531770967, -0.012087259265455508, -0.4443704288092061))),
830 (((0.12815286370127177, 0.08288774005977806, -0.6591909957174392, -0.3227689715877514),
831 (-0.1560371012493621, 0.04563397602135244, 0.18608455069144747, -0.23618249688069137),
832 (-0.1857379168928618, -0.6112258715631804, 0.257168970542067, 0.46862986167858467),
833 (0.8134511475542548, -0.2930500911112336, 0.31803040987546893, -0.1662974948326531)),
834 ((0.09994879483867802, 0.11656104212951102, 0.24567744809079017, 0.2466674448155779),
835 (0.10560598300537649, 0.5594223586687221, -0.269996887150316, -0.006724786299250773),
836 (0.2494899758063036, -0.25302027094976054, 0.5346069245538014, 0.9394209073288707),
837 (0.4895739925732161, -0.6973902811154304, -0.04576531668146877, -0.05978124614419089)),
838 ((-0.4225874457751645, 0.06851122980870317, -0.12558552929455635, -0.059065175364745315),
839 (-0.5869469247109007, -0.4166268018632071, -0.17595117034871932, 0.34489468842970006),
840 (0.19428688924434412, -0.4410298941561428, -0.07610953060207504, 0.2917329578363864),
841 (-0.3087834675004315, -0.5017232119230198, 0.6463307399810825, -0.0997023137687646)),
842 ((-0.3721359342866154, 0.012800610965129966, -0.026147073121323694, 0.249394864255974),
843 (-0.19732520391810227, 0.6877652212967196, 0.09328828976651427, -0.6510049138630607),
844 (-0.4848547986972145, -0.35735976033028827, 0.09165186856904783, -0.40982007152443234),
845 (-0.574914716311232, -0.6488293490765211, 0.4883180795650498, -0.15158507647269426))),
846 (((0.5708514963046316, -0.21247793529126768, 0.11030963705086905, -0.4353799184220226),
847 (0.37323818315312085, -0.10788816216228836, -0.16605325912656543, 0.6104874356554703),
848 (-0.30847384861896465, -0.16679636365155348, 0.5922642783564169, 0.07864692847157684),
849 (0.2791875133546827, 0.09496780294295215, -0.45316050025403876, -0.1610271603413973)),
850 ((-0.42706418878716035, 0.2928066574998388, 0.571174679676169, -0.14560760969133357),
851 (0.9643430182032757, -0.008481138733699822, 0.39800339772985893, -0.7013700291692165),
852 (0.8355714997095827, -0.624788527855067, 0.05466250391400629, -0.9509878285060569),
853 (-0.0973807062547889, -0.5407506278578577, 0.09210951353229235, 0.154379276954291)),
854 ((0.020599999927309876, -0.27945772586433815, -0.4172996686676522, -0.01634325308254314),
855 (0.20212191256900158, 0.21234576281878903, -0.639142180879022, 0.5580272378144776),
856 (0.010545335242685194, 0.29112493809527284, 0.018635172247521647, -0.06613029570794826),
857 (0.155833422371511, -0.09759470769513245, -0.03063166472236889, -0.05428014538371495)),
858 ((0.23577186821185425, 0.1500579314912276, -0.3132878838809129, -0.1097762446447772),
859 (0.6269933317054381, 0.6145430525526924, -0.10380848715617585, -0.06442945507207776),
860 (0.2787614779979213, -0.7358725127577144, 0.20796477034679672, -0.23780046049837644),
861 (0.9267282798589614, 0.16997001112351162, -0.5282983087375479, 0.36538217505303483))),
862 (((-0.8579510472159081, -0.7246352503258299, -0.15510078775815894, 0.12619420876242404),
863 (0.24743683866122967, 0.5615110519360075, -0.3322404459371945, -0.7048709861468231),
864 (0.7028698531861565, -0.22853480716765995, 0.7720042932598191, -0.13166327267604216),
865 (-0.2435352215957982, 0.22931953113912795, 0.3655062306761121, -0.12152100998681392)),
866 ((-0.5677571978624529, 0.6521623982090801, 0.45610015782255964, 0.04035238030125632),
867 (-0.23851414230639378, -0.30637231258391073, 0.046201693717512704, -0.27136411183670195),
868 (0.6857476357642973, 0.3410717717617201, 0.01289524408298115, -0.013360855488527279),
869 (-0.032304469159492366, -0.0835492970599051, -0.0028734534647487653, -0.4654703960804025)),
870 ((-0.2290818436503651, -0.5296681103638246, 0.6162246876592932, 0.17128234890632854),
871 (-0.5811995554061062, 0.6417647758172681, 0.7628730887993724, -0.37912907041142807),
872 (-0.09316417943340105, -0.27095731560349645, 0.6194574328449272, -0.24948060355551438),
873 (0.5728337951942462, -0.0924305626769284, 0.3298848378599575, 0.415637420812042)),
874 ((-0.061049694343089045, -0.8003464214443662, 0.29655140456799867, -0.7735799111191699),
875 (0.29917720082276444, 0.3643378373698344, -0.7665309138650984, 0.35430115119764427),
876 (0.39429765393905847, -0.215211613577439, 0.22195510594293588, -0.20240345662915427),
877 (-0.06694319875792287, -0.6036398699231508, -0.6775777632295854, -0.13199173966023536))))
878 if rank==0:
879 return (0.1916945198248936-0.13520600821648232j,)
880 elif rank==1:
881 return (-0.1083940865407611-0.43931913768613384j,)
882 elif rank==2:
883 return (((-0.0008665125778035687+0.43157678379712805j), (0.6508260343349135-0.13342532131846585j)),
884 ((0.25346912744174943-0.6465790214072134j), (-0.15962337965743467-0.01177491815738152j)))
885 elif rank==3:
886 return ((((-0.11057636539275228-0.3175750394405701j), (0.7947500539520073-0.3434988438428338j), (-0.17008528220766383+0.22755084276175752j)),
887 ((-0.21753248913138046+0.3073046922694095j), (-0.5987149773078468+0.6404407581234498j), (-0.2733628131901674-0.7312216337378827j)),
888 ((0.46021781519502736-0.32179246699810604j), (-0.4650578935554821+0.5210104598763112j), (-0.36535537317523425+0.4289080712460789j))),
889 (((-0.19578475796433725-0.1604786258607791j), (-0.070669831429362-0.34066414803932554j), (0.09414012129996285-0.14312760505028332j)),
890 ((0.02962390819527594-0.08129940555056081j), (-0.29691277198852295+0.5445730330279386j), (-0.8314872838325128-0.10478982105017087j)),
891 ((-0.4875034489526303+0.11245261823496877j), (0.307917858878609+0.4746451405124599j), (0.41480950330452204+0.4450092645412934j))),
892 (((0.7567520084099626-0.5568082250793975j), (0.5933616991307173-0.03406028934656724j), (-0.5349903124170489-0.396773950179919j)),
893 ((0.46555626239679515-0.16518290948365888j), (0.8398844896104096+0.28827801011043974j), (-0.05286735815237498-0.06537526369272817j)),
894 ((-0.7873594868218297+0.23455905590585036j), (0.43718502738612375+0.17935920771077773j), (-0.16708210956083058-0.29630670019555294j))))
895 elif rank==4:
896 return (((((-0.37669743703656033+0.3367989420952414j), (0.3280202440259613-0.42443833914985585j), (0.5751207710641884-0.6671925997156294j), (0.033365010564720965+0.18416168128369115j)),
897 ((-0.1305885333955732+0.258183803742714j), (0.5291111892948406+0.12768860044004038j), (0.3044538909411727+0.7018739119608393j), (-0.09384324555072743+0.44762291055240755j)),
898 ((-0.5172985234092151-0.4246631134190011j), (-0.05697702151796369-0.38499672629412374j), (-0.16330371172505076+0.6329885254352636j), (0.005206064694582513-0.6979570589219142j)),
899 ((0.10042081122085011+0.2730078961548078j), (0.37702343940278005+0.3312339822361312j), (-0.38712718853663275+0.043310706850169245j), (-0.43842301200718425-0.15186366915048966j))),
900 (((0.5818010551152796-0.36497243994846373j), (0.19198280565084558-0.5011496107835725j), (0.24413432536571378-0.6379767379075698j), (0.34455193126269634-0.08664637040123147j)),
901 ((0.8168889487559259-0.9032656902589163j), (-0.5603456946720172-0.1195734571550765j), (-0.1605088593685251-0.13483121449943314j), (0.6174544850032535-0.44047675305704703j)),
902 ((-0.42307951312623815-0.30327702147916713j), (-0.2618637556175357-0.1986043745329351j), (0.04718850736664815-0.10738185754632579j), (0.23587778497574974-0.6504332945195135j)),
903 ((-0.05076119295424941+0.4047602633806563j), (0.11093393085917946+0.12427836254382474j), (-0.8132105391139205+0.37548311525522216j), (-0.26953236282243265-0.31159778790771064j))),
904 (((-0.39250877863236644-0.4881044190028637j), (-0.8360834411136835+0.02188471873683928j), (0.02679042509032048+0.6879063358020456j), (-0.10048291543082566-0.2233219762257277j)),
905 ((0.5390402819188123+0.1204054017602989j), (-0.2931730415212582+0.11535281644759132j), (-0.30548980198917564+0.026411218830157512j), (-0.19472436433201012+0.081056583169555j)),
906 ((0.0005464858113309878+0.3225143801544309j), (-0.07709944497321652-0.7481530123633068j), (0.16337505191696478+0.5103151975086361j), (-0.12750402538858618+0.7545748937897574j)),
907 ((-0.9554831189812294+0.13987108056505082j), (-0.27483290404380223+0.8226848528344127j), (0.521831527873442+0.4970661477293601j), (0.9061234743087792-0.1504241528269118j))),
908 (((-0.1882846543421225+0.5304062832141554j), (0.10579078542556297+0.22780442714023064j), (-0.011294630508038805+0.5779466549586485j), (0.08025599710182507+0.12004966544994533j)),
909 ((-0.6586788023520793+0.29488829592817734j), (-0.5025090781370782-0.495410044054439j), (-0.10853891499487645+0.024651020003384483j), (-0.0009726817521150677-0.0764710138257787j)),
910 ((0.32613207343707196+0.7335754039319815j), (0.3508358997571207+0.3240452830066213j), (-0.3835841075004305-0.06342158227281525j), (0.32061104148045194+0.14435049185949667j)),
911 ((-0.4702553987233302+0.2965575488822829j), (0.2726823746215451+0.21252896664298115j), (-0.40480220218419416+0.5684528722603068j), (-0.8662951962865073-0.02018655350327081j)))),
912 ((((0.31691366872411453-0.16565320239992465j), (0.6119279222420073+0.4061058795460125j), (-0.2724431323567723+0.47301403973137435j), (-0.07564711093225085+0.3318822040674295j)),
913 ((0.35444199580157854-0.17921840306504822j), (0.029427102181375453-0.03357316416483169j), (-0.21032412371046783+0.01667316554624787j), (0.0663834457499225+0.2586952407467318j)),
914 ((0.20873626161577874+0.5387073631313459j), (-0.7679630879573601-0.6188379588287274j), (-0.3195249665071722-0.597193477248285j), (0.43272245800774456-0.23801421308823245j)),
915 ((-0.037613711494389857+0.10818062943154994j), (0.057829377352543676-0.04999419264444982j), (0.3022465975999099-0.5349078896215682j), (-0.5231242476811815+0.42998339300583244j))),
916 (((0.0856361897298803-0.6998154250460039j), (-0.11463868513147624+0.16152088708434365j), (-0.5127925687279636+0.11002739851016519j), (0.2599079869203247+0.02491071853128979j)),
917 ((0.7015604708055061-0.591598702814476j), (0.7022599678145434+0.41303884890699527j), (0.6770753952633466+0.003915616175995784j), (0.5221501522889332+0.015184149238084643j)),
918 ((-0.18955797508665606+0.5485819797109972j), (-0.2971676553030109-0.17836414101585318j), (-0.5711343992923511+0.06842526899025392j), (0.059265927050955236-0.6735602608611315j)),
919 ((-0.1520857966428928+0.29169887374589554j), (-0.3146943503222607+0.5076388713801581j), (0.9710102040544507-0.04876498142745134j), (-0.19853216294306686-0.6550688027359666j))),
920 (((0.18951981302782428-0.2412793295224065j), (-0.7777428226995063-0.365999090785438j), (0.6228318351380273+0.06995476281885704j), (-0.6740149120004719+0.10711001728991842j)),
921 ((0.1129279157975297-0.4283924106357786j), (0.40438767481744564-0.2635679354391648j), (-0.29420852109617845+0.4847733937880756j), (-0.3510828870978512-0.11064283076221504j)),
922 ((-0.060808250212467274-0.3509555798569397j), (0.2310570876125041+0.27346891132233075j), (-0.07736476852424223-0.24833618620126674j), (-0.78074150969927-0.7230863125461435j)),
923 ((-0.4757051297031988-0.3783458735437233j), (-0.5401521152562118+0.035723203675678605j), (-0.17580640953890292+0.6827665743960223j), (0.39326629202893215-0.21993263281519704j))),
924 (((0.6386214443611579-0.764943290056036j), (0.18713633494964688+0.06363868519230131j), (0.29526336078276216+0.30178995300494826j), (0.05001443364181468-0.42881696117817625j)),
925 ((-0.5275034189476259+0.6550538425247074j), (0.6943261638500615+0.006776882726276523j), (0.5153311571315663-0.05413330835192531j), (0.2988153589979258+0.3049744060817169j)),
926 ((0.14785883887146767+0.0763051493978234j), (0.16312754082743042-0.03795584967477661j), (0.040229546593022913+0.16530303115245693j), (-0.1831772476291057+0.06328054147911466j)),
927 ((0.1476643669767913+0.325680674159183j), (0.14707868586431028+0.9047584008820329j), (0.9011552589577467+0.11447442281060494j), (0.005973469367093642+0.22263862886336694j)))),
928 ((((0.19283269000734593-0.28709497228064285j), (-0.47096481014533476-0.13173508510496024j), (0.562477770007406+0.26491027512352816j), (0.03783964186943933-0.03978396106597093j)),
929 ((-0.5333576204038937+0.20057170743675312j), (-0.5554481805321547-0.7626212986623081j), (-0.47686434977953773+0.5802686248218423j), (0.5920361023050167-0.14491946597655325j)),
930 ((-0.4126930229374297+0.39966003185091536j), (0.2850544980649773+0.7484131241244993j), (-0.13160190253004878-0.10190869345823672j), (0.34602765479100117-0.18205626983880596j)),
931 ((0.4219188545707674+0.5086508238768007j), (-0.0677006672392233-0.11766198036052333j), (0.45020863060305627+0.20389430038718892j), (-0.5125265629738844-0.4771765521430704j))),
932 (((0.37701640058097874+0.05204261987362635j), (0.17260326851591068+0.4285264843160088j), (0.10359131962737611-0.8137076321465101j), (-0.02286762418683419+0.34829474498525603j)),
933 ((-0.010410922319074811+0.09105220878486131j), (0.43519051427706756-0.20447320160562032j), (-0.14399460120821073-0.46777690039065734j), (-0.04872781035419649-0.4298525400055381j)),
934 ((0.18896093939688385-0.16705599789601278j), (-0.5364935215041872+0.3749309246942789j), (-0.18268036947723632-0.25385754338743693j), (-0.5091199532153567-0.32766264406763357j)),
935 ((-0.35235219578282473-0.661850620842785j), (-0.6072679594510126+0.09656978047989173j), (-0.5126540710595279-0.1672195227969181j), (-0.2830351750830662+0.12517368885386926j))),
936 (((0.04686974540685185+0.08438300173836044j), (-0.17974800480460484-0.5026848778236594j), (0.4496570044640005+0.5182953038532189j), (0.673892629006263-0.39593441606543756j)),
937 ((0.2166952267447365+0.191459813763583j), (0.6130127820906195+0.3500318802920196j), (-0.5419820712240513-0.13457437148792628j), (0.3343112127482648+0.07888610819775466j)),
938 ((-0.39276675341804346+0.7570076529568248j), (-0.3988406372126929-0.8608946218773403j), (0.576648779753566-0.6725693071527158j), (-0.4183085693722922-0.21421782809798817j)),
939 ((-0.3010231423615105-0.020535079475881957j), (0.006107583077576639-0.0812822534033596j), (-0.029724210300932086+0.35635178233793563j), (-0.20891136846604574-0.34703924148843457j))),
940 (((-0.07194174413486831-0.07558412271718051j), (0.04378297698600753+0.17934356988151767j), (-0.47189150794751766+0.5780327062551049j), (-0.5125220316089242+0.24892817111211096j)),
941 ((-0.36059488463245326-0.44683441504676813j), (-0.26735527077170973-0.3699650359773635j), (-0.3057966963958182-0.07264390084352956j), (-0.7281560219128018-0.3560659246206268j)),
942 ((0.1329046092679943-0.03153689763456646j), (-0.39271490859265534+0.2062873488401652j), (0.3802945078185428+0.013499908367005542j), (-0.1756191306230559+0.40464153144244697j)),
943 ((0.4802390728634319+0.5190956065611698j), (0.14465603430627616+0.005475878763732567j), (0.3018703057475889-0.0352888758412262j), (0.6943368615391298+0.019202869121973j)))),
944 ((((-0.07500673578875616+0.44031114122474946j), (-0.7205258224784314+0.16865003592058259j), (0.07737090079316822-0.1946277248102064j), (-0.34196425749144166+0.03817853010131156j)),
945 ((0.17755139682612575+0.8238455606059262j), (-0.6657721503572177+0.19793806270117809j), (0.29019650633065386-0.0952118701646486j), (0.14507433328106534-0.515594049976717j)),
946 ((-0.2046653289959417-0.3621700659367947j), (0.6793982849049701+0.3212370850216385j), (0.752468338707956-0.2485926849867901j), (0.5515361195592884-0.4034740977009965j)),
947 ((0.06814007049845194-0.598437803123891j), (-0.5946418447770585-0.6903237885619982j), (-0.36295182276739524-0.7047248113077316j), (0.4250255531847421-0.18162334572617966j))),
948 (((-0.330842360993192+0.6332178345844492j), (-0.1626525936800115+0.12616954195069585j), (-0.1140983493592932+0.16115787963839956j), (-0.5146861509822459-0.47712128557213807j)),
949 ((-0.5846954521386037+0.05824004235002933j), (-0.6485911018934266+0.16723477358583239j), (0.08398284507027964-0.43010971419153865j), (0.473289092320511-0.20201419097169482j)),
950 ((0.4304851671543479+0.3403150943545751j), (-0.5833160536688786+0.4728250155621482j), (0.07457807134020211-0.7490249718724199j), (-0.7171842661512965-0.4045396117992399j)),
951 ((0.38115752645606027-0.581098921622462j), (-0.5631172341731325-0.3169246082570121j), (-0.3187906517321565-0.04147798917128964j), (0.19509565877461577-0.2078658202899497j))),
952 (((0.8183607993729423+0.6099794355828236j), (-0.04871961343893161-0.07033624155755913j), (-0.5113369106671184+0.057386755559324376j), (-0.8572333770628078-0.11952395630018997j)),
953 ((-0.14669430492038193+0.22930953454219938j), (0.8593021941295018-0.6567284188814271j), (-0.3498005693861541+0.4978632770594925j), (0.09110494626854304+0.14596905700539575j)),
954 ((0.5821565237474922+0.0943377064392501j), (-0.12067415509324098-0.2752660016054119j), (-0.06217450649156364-0.024782412571600743j), (0.18973873165376154-0.4643249608246277j)),
955 ((0.221440302929653-0.013268267564226499j), (0.23727492055667987+0.24335036846179636j), (0.20590162356036257-0.7773726672859762j), (0.6650340170009239+0.23251699933937398j))),
956 (((-0.10862117873771637-0.37601603473231926j), (0.14702795412639624+0.2708674170765101j), (-0.6649779112242566-0.18174044911513143j), (-0.8835405205485383+0.67800004101369j)),
957 ((0.5595753470648851+0.06619472947501459j), (-0.5165025553457263+0.06614105368782663j), (0.6989509353083828-0.04232214137167867j), (0.27326536666764734+0.055971454399568965j)),
958 ((-0.4225563301191848-0.46504433769204656j), (0.021693692712496326+0.03736604787989928j), (-0.5231593756263367-0.2743293424312542j), (0.030072300170931987-0.5713925695108115j)),
959 ((0.2665173135965969-0.541283942963249j), (0.10755640859650628-0.30605105910067054j), (-0.5717247916937898+0.2531629402939769j), (0.6106906755601762-0.8354582126221755j)))))
960
961 def get_array_inputL(self, rank, cplx):
962 z=self.get_python_inputL(rank, cplx)
963 return (numpy.array(z),numpy.array(z))
964
965 # does not have the same range as get_array_inputL but hopefully this will be enough
966 # at the moment it is only used in tagged testing
967 def get_array_inputL2(self, rank, cplx):
968 z=self.get_python_input2(rank, cplx)
969 return (1000*numpy.array(z), 1000*numpy.array(z))
970
971 def get_array_input1(self, rank, cplx):
972 z=self.get_python_input1(rank, cplx)
973 return (numpy.array(z),numpy.array(z))
974
975 def get_array_input2(self, rank, cplx):
976 z=self.get_python_input2(rank, cplx)
977 return (numpy.array(z),numpy.array(z))
978
979 def get_array_input3(self, rank, cplx):
980 z=self.get_python_input3(rank, cplx)
981 return (numpy.array(z),numpy.array(z))
982
983 def get_array_input4(self, rank, cplx):
984 z=self.get_python_input4(rank, cplx)
985 return (numpy.array(z),numpy.array(z))
986
987 def get_const_inputL(self, rank, fs, cplx):
988 z=self.get_python_inputL(rank, cplx)
989 d=Data(z, fs)
990 return (d, numpy.array(z))
991
992 def get_const_input1(self, rank, fs, cplx):
993 z=self.get_python_input1(rank, cplx)
994 d=Data(z, fs)
995 return (d, numpy.array(z))
996
997 def get_const_input2(self, rank, fs, cplx):
998 z=self.get_python_input2(rank, cplx)
999 d=Data(z, fs)
1000 return (d, numpy.array(z))
1001
1002 def get_expanded_inputL(self, rank, fs, cplx):
1003 base=self.get_python_inputL(rank, cplx)
1004 x=fs.getX()[0]
1005 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
1006 r=base*mask+(1-mask)*base
1007 return (r, base)
1008
1009 def get_expanded_inputL2(self, rank, fs, cplx):
1010 base=numpy.array(self.get_python_input1(rank, cplx))*1000
1011 base=base.tolist()
1012 x=fs.getX()[0]
1013 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
1014 r=base*mask+(1-mask)*base
1015 return (r, base)
1016
1017 def get_expanded_input1(self, rank, fs, cplx):
1018 base=self.get_python_input1(rank, cplx)
1019 x=fs.getX()[0]
1020 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
1021 r=base*mask+(1-mask)*base
1022 return (r, base)
1023
1024 def get_tagged_inputL(self, rank, fs, cplx):
1025 z=self.get_python_inputL(rank, cplx)
1026 ref=self.get_array_inputL(rank, cplx)[0]
1027 d=Data(z, fs)
1028 d.tag()
1029 return (d, ref)
1030
1031 def get_tagged_with_tagL1(self, rank, fs, cplx, set_tags=False):
1032 ref=self.get_array_inputL(rank, cplx)[0]
1033 d=Data(ref,fs)
1034 if set_tags:
1035 ref1=self.get_array_input2(rank, cplx)[0]*1000
1036 for t in fs.getListOfTags():
1037 d.setTaggedValue(t, ref1)
1038 ref=ref1
1039 return (d,ref)
1040
1041 def get_tagged_with_tagL2(self, rank, fs, cplx, set_tags=False):
1042 ref=self.get_array_input2(rank, cplx)[0]*1000
1043 d=Data(ref,fs)
1044 if set_tags:
1045 ref1=self.get_array_input3(rank, cplx)[0]*1000
1046 for t in fs.getListOfTags():
1047 d.setTaggedValue(t, ref1)
1048 ref=ref1
1049 return (d,ref)
1050
1051 def get_tagged_input1(self, rank, fs, cplx):
1052 z=self.get_python_input1(rank, cplx)
1053 ref=self.get_array_input1(rank, cplx)[0]
1054 d=Data(z, fs)
1055 d.tag()
1056 return (d, ref)
1057
1058 def execute_ce_params(self, pars):
1059 for v in pars:
1060 a=v[0]
1061 op=v[1]
1062 misccheck=v[2]
1063 ref=v[3]
1064 oraclecheck=v[4]
1065 description=v[5]
1066 res=eval(op)
1067 if misccheck is not None:
1068 miscres=eval(misccheck)
1069 if not miscres:
1070 print("Failed check:"+misccheck)
1071 print(type(a))
1072 print(" vs ")
1073 print(type(res))
1074 print(" values:")
1075 print(a)
1076 print(res)
1077 self.assertTrue(miscres,"Failed check for "+description)
1078 oraclevalue=eval(oraclecheck)
1079 oracleres=Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue)
1080 if not oracleres:
1081 print("Wrong result:"+oraclecheck)
1082 print(type(res))
1083 print(" vs ")
1084 print(type(oraclevalue))
1085 print(" values:")
1086 print(res)
1087 print(" vs ")
1088 print(oraclevalue)
1089 self.assertTrue(oracleres,"wrong result for "+description)
1090
1091 def execute_ce_throws(self, pars):
1092 for v in pars:
1093 a=v[0]
1094 def get_expanded_input1(self, rank, fs, cplx):
1095 base=self.get_python_input1(rank, cplx)
1096 x=fs.getX()[0]
1097 mask=whereNegative(x-0.5) # A trick from Lutz Gross' version of tests
1098 r=base*mask+(1-mask)*base
1099 return (r, base)
1100
1101 def get_tagged_inputL(self, rank, fs, cplx):
1102 z=self.get_python_inputL(rank, cplx)
1103 ref=self.get_array_inputL(rank, cplx)[0]
1104 d=Data(z, fs)
1105 d.tag()
1106 return (d, ref)
1107
1108 def get_tagged_input1(self, rank, fs, cplx):
1109 z=self.get_python_input1(rank, cplx)
1110 ref=self.get_array_input1(rank, cplx)[0]
1111 d=Data(z, fs)
1112 d.tag()
1113 return (d, ref)
1114
1115 def get_array_by_shape(self, s, cplx):
1116 dt=numpy.float64 if not cplx else numpy.complex128
1117 n=numpy.prod(s)
1118 a=numpy.arange(n, dtype=dt).reshape(s)
1119 if cplx:
1120 a-=((1+numpy.arange(n, dtype=dt))*1j).reshape(s)
1121 return a
1122
1123 def make_constant_from_array(self, a, fs):
1124 d=Data(a, fs)
1125 return d
1126
1127 def make_tagged_from_array(self, a, fs):
1128 d=Data(1.5, getShape(a), fs)
1129 if a.dtype.kind=='c':
1130 d.promote()
1131 for n in fs.getListOfTags():
1132 d.setTaggedValue(n, a)
1133 return d
1134
1135 def make_expanded_from_array(self, a, fs):
1136 d=Data(a, fs)
1137 d.expand()
1138 return d
1139
1140 def execute_ce_params(self, pars):
1141 for v in pars:
1142 a=v[0]
1143 op=v[1]
1144 misccheck=v[2]
1145 ref=v[3]
1146 oraclecheck=v[4]
1147 description=v[5]
1148 res=eval(op)
1149 if misccheck is not None:
1150 miscres=eval(misccheck)
1151 if not miscres:
1152 print("Failed check:"+misccheck)
1153 print(type(a))
1154 print(" vs ")
1155 print(type(res))
1156 print(" values:")
1157 print(a)
1158 print(res)
1159 self.assertTrue(miscres,"Failed check for "+description)
1160 if oraclecheck is not None:
1161 oraclevalue=eval(oraclecheck)
1162 if isinstance(res, Data):
1163 res.resolve()
1164 if isinstance(oraclevalue, Data):
1165 oraclevalue.resolve()
1166 oracleres=Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue)
1167 if not oracleres:
1168 print("Wrong result:"+oraclecheck)
1169 print(type(res))
1170 print(" vs ")
1171 print(type(oraclevalue))
1172 print(" values:")
1173 print(res)
1174 print(" vs ")
1175 print(oraclevalue)
1176 self.assertTrue(oracleres,"wrong result for "+description)
1177
1178 def execute_ce_throws(self, pars):
1179 for v in pars:
1180 a=v[0]
1181 op=v[1]
1182 misccheck=v[2]
1183 ref=v[3]
1184 oraclecheck=v[4]
1185 description=v[5]
1186 expected_exceptions=v[6]
1187 if expected_exceptions is None:
1188 expected_exceptions=(TypeError, RuntimeError) # These are used for unsupported complex
1189 with self.assertRaises(Exception) as err:
1190 res=eval(op)
1191 # unfortunately, we don't return a single exception type in this case
1192 self.assertTrue(type(err.exception) in expected_exceptions, "Exception was raised but it was of unexpected type ("+str(type(err.exception))+")")
1193
1194 def execute_t_params(self, pars):
1195 for v in pars:
1196 description=v[0]
1197 a=v[1]
1198 tagcount=1
1199 for step in v[3:]:
1200 a.setTaggedValue(tagcount, step[0])
1201 op=step[1]
1202 misccheck=step[2]
1203 ref=step[3]
1204 oraclecheck=step[4]
1205 res=eval(op)
1206 if misccheck is not None:
1207 self.assertTrue(eval(misccheck), "Check failed for "+description+" checking "+misccheck)
1208 if oraclecheck is not None:
1209 oraclevalue=eval(oraclecheck)
1210 else:
1211 oraclevalue=ref
1212 if oraclevalue is not None:
1213 oracleres=Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue)
1214 if not oracleres:
1215 print(v)
1216 print(" This step ")
1217 print(step)
1218 print("Failed comparison:")
1219 print(res)
1220 print(" vs ")
1221 print(oraclevalue)
1222 print(" a= ")
1223 print(a)
1224 print(" ref== ")
1225 print(ref)
1226 print(" oraclecheck= ")
1227 print(oraclecheck)
1228 self.assertTrue(oracleres,"wrong result for "+description+" for tag "+str(tagcount))
1229 tagcount+=1
1230
1231
1232 def execute_t_throws(self, pars):
1233 for v in pars:
1234 description=v[0]
1235 a=v[1]
1236 tagcount=1
1237 expected_exceptions=v[2]
1238 if expected_exceptions is None:
1239 expected_exceptions=(TypeError, RuntimeError) # These are used for unsupported complex
1240 for step in v[3:]:
1241 a.setTaggedValue(tagcount, step[0])
1242 op=step[1]
1243 misccheck=step[2]
1244 ref=step[3]
1245 oraclecheck=step[4]
1246 with self.assertRaises(Exception) as err:
1247 res=eval(op)
1248 self.assertTrue(type(err.exception) in expected_exceptions, "Exception was raised but it was of unexpected type ("+str(type(err.exception))+")")
1249 tagcount+=1
1250
1251 def generate_operation_test_batch(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans=None, no_scalars=False, minrank=0, maxrank=4,
1252 expect_raise_on_ranks=None, expected_exceptions=None):
1253 """
1254 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
1255 or tested to see if they raise (False)
1256 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
1257 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1258 opname is a string used to describe the operation being tested eg "inf"
1259 update1 and update2 are strings giving code used to update a variable rmerge to
1260 account for tag additions for tagged data.
1261 eg: update1="r2.min()"
1262 update2="min(rmerge, r3.min())"
1263 would result in rmerge=eval(update1) running after the first tag is calculatedand
1264 rmerge=eval(update2) running after the second
1265 """
1266 self.generate_operation_test_batch_driver(supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans, no_scalars, minrank, maxrank,
1267 expect_raise_on_ranks, expected_exceptions, inp_scalar1=self.get_scalar_input1, inp_array1=self.get_array_input1, inp_array2=self.get_array_input2, inp_const1=self.get_const_input1, inp_expanded1=self.get_expanded_input1, inp_tagged1=self.get_tagged_input1)
1268
1269 def generate_operation_test_batch_driver(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans=None, no_scalars=False, minrank=0, maxrank=4,
1270 expect_raise_on_ranks=None, expected_exceptions=None, inp_scalar1=None, inp_array1=None, inp_array2=None, inp_const1=None, inp_expanded1=None, inp_tagged1=None):
1271 """
1272 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
1273 or tested to see if they raise (False)
1274 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
1275 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1276 opname is a string used to describe the operation being tested eg "inf"
1277 update1 and update2 are strings giving code used to update a variable rmerge to
1278 account for tag additions for tagged data.
1279 eg: update1="r2.min()"
1280 update2="min(rmerge, r3.min())"
1281 would result in rmerge=eval(update1) running after the first tag is calculatedand
1282 rmerge=eval(update2) running after the second
1283 """
1284 if input_trans is None:
1285 input_trans=lambda x: x
1286 if expect_raise_on_ranks is None:
1287 expect_raise_on_ranks=()
1288 pars=[]
1289 epars=[] # operations which should throw
1290 if not no_scalars:
1291 (f1,f2)=inp_scalar1(False)
1292 f1=input_trans(f1)
1293 f2=input_trans(f2)
1294 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - scalar", expected_exceptions))
1295 if supportcplx:
1296 (f1,f2)=inp_scalar1(True)
1297 f1=input_trans(f1)
1298 f2=input_trans(f2)
1299 pars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar",expected_exceptions))
1300 else:
1301 (f1,f2)=inp_scalar1(True)
1302 f1=input_trans(f1)
1303 f2=input_trans(f2)
1304 epars.append((f1, opstring, misccheck, numpy.array(f2), oraclecheck, opname+" - complex scalar", expected_exceptions))
1305 for c in (False, True):
1306 if c:
1307 cs="complex "
1308 else:
1309 cs=""
1310 for rank in range(minrank, maxrank+1):
1311 dest=pars
1312 if rank in expect_raise_on_ranks or (c and not supportcplx):
1313 dest=epars
1314 if not no_scalars:
1315 (a, r)=inp_array1(rank, c)
1316 a=input_trans(a)
1317 r=input_trans(r)
1318 p=(a, opstring, misccheck, numpy.array(r), oraclecheck, opname+" - "+cs+"array rank "+str(rank), expected_exceptions)
1319 dest.append(p)
1320 (a, r)=inp_const1(rank, self.functionspace, c)
1321 a=input_trans(a)
1322 r=input_trans(numpy.array(r))
1323 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Constant Data rank "+str(rank), expected_exceptions)
1324 dest.append(p)
1325 (a, r)=inp_expanded1(rank, self.functionspace, c)
1326 a=input_trans(a)
1327 r=input_trans(numpy.array(r))
1328 p=(a, opstring, misccheck, r, oraclecheck, opname+" - "+cs+"Expanded Data rank "+str(rank), expected_exceptions)
1329 dest.append(p)
1330 self.execute_ce_params(pars)
1331 self.execute_ce_throws(epars)
1332 del pars
1333 del epars
1334 tpars=[] # tagged versions
1335 epars=[]
1336 for c in (False, True):
1337 if c:
1338 cs="complex "
1339 else:
1340 cs=""
1341 for rank in range(minrank, maxrank+1):
1342 dest=tpars
1343 if rank in expect_raise_on_ranks or (c and not supportcplx):
1344 dest=epars
1345 test=[opname+" - "+cs+"tagged rank "+str(rank),]
1346 (a, r)=inp_tagged1(rank, self.functionspace, c)
1347 a=input_trans(a)
1348 r=input_trans(numpy.array(r))
1349 test.append(a)
1350 test.append(expected_exceptions)
1351 # arguments are new tagged value, operation, extra check, reference_value, reference_check
1352 (t2, r2)=inp_array2(rank, c)
1353 t2=input_trans(t2)
1354 r2=input_trans(numpy.array(r2))
1355 if update1 is not None:
1356 rmerge=eval(update1)
1357 else:
1358 rmerge=None
1359 test.append((t2, opstring, misccheck, rmerge, None,))
1360 dest.append(test)
1361 self.execute_t_params(tpars)
1362 self.execute_t_throws(epars)
1363
1364
1365 def generate_operation_test_batch(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans=None, no_scalars=False, minrank=0, maxrank=4,
1366 expect_raise_on_ranks=None, expected_exceptions=None):
1367 """
1368 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
1369 or tested to see if they raise (False)
1370 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
1371 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1372 opname is a string used to describe the operation being tested eg "inf"
1373 update1 and update2 are strings giving code used to update a variable rmerge to
1374 account for tag additions for tagged data.
1375 eg: update1="r2.min()"
1376 update2="min(rmerge, r3.min())"
1377 would result in rmerge=eval(update1) running after the first tag is calculatedand
1378 rmerge=eval(update2) running after the second
1379 """
1380 self.generate_operation_test_batch_driver(supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans=input_trans, no_scalars=no_scalars, minrank=minrank, maxrank=maxrank,
1381 expect_raise_on_ranks=expect_raise_on_ranks, expected_exceptions=expected_exceptions, inp_scalar1=self.get_scalar_input1, inp_array1=self.get_array_input1, inp_array2=self.get_array_input2, inp_const1=self.get_const_input1, inp_expanded1=self.get_expanded_input1, inp_tagged1=self.get_tagged_input1)
1382
1383
1384 def generate_operation_test_batch_large(self, supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans=None, no_scalars=False, minrank=0, maxrank=4, expect_raise_on_ranks=None, expected_exceptions=None):
1385 """
1386 Uses the same logic as generate_operation_test_batch but uses larger values.
1387 supportcplx is a boolean indicating whether complex operations should be checked for values (True)
1388 or tested to see if they raise (False)
1389 opstring is a string of the operation to be performed (in terms of argument a) eg "Lsup(a)"
1390 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1391 opname is a string used to describe the operation being tested eg "inf"
1392 update1 and update2 are strings giving code used to update a variable rmerge to
1393 account for tag additions for tagged data.
1394 eg: update1="r2.min()"
1395 update2="min(rmerge, r3.min())"
1396 would result in rmerge=eval(update1) running after the first tag is calculatedand
1397 rmerge=eval(update2) running after the second
1398 """
1399 self.generate_operation_test_batch_driver(supportcplx, opstring, misccheck, oraclecheck, opname, update1, input_trans, no_scalars, minrank, maxrank,
1400 expect_raise_on_ranks, expected_exceptions, inp_scalar1=self.get_scalar_inputL, inp_array1=self.get_array_inputL, inp_array2=self.get_array_inputL2, inp_const1=self.get_const_inputL, inp_expanded1=self.get_expanded_inputL, inp_tagged1=self.get_tagged_inputL)
1401
1402 def execute_binary_params(self, pars):
1403 for v in pars:
1404 a=v[0]
1405 b=v[1]
1406 op=v[2]
1407 misccheck=v[3]
1408 refa=v[4]
1409 refb=v[5]
1410 oraclecheck=v[6]
1411 description=v[7]
1412 res=eval(op)
1413 if misccheck is not None:
1414 miscres=eval(misccheck)
1415 if not miscres:
1416 print("Failed check:"+misccheck)
1417 print(type(a))
1418 print(" , ")
1419 print(type(b))
1420 print(" vs ")
1421 print(type(res))
1422 print(" values:")
1423 print(a)
1424 print(" , ")
1425 print(b)
1426 print(res)
1427 self.assertTrue(miscres,"Failed check for "+description)
1428 oraclevalue=eval(oraclecheck)
1429 oracleres=Lsup(res-oraclevalue)<=self.RES_TOL*Lsup(oraclevalue)
1430 if not oracleres:
1431 print("Wrong result:"+oraclecheck)
1432 print(" refa=")
1433 print(str(refa))
1434 print(" refb=")
1435 print(str(refb))
1436 print(" res=")
1437 print(type(res))
1438 print(" vs oraclevalue=")
1439 print(type(oraclevalue))
1440 print(" values:")
1441 print(res)
1442 print(" vs ")
1443 print(oraclevalue)
1444 self.assertTrue(oracleres,"wrong result for "+description)
1445
1446 def generate_binary_matrixlike_operation_test_batch_large(self, opstring, misccheck, oraclecheck, opname, input_trans=None, minrank=0, maxrank=4, aranks=(2,)):
1447 """
1448 Generates a set of tests for binary operations.
1449 It is similar to the unary versions but with some unneeded options removed.
1450 For example, all operations in this type should accept complex arguments.
1451 opstring is a string of the operation to be performed (in terms of arguments a and b) eg "inner(a,b)"
1452 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1453 opname is a string used to describe the operation being tested eg "inner"
1454 update1 is a string giving code used to update a variable rmerge to
1455 account for tag additions for tagged data.
1456 eg: update1="r2.min()"
1457 would result in rmerge=eval(update1) running after the first tag is calculated
1458 """
1459 if input_trans is None:
1460 input_trans=lambda x: x
1461 pars=[]
1462 for ac in (False, True): # complex or real arguments
1463 for bc in (False, True):
1464 astr="real" if ac else "complex"
1465 bstr="real" if bc else "complex"
1466 aargset=[]
1467 bargset=[]
1468 arange=aranks
1469 for atype in "ACTE": # Array/Constant/Tagged/Expanded
1470 if atype=='A':
1471 for r in arange:
1472 aargset.append((self.get_array_input1(r,ac),astr+' array rank '+str(r), r))
1473 elif atype=='C':
1474 for r in arange:
1475 aargset.append((self.get_const_input1(r, self.functionspace, ac), astr+' Constant rank '+str(r), r))
1476 elif atype=='T':
1477 for r in arange:
1478 aargset.append((self.get_tagged_with_tagL1(r, self.functionspace, ac, set_tags=False),astr+' Tagged rank '+str(r), r))
1479 elif atype=='E':
1480 for r in arange:
1481 aargset.append((self.get_expanded_inputL(r,self.functionspace, ac),astr+' Expanded rank '+str(r), r))
1482 # Now we have a set of a args, match them with possible b's
1483 for v in aargset:
1484 arg=v[0][0]
1485 argref=v[0][1]
1486 adescr=v[1]
1487 rank=v[2]
1488 if rank==2:
1489 brange=(1,2)
1490 elif rank==4:
1491 brange=(2,3,4)
1492 for br in brange:
1493 tshape=(rank,)*br
1494 bargref=self.get_array_by_shape(tshape, bc)
1495 # now convert it to each possbile input type
1496 barg=self.make_constant_from_array(bargref, self.functionspace)
1497 bdescr=bstr+' Constant rank '+str(br)
1498 p=(arg, barg, opstring, misccheck,
1499 numpy.array(argref), numpy.array(bargref),
1500 oraclecheck, opname+' '+adescr+'/'+bdescr)
1501 pars.append(p)
1502 barg=self.make_tagged_from_array(bargref, self.functionspace)
1503 bdescr=bstr+' Tagged rank '+str(br)
1504 p=(arg, barg, opstring, misccheck,
1505 numpy.array(argref), numpy.array(bargref),
1506 oraclecheck, opname+' '+adescr+'/'+bdescr)
1507 pars.append(p)
1508 barg=self.make_expanded_from_array(bargref, self.functionspace)
1509 bdescr=bstr+' Expanded rank '+str(br)
1510 p=(arg, barg, opstring, misccheck,
1511 numpy.array(argref), numpy.array(bargref),
1512 oraclecheck, opname+' '+adescr+'/'+bdescr)
1513 pars.append(p)
1514 self.execute_binary_params(pars)
1515
1516 def generate_binary_operation_test_batch_large(self, opstring, misccheck, oraclecheck, opname, input_trans=None, minrank=0, maxrank=4, no_shape_mismatch=False, permit_scalar_mismatch=True, cap_combined_rank=False, fix_rank_a=None, fix_rank_b=None, support_cplx=True):
1517 """
1518 Generates a set of tests for binary operations.
1519 It is similar to the unary versions but with some unneeded options removed.
1520 opstring is a string of the operation to be performed (in terms of arguments a and b) eg "inner(a,b)"
1521 misccheck is a string giving a check to be run after the operation eg "isinstance(res,float)"
1522 opname is a string used to describe the operation being tested eg "inner"
1523 update1 is a string giving code used to update a variable rmerge to
1524 account for tag additions for tagged data.
1525 eg: update1="r2.min()"
1526 would result in rmerge=eval(update1) running after the first tag is calculated
1527 """
1528 if input_trans is None:
1529 input_trans=lambda x: x
1530 pars=[]
1531 if support_cplx:
1532 complexity=(False, True)
1533 else:
1534 complexity=(False,)
1535 for ac in complexity: # complex or real arguments
1536 for bc in complexity:
1537 astr="real" if ac else "complex"
1538 bstr="real" if bc else "complex"
1539 aargset=[]
1540 bargset=[]
1541 if fix_rank_a is not None:
1542 arange=fix_rank_a
1543 else:
1544 arange=range(minrank, maxrank+1)
1545 if fix_rank_b is not None:
1546 brange=fix_rank_b
1547 else:
1548 brange=range(minrank, maxrank+1)
1549 for atype in "SACTE": # Scalar/Array/Constant/Tagged/Expanded
1550 if atype=='S':
1551 aargset.append((self.get_scalar_input1(ac),astr+' scalar'))
1552 elif atype=='A':
1553 for r in arange:
1554 aargset.append((self.get_array_input1(r,ac),astr+' array rank '+str(r)))
1555 elif atype=='C':
1556 for r in arange:
1557 aargset.append((self.get_const_input1(r, self.functionspace, ac), astr+' Constant rank '+str(r)))
1558 elif atype=='T':
1559 for r in arange:
1560 aargset.append((self.get_tagged_with_tagL1(r, self.functionspace, ac, set_tags=False),astr+' Tagged rank '+str(r)))
1561 elif atype=='E':
1562 for r in arange:
1563 aargset.append((self.get_expanded_inputL(r,self.functionspace, ac),astr+' Expanded rank '+str(r)))
1564 for atype in "SACTE": # Scalar/Array/Constant/Tagged/Expanded
1565 if atype=='S':
1566 bargset.append((self.get_scalar_input2(ac),bstr+' scalar'))
1567 elif atype=='A':
1568 for r in brange:
1569 bargset.append((self.get_array_input2(r,ac),bstr+' array rank '+str(r)))
1570 elif atype=='C':
1571 for r in brange:
1572 bargset.append((self.get_const_input2(r, self.functionspace, ac),bstr+' Constant rank '+str(r)))
1573 elif atype=='T':
1574 for r in brange:
1575 bargset.append((self.get_tagged_with_tagL2(r, self.functionspace, ac, set_tags=True), bstr+' Tagged rank '+str(r)))
1576 elif atype=='E':
1577 for r in brange:
1578 bargset.append((self.get_expanded_inputL2(r, self.functionspace, ac),bstr+' Expanded rank '+str(r)))
1579 # now we have a complete set of possible args
1580 for aarg in aargset:
1581 for barg in bargset:
1582 if cap_combined_rank and getRank(aarg[0][0])+getRank(barg[0][0])>4:
1583 continue #resulting object too big
1584 if no_shape_mismatch:
1585 sa=getShape(aarg[0][0])
1586 sb=getShape(barg[0][0])
1587 if sa!=sb:
1588 if not permit_scalar_mismatch or (sa!=() and sb!=()):
1589 continue
1590 p=(aarg[0][0], barg[0][0], opstring, misccheck,
1591 numpy.array(aarg[0][1]), numpy.array(barg[0][1]),
1592 oraclecheck, opname+' '+aarg[1]+'/'+barg[1])
1593 pars.append(p)
1594 self.execute_binary_params(pars)
1595
1596 class Test_util_base(Test_util_values):
1597 """
1598 basic tests on util.py
1599 """
1600 #=========================================================
1601 # File writer
1602 #=========================================================
1603 def setup(self):
1604 self.workdir=ESCRIPT_WORKDIR
1605
1606 def __checkContent(self,fn,ref_cont):
1607 cont=open(fn,'r').readlines()
1608 self.assertTrue(len(cont)==len(ref_cont),"wrong number of records")
1609 for i in range(len(cont)):
1610 self.assertTrue(cont[i].strip()==ref_cont[i],"wrong records %s"%i)
1611 def test_FileWriter_W(self):
1612 fn=os.path.join(self.workdir, "filewriter_w.txt")
1613 self.assertRaises(IOError,FileWriter,fn="",append=False)
1614 f=FileWriter(fn,append=False)
1615 self.assertTrue(f.name==fn, "wrong file name.")
1616 self.assertTrue(f.mode=='w', "wrong mode")
1617 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1618 self.assertTrue(not f.closed,"file shuold not be closed.")
1619 f.write("line1"+f.newlines)
1620 f.flush()
1621 self.__checkContent(fn,["line1"])
1622 f.writelines(["line2"+f.newlines, "line3"+f.newlines])
1623 f.close()
1624 self.assertTrue(f.closed,"file shuold be closed.")
1625 self.__checkContent(fn,["line1", "line2", "line3"])
1626 MPIBarrierWorld()
1627 if getMPIRankWorld()==0: os.unlink(fn)
1628
1629 def test_FileWriter_A(self):
1630 fn=os.path.join(self.workdir, "filewriter_a.txt")
1631 if getMPIRankWorld()==0: open(fn,'w').write("line1"+os.linesep)
1632 self.assertRaises(IOError,FileWriter,fn="",append=True)
1633 f=FileWriter(fn,append=True)
1634 self.assertTrue(f.name==fn, "wrong file name.")
1635 self.assertTrue(f.mode=='a', "wrong mode")
1636 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1637 self.assertTrue(not f.closed,"file shuold not be closed.")
1638 f.write("line2"+f.newlines)
1639 f.flush()
1640 self.__checkContent(fn,["line1", "line2"])
1641 f.writelines(["line3"+f.newlines, "line4"+f.newlines])
1642 f.close()
1643 self.assertTrue(f.closed,"file shuold be closed.")
1644 self.__checkContent(fn,["line1", "line2", "line3", "line4"])
1645 MPIBarrierWorld()
1646 if getMPIRankWorld()==0: os.unlink(fn)
1647
1648 def test_FileWriter_A_loc(self):
1649 fn=os.path.join(self.workdir, "filewriter_a_loc.txt")
1650 if getMPIRankWorld()>0:
1651 fn2=fn+".%s"%getMPIRankWorld()
1652 else:
1653 fn2=fn
1654 open(fn2,'w').write("line1"+os.linesep)
1655 self.assertRaises(IOError,FileWriter,fn="",append=True, createLocalFiles=True)
1656 f=FileWriter(fn,append=True,createLocalFiles=True)
1657 self.assertTrue(f.name==fn, "wrong file name.")
1658 self.assertTrue(f.mode=='a', "wrong mode")
1659 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1660 self.assertTrue(not f.closed,"file shuold not be closed.")
1661 f.write("line2"+f.newlines)
1662 f.flush()
1663 self.__checkContent(fn2,["line1", "line2"])
1664 f.writelines(["line3"+f.newlines, "line4"+f.newlines])
1665 f.close()
1666 self.assertTrue(f.closed,"file shuold be closed.")
1667 self.__checkContent(fn2,["line1", "line2", "line3", "line4"])
1668 os.unlink(fn2)
1669
1670 def test_FileWriter_W_loc(self):
1671 fn=os.path.join(self.workdir, "filewriter_w_loc.txt")
1672 if getMPIRankWorld()>0:
1673 fn2=fn+".%s"%getMPIRankWorld()
1674 else:
1675 fn2=fn
1676 self.assertRaises(IOError,FileWriter,fn="",append=True, createLocalFiles=True)
1677 f=FileWriter(fn,append=False,createLocalFiles=True)
1678 self.assertTrue(f.name==fn, "wrong file name.")
1679 self.assertTrue(f.mode=='w', "wrong mode")
1680 self.assertTrue(f.newlines==os.linesep, "wrong line seps")
1681 self.assertTrue(not f.closed,"file shuold not be closed.")
1682 f.write("line1"+f.newlines)
1683 f.flush()
1684 self.__checkContent(fn2,["line1"])
1685 f.writelines(["line2"+f.newlines, "line3"+f.newlines])
1686 f.close()
1687 self.assertTrue(f.closed,"file shuold be closed.")
1688 self.__checkContent(fn2,["line1", "line2", "line3"])
1689 os.unlink(fn2)
1690
1691 #=========================================================
1692 # constants
1693 #=========================================================
1694 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1695 def test_kronecker_1(self):
1696 val=kronecker(d=1)
1697 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1698 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1699 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1700 def test_kronecker_2(self):
1701 val=kronecker(d=2)
1702 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1703 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1704 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1705 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1706 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1707 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1708 def test_kronecker_3(self):
1709 val=kronecker(d=3)
1710 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1711 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1712 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1713 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1714 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1715 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1716 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1717 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1718 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1719 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1720 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1721 def test_kronecker_domain(self):
1722 val=kronecker(d=self.domain)
1723 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1724 self.assertEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
1725 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1726 def test_kronecker_functionspace(self):
1727 val=kronecker(d=self.functionspace)
1728 self.assertTrue(isinstance(val,escript.Data),"wrong type of result.")
1729 self.assertEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
1730 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1731 def test_identityTensor_1(self):
1732 val=identityTensor(d=1)
1733 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1734 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1735 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1736 def test_identityTensor_2(self):
1737 val=identityTensor(d=2)
1738 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1739 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1740 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1741 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1742 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1743 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1744 def test_identityTensor_3(self):
1745 val=identityTensor(d=3)
1746 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1747 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1748 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1749 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1750 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1751 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1752 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1753 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1754 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1755 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1756 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1757 def test_identityTensor_domain(self):
1758 val=identityTensor(d=self.domain)
1759 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1760 self.assertEqual(val.shape,(self.domain.getDim(),self.domain.getDim()),"wrong shape.")
1761 if self.domain.getDim()==2:
1762 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1763 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1764 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1765 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1766 if self.domain.getDim()==3:
1767 self.assertEqual(val[0,0],1.0,"wrong value for (0,0)")
1768 self.assertEqual(val[0,1],0.0,"wrong value for (0,1)")
1769 self.assertEqual(val[0,2],0.0,"wrong value for (0,2)")
1770 self.assertEqual(val[1,0],0.0,"wrong value for (1,0)")
1771 self.assertEqual(val[1,1],1.0,"wrong value for (1,1)")
1772 self.assertEqual(val[1,2],0.0,"wrong value for (1,2)")
1773 self.assertEqual(val[2,0],0.0,"wrong value for (2,0)")
1774 self.assertEqual(val[2,1],0.0,"wrong value for (2,1)")
1775 self.assertEqual(val[2,2],1.0,"wrong value for (2,2)")
1776 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1777 def test_identityTensor_functionspace(self):
1778 val=identityTensor(d=self.functionspace)
1779 self.assertTrue(isinstance(val,escript.Data),"wrong type of result.")
1780 self.assertEqual(val.getShape(),(self.functionspace.getDim(),self.functionspace.getDim()),"wrong shape.")
1781 if self.domain.getDim()==2:
1782 self.assertTrue(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
1783 self.assertTrue(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
1784 self.assertTrue(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
1785 self.assertTrue(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
1786 if self.domain.getDim()==3:
1787 self.assertTrue(Lsup(val[0,0]-1.0)<=self.RES_TOL,"wrong value for (0,0)")
1788 self.assertTrue(Lsup(val[0,1]-0.0)<=self.RES_TOL,"wrong value for (0,1)")
1789 self.assertTrue(Lsup(val[0,2]-0.0)<=self.RES_TOL,"wrong value for (0,2)")
1790 self.assertTrue(Lsup(val[1,0]-0.0)<=self.RES_TOL,"wrong value for (1,0)")
1791 self.assertTrue(Lsup(val[1,1]-1.0)<=self.RES_TOL,"wrong value for (1,1)")
1792 self.assertTrue(Lsup(val[1,2]-0.0)<=self.RES_TOL,"wrong value for (1,2)")
1793 self.assertTrue(Lsup(val[2,0]-0.0)<=self.RES_TOL,"wrong value for (2,0)")
1794 self.assertTrue(Lsup(val[2,1]-0.0)<=self.RES_TOL,"wrong value for (2,1)")
1795 self.assertTrue(Lsup(val[2,2]-1.0)<=self.RES_TOL,"wrong value for (2,2)")
1796 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1797 def test_identityTensor4_1(self):
1798 val=identityTensor4(d=1)
1799 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1800 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1801 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1802 def test_identityTensor4_2(self):
1803 val=identityTensor4(d=2)
1804 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1805 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1806 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1807 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1808 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1809 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1810 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1811 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1812 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1813 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1814 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1815 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1816 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1817 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1818 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")
1819 self.assertEqual(val[1,1,1,0],0.0,"wrong value for (1,1,1,0)")
1820 self.assertEqual(val[1,1,1,1],1.0,"wrong value for (1,1,1,1)")
1821 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1822 def test_identityTensor4_3(self):
1823 val=identityTensor4(d=3)
1824 self.assertTrue(isinstance(val,numpy.ndarray),"wrong type of result.")
1825 self.assertEqual(val[0,0,0,0],1.0,"wrong value for (0,0,0,0)")
1826 self.assertEqual(val[0,0,0,1],0.0,"wrong value for (0,0,0,1)")
1827 self.assertEqual(val[0,0,0,2],0.0,"wrong value for (0,0,0,2)")
1828 self.assertEqual(val[0,0,1,0],0.0,"wrong value for (0,0,1,0)")
1829 self.assertEqual(val[0,0,1,1],0.0,"wrong value for (0,0,1,1)")
1830 self.assertEqual(val[0,0,1,2],0.0,"wrong value for (0,0,1,2)")
1831 self.assertEqual(val[0,0,2,0],0.0,"wrong value for (0,0,2,0)")
1832 self.assertEqual(val[0,0,2,1],0.0,"wrong value for (0,0,2,1)")
1833 self.assertEqual(val[0,0,2,2],0.0,"wrong value for (0,0,2,2)")
1834 self.assertEqual(val[0,1,0,0],0.0,"wrong value for (0,1,0,0)")
1835 self.assertEqual(val[0,1,0,1],1.0,"wrong value for (0,1,0,1)")
1836 self.assertEqual(val[0,1,0,2],0.0,"wrong value for (0,1,0,2)")
1837 self.assertEqual(val[0,1,1,0],0.0,"wrong value for (0,1,1,0)")
1838 self.assertEqual(val[0,1,1,1],0.0,"wrong value for (0,1,1,1)")
1839 self.assertEqual(val[0,1,1,2],0.0,"wrong value for (0,1,1,2)")
1840 self.assertEqual(val[0,1,2,0],0.0,"wrong value for (0,1,2,0)")
1841 self.assertEqual(val[0,1,2,1],0.0,"wrong value for (0,1,2,1)")
1842 self.assertEqual(val[0,1,2,2],0.0,"wrong value for (0,1,2,2)")
1843 self.assertEqual(val[0,2,0,0],0.0,"wrong value for (0,2,0,0)")
1844 self.assertEqual(val[0,2,0,1],0.0,"wrong value for (0,2,0,1)")
1845 self.assertEqual(val[0,2,0,2],1.0,"wrong value for (0,2,0,2)")
1846 self.assertEqual(val[0,2,1,0],0.0,"wrong value for (0,2,1,0)")
1847 self.assertEqual(val[0,2,1,1],0.0,"wrong value for (0,2,1,1)")
1848 self.assertEqual(val[0,2,1,2],0.0,"wrong value for (0,2,1,2)")
1849 self.assertEqual(val[0,2,2,0],0.0,"wrong value for (0,2,2,0)")
1850 self.assertEqual(val[0,2,2,1],0.0,"wrong value for (0,2,2,1)")
1851 self.assertEqual(val[0,2,2,2],0.0,"wrong value for (0,2,2,2)")
1852 self.assertEqual(val[1,0,0,0],0.0,"wrong value for (1,0,0,0)")
1853 self.assertEqual(val[1,0,0,1],0.0,"wrong value for (1,0,0,1)")
1854 self.assertEqual(val[1,0,0,2],0.0,"wrong value for (1,0,0,2)")
1855 self.assertEqual(val[1,0,1,0],1.0,"wrong value for (1,0,1,0)")
1856 self.assertEqual(val[1,0,1,1],0.0,"wrong value for (1,0,1,1)")
1857 self.assertEqual(val[1,0,1,2],0.0,"wrong value for (1,0,1,2)")
1858 self.assertEqual(val[1,0,2,0],0.0,"wrong value for (1,0,2,0)")
1859 self.assertEqual(val[1,0,2,1],0.0,"wrong value for (1,0,2,1)")
1860 self.assertEqual(val[1,0,2,2],0.0,"wrong value for (1,0,2,2)")
1861 self.assertEqual(val[1,1,0,0],0.0,"wrong value for (1,1,0,0)")
1862 self.assertEqual(val[1,1,0,1],0.0,"wrong value for (1,1,0,1)")