sdpb
sdpb copied to clipboard
Organize pvm2sdp, sdp2input & sdpb: IO format, naming etc.
This is an umbrella issue for pvm2sdp
/sdp2input
formats, naming and other things that could be improved.
TL;DR
- [x] #79
- [ ] #78
- [x] #185
- [x] Better names.
sdp2input
is misleading. Something likesdp2input
->pmp2sdp
? - [x] ~If no one needs
pvm2sdp
anymore (TODO check), remove it?~ UPD: at least one group is still using it. - [x] #178
- [ ] #108
- [x] #109
- [x] #110
- [ ] #111
More details
Input
We have two converters, pvm2sdp
and sdp2input
, both generating the same SDP format (zip with JSON files for each block), which serves as SDPB input. We can implement binary SDP instead of JSON to make it more compact and fast, see #79
These converters use different mathematical formulations (equation numbers taken from SDPB Manual):
- (2.2) Maximize $b_0 + b \cdot y$ over $y \in \mathcal{Z}^N$ such that $M^0_j(x)+\sum y_n M^n_j(x) \succeq 0$
- (3.1) Maximize $a \cdot z$ over $z \in \mathcal{Z}^{N+1}$ such that $n \cdot z = 1$ and $\sum z_n W^n_j(x) \succeq 0$
One can easily translate from (2.2) to (3.1) and back using the normalization condition $n \cdot z = 1$.
Most of users are now using sdp2input
.
If no one needs pvm2sdp
anymore (TODO check), we can remove it.
To get rid of unnecessary disk reads/writes, we can combine all into a single executable, see #78
SDPB
SDPB operates in terms of $y$ variable, i.e. formulation (2.2).
It also writes $y$ to output y.txt
Meanwhile, $z$ makes more physical sense, so end users usually have to convert $y \to z$ after running SDPB.
SDPB can do it and write z.txt
, if it has normalization vector $(n_0..n_N)$.
Normalization vector is read from sdp2input
input.
We can do as follows:
-
sdp2input
input writes optionalnormalization.json
file to SDP.zip - If SDPB is called with
--writeSolution=z
(or--writeSolution=x,y,z
), it remembers normalization and then utilizes it to calculate and writez.txt
.
Naming
Current naming is terribly inconsistent.
pvm2sdp
: we convert PVM (Polynomial Vector Matrix) to SDP (sdpb input format).
sdp2input
: we convert sdp (which is not sdpb input format, but a bunch of positive matrices with prefactor!) to sdpb input.
By the way, in spectrum
pvm2sdp input format is called PVM (Polynomial Vector Matrix), and sdp2input format is called PMP (Positive Matrix with Prefactor):
https://github.com/davidsd/sdpb/blob/fbbefbf11f60b009fa0ed804a18785c2634983d1/src/spectrum/handle_arguments.cxx#L33-L34
In SDPB manual and paper, however, PMP stands for "Polynomial Matrix Program" (which describes both pvm2sdp
and sdp2input
).
I would say, as in paper and manual, that generally we are converting PMP to SDP. So probably we should have a (universal?) converter called pmp2sdp
.
In order to avoid name collision between Polynomial Matrix Program
and Positive Matrix with Prefactor
, we can call them PMP
and PMWP
, respectively.