18 #pragma GCC diagnostic push
19 #pragma GCC diagnostic ignored "-Wunused-variable"
22 void ser(
int fp, T& x, SerMode mode) {
27 int n = write(fp, &xcopy,
sizeof(T));
28 assert (n ==
sizeof(T));
32 int n = read(fp, &x,
sizeof(T));
33 assert (n ==
sizeof(T));
40 void ser(
int fp, vector<T>& x, SerMode mode) {
45 int n = write(fp, x.data(),
sizeof(T)*size);
46 assert (n ==
sizeof(T)*size);
51 int n = read(fp, x.data(),
sizeof(T)*size);
52 assert (n ==
sizeof(T)*size);
61 int m, n, nz, qn, qnz;
62 vector<int> acolcnt, acolidx;
63 vector<double> acolnzs;
64 vector<int> qcolcnt, qcolidx;
65 vector<double> qcolnzs;
66 vector<double> rhs, obj, lbound, ubound;
70 const vector<int>& acolcnt,
const vector<int>& acolidx,
const vector<double>& acolnzs,
71 const vector<int>& qcolcnt,
const vector<int>& qcolidx,
const vector<double>& qcolnzs,
72 const vector<double>& rhs,
const vector<double>& obj,
const vector<double>& lbound,
const vector<double>& ubound) :
73 m(m), n(n), nz(nz), qn(qn), qnz(qnz), acolcnt(acolcnt), acolidx(acolidx), acolnzs(acolnzs), qcolcnt(qcolcnt), qcolidx(qcolidx), qcolnzs(qcolnzs),
74 rhs(rhs), obj(obj), lbound(lbound), ubound(ubound) {}
77 const char EXIT_CHAR = 123;
78 const char CHECK_CHAR = 111;
82 char scorrect=
'z', s=(mode==SER) ? scorrect : 0;
94 ser(fp,bi.acolcnt,mode);
95 ser(fp,bi.acolidx,mode);
96 ser(fp,bi.acolnzs,mode);
97 ser(fp,bi.qcolcnt,mode);
98 ser(fp,bi.qcolidx,mode);
99 ser(fp,bi.qcolnzs,mode);
102 ser(fp,bi.lbound,mode);
103 ser(fp,bi.ubound,mode);
112 vector<double> primal, dual;
117 bpmpd_output(
const vector<double>& primal,
const vector<double>& dual,
const vector<int>& status,
int code,
double opt) :
118 primal(primal), dual(dual), status(status), code(code), opt(opt) {}
123 char scorrect=CHECK_CHAR, s=(mode==SER) ? scorrect : 0;
125 if (s == EXIT_CHAR) {
128 ser(fp, bo.primal, mode);
129 ser(fp, bo.dual, mode);
130 ser(fp, bo.status, mode);
131 ser(fp, bo.code, mode);
132 ser(fp, bo.opt, mode);
138 #pragma GCC diagnostic pop