@@ -6837,7 +6837,7 @@ class TestDot:
6837
6837
N = 7
6838
6838
6839
6839
def _create_data (self ):
6840
- rng = np .random .default_rng (128 )
6840
+ rng = np .random .RandomState (128 )
6841
6841
A = rng .random ((4 , 2 ))
6842
6842
b1 = rng .random ((2 , 1 ))
6843
6843
b2 = rng .random (2 )
@@ -6848,52 +6848,51 @@ def _create_data(self):
6848
6848
def test_dotmatmat (self ):
6849
6849
A , _ , _ , _ , _ = self ._create_data ()
6850
6850
res = np .dot (A .transpose (), A )
6851
- tgt = np .array ([[1.47632191 , 1.30902162 ],
6852
- [1.30902162 , 1.44047178 ]])
6851
+ tgt = np .array ([[1.45046013 , 0.86323640 ],
6852
+ [0.86323640 , 0.84934569 ]])
6853
6853
assert_almost_equal (res , tgt , decimal = self .N )
6854
6854
6855
6855
def test_dotmatvec (self ):
6856
6856
A , b1 , _ , _ , _ = self ._create_data ()
6857
6857
res = np .dot (A , b1 )
6858
- tgt = np .array ([[0.53147439 ], [0.3881244 ],
6859
- [0.28278056 ], [0.81799083 ]])
6858
+ tgt = np .array ([[0.32114320 ], [0.04889721 ],
6859
+ [0.15696029 ], [0.33612621 ]])
6860
6860
assert_almost_equal (res , tgt , decimal = self .N )
6861
6861
6862
6862
def test_dotmatvec2 (self ):
6863
6863
A , _ , b2 , _ , _ = self ._create_data ()
6864
6864
res = np .dot (A , b2 )
6865
- tgt = np .array ([0.73687498 , 0.51701463 , 0.27242132 , 1.09264356 ])
6865
+ tgt = np .array ([0.29677940 , 0.04518649 , 0.14468333 , 0.31039293 ])
6866
6866
assert_almost_equal (res , tgt , decimal = self .N )
6867
6867
6868
6868
def test_dotvecmat (self ):
6869
6869
A , _ , _ , _ , b4 = self ._create_data ()
6870
6870
res = np .dot (b4 , A )
6871
- tgt = np .array ([0.30087302 , 0.76540662 ])
6871
+ tgt = np .array ([1.23495091 , 1.12222648 ])
6872
6872
assert_almost_equal (res , tgt , decimal = self .N )
6873
6873
6874
6874
def test_dotvecmat2 (self ):
6875
6875
A , _ , _ , b3 , _ = self ._create_data ()
6876
6876
res = np .dot (b3 , A .transpose ())
6877
- tgt = np .array ([[0.87004937 , 0.63750863 , 0.47499902 , 1.3432763 ]])
6877
+ tgt = np .array ([[0.58793804 , 0.08957460 , 0.30605758 , 0.62716383 ]])
6878
6878
assert_almost_equal (res , tgt , decimal = self .N )
6879
6879
6880
6880
def test_dotvecmat3 (self ):
6881
6881
A , _ , _ , _ , b4 = self ._create_data ()
6882
6882
res = np .dot (A .transpose (), b4 )
6883
- tgt = np .array ([0.30087302 , 0.76540662 ])
6883
+ tgt = np .array ([1.23495091 , 1.12222648 ])
6884
6884
assert_almost_equal (res , tgt , decimal = self .N )
6885
6885
6886
6886
def test_dotvecvecouter (self ):
6887
6887
_ , b1 , _ , b3 , _ = self ._create_data ()
6888
6888
res = np .dot (b1 , b3 )
6889
- tgt = np .array ([[0.41852888 , 0.35668856 ],
6890
- [0.33830126 , 0.28831508 ]])
6889
+ tgt = np .array ([[0.20128610 , 0.08400440 ], [0.07190947 , 0.03001058 ]])
6891
6890
assert_almost_equal (res , tgt , decimal = self .N )
6892
6891
6893
6892
def test_dotvecvecinner (self ):
6894
6893
_ , b1 , _ , b3 , _ = self ._create_data ()
6895
6894
res = np .dot (b3 , b1 )
6896
- tgt = np .array ([[0.70684396 ]])
6895
+ tgt = np .array ([[0.23129668 ]])
6897
6896
assert_almost_equal (res , tgt , decimal = self .N )
6898
6897
6899
6898
def test_dotcolumnvect1 (self ):
@@ -6911,19 +6910,19 @@ def test_dotcolumnvect2(self):
6911
6910
assert_almost_equal (res , tgt , decimal = self .N )
6912
6911
6913
6912
def test_dotvecscalar (self ):
6914
- rng = np .random .default_rng (100 )
6913
+ rng = np .random .RandomState (100 )
6915
6914
b1 = rng .random ((1 , 1 ))
6916
6915
b2 = rng .random ((1 , 4 ))
6917
6916
res = np .dot (b1 , b2 )
6918
- tgt = np .array ([[0.49811165 , 0.2411955 , 0.03586377 , 0.81298353 ]])
6917
+ tgt = np .array ([[0.15126730 , 0.23068496 , 0.45905553 , 0.00256425 ]])
6919
6918
assert_almost_equal (res , tgt , decimal = self .N )
6920
6919
6921
6920
def test_dotvecscalar2 (self ):
6922
- rng = np .random .default_rng (100 )
6921
+ rng = np .random .RandomState (100 )
6923
6922
b1 = rng .random ((4 , 1 ))
6924
6923
b2 = rng .random ((1 , 1 ))
6925
6924
res = np .dot (b1 , b2 )
6926
- tgt = np .array ([[0.81298353 ], [0.58083745 ], [0.28125296 ], [0.04181999 ]])
6925
+ tgt = np .array ([[0.00256425 ], [0.00131359 ], [0.00200324 ], [0.00398638 ]])
6927
6926
assert_almost_equal (res , tgt , decimal = self .N )
6928
6927
6929
6928
def test_all (self ):
0 commit comments