@@ -48,7 +48,7 @@ class TestInitFromVector(unittest.TestCase):
4848 def runTest (self ):
4949 n = 5
5050 nvals = n * (n + 1 )// 2
51- x = np .arange (nvals , dtype = np . float )
51+ x = np .arange (nvals , dtype = float )
5252 hess = Hessian (n , vals = x )
5353 self .assertEqual (hess .shape (), (nvals ,), 'Wrong shape for initialisation' )
5454 self .assertEqual (hess .dim (), n , 'Wrong dimension' )
@@ -60,7 +60,7 @@ class TestInitFromMatrix(unittest.TestCase):
6060 def runTest (self ):
6161 n = 3
6262 nvals = n * (n + 1 )// 2
63- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n ,n ))
63+ A = np .arange (n ** 2 , dtype = float ).reshape ((n ,n ))
6464 hess = Hessian (n , vals = A + A .T ) # force symmetric
6565 self .assertEqual (hess .shape (), (nvals ,), 'Wrong shape for initialisation' )
6666 self .assertEqual (hess .dim (), n , 'Wrong dimension' )
@@ -72,7 +72,7 @@ def runTest(self):
7272class TestToFull (unittest .TestCase ):
7373 def runTest (self ):
7474 n = 7
75- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
75+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
7676 H = A + A .T # force symmetric
7777 hess = Hessian (n , vals = H )
7878 self .assertTrue (np .all (hess .as_full () == H ), 'Wrong values' )
@@ -81,7 +81,7 @@ def runTest(self):
8181class TestGetElementGood (unittest .TestCase ):
8282 def runTest (self ):
8383 n = 3
84- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
84+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
8585 H = A + A .T # force symmetric
8686 hess = Hessian (n , vals = H )
8787 for i in range (n ):
@@ -93,7 +93,7 @@ def runTest(self):
9393class TestGetElementBad (unittest .TestCase ):
9494 def runTest (self ):
9595 n = 4
96- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
96+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
9797 H = A + A .T # force symmetric
9898 hess = Hessian (n , vals = H )
9999 # When testing for assertion errors, need lambda to stop assertion from actually happening
@@ -114,7 +114,7 @@ def runTest(self):
114114class TestSetElementGood (unittest .TestCase ):
115115 def runTest (self ):
116116 n = 3
117- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
117+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
118118 H = A + A .T # force symmetric
119119 hess = Hessian (n , vals = H )
120120 H2 = np .sin (H )
@@ -130,7 +130,7 @@ def runTest(self):
130130class TestSetElementBad (unittest .TestCase ):
131131 def runTest (self ):
132132 n = 5
133- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
133+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
134134 H = A + A .T # force symmetric
135135 hess = Hessian (n , vals = H )
136136 # When testing for assertion errors, need lambda to stop assertion from actually happening
@@ -151,32 +151,32 @@ def runTest(self):
151151class TestMultGood (unittest .TestCase ):
152152 def runTest (self ):
153153 n = 5
154- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
154+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
155155 H = np .sin (A + A .T ) # force symmetric
156156 hess = Hessian (n , vals = H )
157- vec = np .exp (np .arange (n , dtype = np . float ))
157+ vec = np .exp (np .arange (n , dtype = float ))
158158 hs = np .dot (H , vec )
159159 self .assertTrue (array_compare (hess * vec , hs , thresh = 1e-12 ), 'Wrong values' )
160160
161161
162162class TestMultBad (unittest .TestCase ):
163163 def runTest (self ):
164164 n = 5
165- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
165+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
166166 H = A + A .T # force symmetric
167167 hess = Hessian (n , vals = H )
168168 # When testing for assertion errors, need lambda to stop assertion from actually happening
169169 self .assertRaises (AssertionError , lambda : hess * 1.0 )
170170 self .assertRaises (AssertionError , lambda : hess * None )
171171 self .assertRaises (AssertionError , lambda : hess * [float (i ) for i in range (n )])
172- self .assertRaises (AssertionError , lambda : hess * np .arange (n - 1 , dtype = np . float ))
173- self .assertRaises (AssertionError , lambda : hess * np .arange (n + 1 , dtype = np . float ))
172+ self .assertRaises (AssertionError , lambda : hess * np .arange (n - 1 , dtype = float ))
173+ self .assertRaises (AssertionError , lambda : hess * np .arange (n + 1 , dtype = float ))
174174
175175
176176class TestNeg (unittest .TestCase ):
177177 def runTest (self ):
178178 n = 5
179- A = np .arange (n ** 2 , dtype = np . float ).reshape ((n , n ))
179+ A = np .arange (n ** 2 , dtype = float ).reshape ((n , n ))
180180 H = A + A .T # force symmetric
181181 hess = Hessian (n , vals = H )
182182 neghess = - hess
0 commit comments