@@ -653,7 +653,7 @@ def impl(
653
653
654
654
def _sysv (
655
655
A : np .ndarray , B : np .ndarray , lower : bool , overwrite_a : bool , overwrite_b : bool
656
- ) -> tuple [np .ndarray , np .ndarray , int ]:
656
+ ) -> tuple [np .ndarray , np .ndarray , np . ndarray , int ]:
657
657
"""
658
658
Placeholder for solving a linear system with a symmetric matrix; used by linalg.solve.
659
659
"""
@@ -664,7 +664,8 @@ def _sysv(
664
664
def sysv_impl (
665
665
A : np .ndarray , B : np .ndarray , lower : bool , overwrite_a : bool , overwrite_b : bool
666
666
) -> Callable [
667
- [np .ndarray , np .ndarray , bool , bool , bool ], tuple [np .ndarray , np .ndarray , int ]
667
+ [np .ndarray , np .ndarray , bool , bool , bool ],
668
+ tuple [np .ndarray , np .ndarray , np .ndarray , int ],
668
669
]:
669
670
ensure_lapack ()
670
671
_check_scipy_linalg_matrix (A , "sysv" )
@@ -740,8 +741,8 @@ def impl(
740
741
)
741
742
742
743
if B_is_1d :
743
- return B_copy [..., 0 ], IPIV , int_ptr_to_val ( INFO )
744
- return B_copy , IPIV , int_ptr_to_val (INFO )
744
+ B_copy = B_copy [..., 0 ]
745
+ return A_copy , B_copy , IPIV , int_ptr_to_val (INFO )
745
746
746
747
return impl
747
748
@@ -770,7 +771,7 @@ def impl(A: np.ndarray, ipiv: np.ndarray, anorm: float) -> tuple[np.ndarray, int
770
771
771
772
N = val_to_int_ptr (_N )
772
773
LDA = val_to_int_ptr (_N )
773
- UPLO = val_to_int_ptr (ord ("L " ))
774
+ UPLO = val_to_int_ptr (ord ("U " ))
774
775
ANORM = np .array (anorm , dtype = dtype )
775
776
RCOND = np .empty (1 , dtype = dtype )
776
777
WORK = np .empty (2 * _N , dtype = dtype )
@@ -843,10 +844,10 @@ def impl(
843
844
) -> np .ndarray :
844
845
_solve_check_input_shapes (A , B )
845
846
846
- x , ipiv , info = _sysv (A , B , lower , overwrite_a , overwrite_b )
847
+ lu , x , ipiv , info = _sysv (A , B , lower , overwrite_a , overwrite_b )
847
848
_solve_check (A .shape [- 1 ], info )
848
849
849
- rcond , info = _sycon (A , ipiv , _xlange (A , order = "I" ))
850
+ rcond , info = _sycon (lu , ipiv , _xlange (A , order = "I" ))
850
851
_solve_check (A .shape [- 1 ], info , True , rcond )
851
852
852
853
return x
0 commit comments