params.rs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. use spiral_rs::params::*;
  2. use spiral_rs::util::*;
  3. // Get the Spiral params for a database of 2^r 8-byte entries. These
  4. // params are taken from spiral's params_store.json file, but adjusted
  5. // for 8-byte entries.
  6. pub fn get_spiral_params(r: usize) -> Params {
  7. let json = match r {
  8. 15 => {
  9. r#"{
  10. "n": 2,
  11. "nu_1": 6,
  12. "nu_2": 4,
  13. "p": 4,
  14. "q2_bits": 13,
  15. "t_gsw": 4,
  16. "t_conv": 4,
  17. "t_exp_left": 4,
  18. "t_exp_right": 56,
  19. "instances": 1,
  20. "db_item_size": 256
  21. }"#
  22. }
  23. 16 => {
  24. r#"{
  25. "n": 2,
  26. "nu_1": 6,
  27. "nu_2": 4,
  28. "p": 4,
  29. "q2_bits": 13,
  30. "t_gsw": 4,
  31. "t_conv": 4,
  32. "t_exp_left": 4,
  33. "t_exp_right": 56,
  34. "instances": 1,
  35. "db_item_size": 512
  36. }"#
  37. }
  38. 17 => {
  39. r#"{
  40. "n": 2,
  41. "nu_1": 6,
  42. "nu_2": 4,
  43. "p": 4,
  44. "q2_bits": 13,
  45. "t_gsw": 4,
  46. "t_conv": 4,
  47. "t_exp_left": 4,
  48. "t_exp_right": 56,
  49. "instances": 1,
  50. "db_item_size": 1024
  51. }"#
  52. }
  53. 18 => {
  54. r#"{
  55. "n": 2,
  56. "nu_1": 6,
  57. "nu_2": 4,
  58. "p": 4,
  59. "q2_bits": 13,
  60. "t_gsw": 4,
  61. "t_conv": 4,
  62. "t_exp_left": 4,
  63. "t_exp_right": 56,
  64. "instances": 1,
  65. "db_item_size": 2048
  66. }"#
  67. }
  68. 19 => {
  69. r#"{
  70. "n": 2,
  71. "nu_1": 7,
  72. "nu_2": 4,
  73. "p": 4,
  74. "q2_bits": 13,
  75. "t_gsw": 4,
  76. "t_conv": 32,
  77. "t_exp_left": 4,
  78. "t_exp_right": 56,
  79. "instances": 1,
  80. "db_item_size": 2048
  81. }"#
  82. }
  83. 20 => {
  84. r#"{
  85. "n": 2,
  86. "nu_1": 7,
  87. "nu_2": 4,
  88. "p": 16,
  89. "q2_bits": 16,
  90. "t_gsw": 4,
  91. "t_conv": 4,
  92. "t_exp_left": 4,
  93. "t_exp_right": 56,
  94. "instances": 1,
  95. "db_item_size": 4096
  96. }"#
  97. }
  98. 21 => {
  99. r#"{
  100. "n": 2,
  101. "nu_1": 7,
  102. "nu_2": 5,
  103. "p": 16,
  104. "q2_bits": 16,
  105. "t_gsw": 5,
  106. "t_conv": 4,
  107. "t_exp_left": 4,
  108. "t_exp_right": 56,
  109. "instances": 1,
  110. "db_item_size": 4096
  111. }"#
  112. }
  113. 22 => {
  114. r#"{
  115. "n": 2,
  116. "nu_1": 8,
  117. "nu_2": 5,
  118. "p": 16,
  119. "q2_bits": 16,
  120. "t_gsw": 5,
  121. "t_conv": 4,
  122. "t_exp_left": 4,
  123. "t_exp_right": 56,
  124. "instances": 1,
  125. "db_item_size": 4096
  126. }"#
  127. }
  128. 23 => {
  129. r#"{
  130. "n": 2,
  131. "nu_1": 8,
  132. "nu_2": 6,
  133. "p": 16,
  134. "q2_bits": 16,
  135. "t_gsw": 5,
  136. "t_conv": 4,
  137. "t_exp_left": 4,
  138. "t_exp_right": 56,
  139. "instances": 1,
  140. "db_item_size": 4096
  141. }"#
  142. }
  143. 24 => {
  144. r#"{
  145. "n": 2,
  146. "nu_1": 8,
  147. "nu_2": 6,
  148. "p": 256,
  149. "q2_bits": 20,
  150. "t_gsw": 8,
  151. "t_conv": 4,
  152. "t_exp_left": 8,
  153. "t_exp_right": 56,
  154. "instances": 1,
  155. "db_item_size": 8192
  156. }"#
  157. }
  158. 25 => {
  159. r#"{
  160. "n": 2,
  161. "nu_1": 9,
  162. "nu_2": 6,
  163. "p": 256,
  164. "q2_bits": 20,
  165. "t_gsw": 8,
  166. "t_conv": 4,
  167. "t_exp_left": 8,
  168. "t_exp_right": 56,
  169. "instances": 1,
  170. "db_item_size": 8192
  171. }"#
  172. }
  173. 26 => {
  174. r#"{
  175. "n": 2,
  176. "nu_1": 9,
  177. "nu_2": 7,
  178. "p": 256,
  179. "q2_bits": 20,
  180. "t_gsw": 8,
  181. "t_conv": 4,
  182. "t_exp_left": 8,
  183. "t_exp_right": 56,
  184. "instances": 1,
  185. "db_item_size": 8192
  186. }"#
  187. }
  188. 27 => {
  189. r#"{
  190. "n": 2,
  191. "nu_1": 9,
  192. "nu_2": 8,
  193. "p": 256,
  194. "q2_bits": 20,
  195. "t_gsw": 8,
  196. "t_conv": 4,
  197. "t_exp_left": 8,
  198. "t_exp_right": 56,
  199. "instances": 1,
  200. "db_item_size": 8192
  201. }"#
  202. }
  203. 28 => {
  204. r#"{
  205. "n": 2,
  206. "nu_1": 10,
  207. "nu_2": 8,
  208. "p": 256,
  209. "q2_bits": 20,
  210. "t_gsw": 8,
  211. "t_conv": 4,
  212. "t_exp_left": 16,
  213. "t_exp_right": 56,
  214. "instances": 1,
  215. "db_item_size": 8192
  216. }"#
  217. }
  218. 29 => {
  219. r#"{
  220. "n": 2,
  221. "nu_1": 10,
  222. "nu_2": 9,
  223. "p": 256,
  224. "q2_bits": 23,
  225. "t_gsw": 9,
  226. "t_conv": 4,
  227. "t_exp_left": 16,
  228. "t_exp_right": 56,
  229. "instances": 1,
  230. "db_item_size": 8192
  231. }"#
  232. }
  233. 30 => {
  234. r#"{
  235. "n": 4,
  236. "nu_1": 10,
  237. "nu_2": 8,
  238. "p": 256,
  239. "q2_bits": 20,
  240. "t_gsw": 8,
  241. "t_conv": 4,
  242. "t_exp_left": 16,
  243. "t_exp_right": 56,
  244. "instances": 1,
  245. "db_item_size": 32768
  246. }"#
  247. }
  248. 31 => {
  249. r#"{
  250. "n": 8,
  251. "nu_1": 10,
  252. "nu_2": 8,
  253. "p": 256,
  254. "q2_bits": 20,
  255. "t_gsw": 8,
  256. "t_conv": 4,
  257. "t_exp_left": 16,
  258. "t_exp_right": 56,
  259. "instances": 1,
  260. "db_item_size": 65536
  261. }"#
  262. }
  263. 32 => {
  264. r#"{
  265. "n": 8,
  266. "nu_1": 10,
  267. "nu_2": 9,
  268. "p": 256,
  269. "q2_bits": 20,
  270. "t_gsw": 10,
  271. "t_conv": 32,
  272. "t_exp_left": 16,
  273. "t_exp_right": 56,
  274. "instances": 1,
  275. "db_item_size": 65536
  276. }"#
  277. }
  278. 33 => {
  279. r#"{
  280. "n": 8,
  281. "nu_1": 10,
  282. "nu_2": 10,
  283. "p": 256,
  284. "q2_bits": 20,
  285. "t_gsw": 10,
  286. "t_conv": 32,
  287. "t_exp_left": 16,
  288. "t_exp_right": 56,
  289. "instances": 1,
  290. "db_item_size": 65536
  291. }"#
  292. }
  293. _ => panic!(),
  294. };
  295. params_from_json(json)
  296. }