@@ -175,14 +175,15 @@ def test_cholesky(self, array, dtype):
175
175
)
176
176
@pytest .mark .parametrize ("dtype" , get_all_dtypes (no_bool = True ))
177
177
def test_cholesky_upper (self , array , dtype ):
178
- ia = dpnp .array (array , dtype = dtype )
178
+ a = numpy .array (array , dtype = dtype )
179
+ ia = dpnp .array (a )
179
180
result = dpnp .linalg .cholesky (ia , upper = True )
180
181
181
- if ia .ndim > 2 :
182
+ if a .ndim > 2 :
182
183
n = ia .shape [- 1 ]
183
- ia_reshaped = ia .reshape (- 1 , n , n )
184
+ a_reshaped = a .reshape (- 1 , n , n )
184
185
res_reshaped = result .reshape (- 1 , n , n )
185
- batch_size = ia_reshaped .shape [0 ]
186
+ batch_size = a_reshaped .shape [0 ]
186
187
for idx in range (batch_size ):
187
188
# Reconstruct the matrix using the Cholesky decomposition result
188
189
if dpnp .issubdtype (dtype , dpnp .complexfloating ):
@@ -192,15 +193,15 @@ def test_cholesky_upper(self, array, dtype):
192
193
else :
193
194
reconstructed = res_reshaped [idx ].T @ res_reshaped [idx ]
194
195
assert_dtype_allclose (
195
- reconstructed , ia_reshaped [idx ], check_type = False
196
+ reconstructed , a_reshaped [idx ], check_type = False
196
197
)
197
198
else :
198
199
# Reconstruct the matrix using the Cholesky decomposition result
199
200
if dpnp .issubdtype (dtype , dpnp .complexfloating ):
200
201
reconstructed = result .T .conj () @ result
201
202
else :
202
203
reconstructed = result .T @ result
203
- assert_dtype_allclose (reconstructed , ia , check_type = False )
204
+ assert_dtype_allclose (reconstructed , a , check_type = False )
204
205
205
206
# upper parameter support will be added in numpy 2.0 version
206
207
@testing .with_requires ("numpy>=2.0" )
0 commit comments