mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-03-01 18:26:24 +08:00
fix umfpack with complexes
This commit is contained in:
parent
2c1ac23c62
commit
434817164e
@ -52,8 +52,7 @@ inline int umfpack_symbolic(int n_row,int n_col,
|
||||
const int Ap[], const int Ai[], const std::complex<double> Ax[], void **Symbolic,
|
||||
const double Control [UMFPACK_CONTROL], double Info [UMFPACK_INFO])
|
||||
{
|
||||
double ax0_real = Ax[0].real();
|
||||
return umfpack_zi_symbolic(n_row,n_col,Ap,Ai,&ax0_real,0,Symbolic,Control,Info);
|
||||
return umfpack_zi_symbolic(n_row,n_col,Ap,Ai,&internal::real_ref(Ax[0]),0,Symbolic,Control,Info);
|
||||
}
|
||||
|
||||
inline int umfpack_numeric( const int Ap[], const int Ai[], const double Ax[],
|
||||
@ -67,8 +66,7 @@ inline int umfpack_numeric( const int Ap[], const int Ai[], const std::complex<d
|
||||
void *Symbolic, void **Numeric,
|
||||
const double Control[UMFPACK_CONTROL],double Info [UMFPACK_INFO])
|
||||
{
|
||||
double ax0_real = Ax[0].real();
|
||||
return umfpack_zi_numeric(Ap,Ai,&ax0_real,0,Symbolic,Numeric,Control,Info);
|
||||
return umfpack_zi_numeric(Ap,Ai,&internal::real_ref(Ax[0]),0,Symbolic,Numeric,Control,Info);
|
||||
}
|
||||
|
||||
inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const double Ax[],
|
||||
@ -82,10 +80,7 @@ inline int umfpack_solve( int sys, const int Ap[], const int Ai[], const std::co
|
||||
std::complex<double> X[], const std::complex<double> B[], void *Numeric,
|
||||
const double Control[UMFPACK_CONTROL], double Info[UMFPACK_INFO])
|
||||
{
|
||||
double ax0_real = Ax[0].real();
|
||||
double x0_real = X[0].real();
|
||||
double b0_real = B[0].real();
|
||||
return umfpack_zi_solve(sys,Ap,Ai,&ax0_real,0,&x0_real,0,&b0_real,0,Numeric,Control,Info);
|
||||
return umfpack_zi_solve(sys,Ap,Ai,&internal::real_ref(Ax[0]),0,&internal::real_ref(X[0]),0,&internal::real_ref(B[0]),0,Numeric,Control,Info);
|
||||
}
|
||||
|
||||
inline int umfpack_get_lunz(int *lnz, int *unz, int *n_row, int *n_col, int *nz_udiag, void *Numeric, double)
|
||||
@ -107,11 +102,11 @@ inline int umfpack_get_numeric(int Lp[], int Lj[], double Lx[], int Up[], int Ui
|
||||
inline int umfpack_get_numeric(int Lp[], int Lj[], std::complex<double> Lx[], int Up[], int Ui[], std::complex<double> Ux[],
|
||||
int P[], int Q[], std::complex<double> Dx[], int *do_recip, double Rs[], void *Numeric)
|
||||
{
|
||||
double lx0_real = Lx[0].real();
|
||||
double ux0_real = Ux[0].real();
|
||||
double dx0_real = Dx[0].real();
|
||||
double& lx0_real = internal::real_ref(Lx[0]);
|
||||
double& ux0_real = internal::real_ref(Ux[0]);
|
||||
double& dx0_real = internal::real_ref(Dx[0]);
|
||||
return umfpack_zi_get_numeric(Lp,Lj,Lx?&lx0_real:0,0,Up,Ui,Ux?&ux0_real:0,0,P,Q,
|
||||
Dx?&dx0_real:0,0,do_recip,Rs,Numeric);
|
||||
Dx?&dx0_real:0,0,do_recip,Rs,Numeric);
|
||||
}
|
||||
|
||||
inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO])
|
||||
@ -121,7 +116,7 @@ inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle,
|
||||
|
||||
inline int umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO])
|
||||
{
|
||||
double mx_real = Mx->real();
|
||||
double& mx_real = internal::real_ref(*Mx);
|
||||
return umfpack_zi_get_determinant(&mx_real,0,Ex,NumericHandle,User_Info);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user