| 8 | #include "ipm/basiclu/lu_internal.h" |
| 9 | |
| 10 | lu_int basiclu_solve_sparse |
| 11 | ( |
| 12 | lu_int istore[], |
| 13 | double xstore[], |
| 14 | lu_int Li[], |
| 15 | double Lx[], |
| 16 | lu_int Ui[], |
| 17 | double Ux[], |
| 18 | lu_int Wi[], |
| 19 | double Wx[], |
| 20 | lu_int nzrhs, |
| 21 | const lu_int irhs[], |
| 22 | const double xrhs[], |
| 23 | lu_int *p_nzlhs, |
| 24 | lu_int ilhs[], |
| 25 | double lhs[], |
| 26 | char trans |
| 27 | ) |
| 28 | { |
| 29 | struct lu this; |
| 30 | lu_int status, n, ok; |
| 31 | |
| 32 | status = lu_load(&this, istore, xstore, Li, Lx, Ui, Ux, Wi, Wx); |
| 33 | if (status != BASICLU_OK) |
| 34 | return status; |
| 35 | |
| 36 | if (! (Li && Lx && Ui && Ux && Wi && Wx && irhs && xrhs && p_nzlhs && ilhs |
| 37 | && lhs)) |
| 38 | { |
| 39 | status = BASICLU_ERROR_argument_missing; |
| 40 | } |
| 41 | else if (this.nupdate < 0) |
| 42 | { |
| 43 | status = BASICLU_ERROR_invalid_call; |
| 44 | } |
| 45 | else |
| 46 | { |
| 47 | /* check RHS indices */ |
| 48 | ok = nzrhs >= 0 && nzrhs <= this.m; |
| 49 | for (n = 0; n < nzrhs && ok; n++) |
| 50 | { |
| 51 | ok = ok && irhs[n] >= 0 && irhs[n] < this.m; |
| 52 | } |
| 53 | if (!ok) |
| 54 | status = BASICLU_ERROR_invalid_argument; |
| 55 | } |
| 56 | |
| 57 | if (status == BASICLU_OK) |
| 58 | { |
| 59 | lu_solve_sparse(&this, nzrhs, irhs, xrhs, p_nzlhs, ilhs, lhs, trans); |
| 60 | } |
| 61 | |
| 62 | return lu_save(&this, istore, xstore, status); |
| 63 | } |
no test coverage detected