1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2%% 3%% multi_bigmod.tex LiDIA documentation 4%% 5%% This file contains the documentation of the class multi_bigmod 6%% 7%% Copyright (c) 1995 by LiDIA-Group 8%% 9%% Authors: Thomas Papanikolaou, Oliver Morsch 10%% 11 12 13\NAME 14 15\CLASS{multi_bigmod} \dotfill multiprecision modular integer arithmetic 16 17 18%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 19 20\ABSTRACT 21 22\code{multi_bigmod} is a class for doing multiprecision modular arithmetic over $\ZmZ$. It 23supports for example arithmetic operations, comparisons and exponentiation. 24 25 26%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 27 28\DESCRIPTION 29 30A \code{multi_bigmod} is a pair of two \code{bigint}s $(\mathit{man}, m)$, where $\mathit{man}$ 31is called \emph{mantissa} and $m$ \emph{modulus}. Each \code{multi_bigmod} has got its own 32modulus which can be set by a constructor or by 33\begin{quote} 34 \code{$a$.set_modulus(const bigint & $m$)} 35\end{quote} 36where $a$ is of type \code{multi_bigmod}. 37 38Each equivalence class modulo $m$ is represented by its least non-negative representative, i.e. 39the mantissa of a \code{multi_bigmod} is chosen in the interval $[ 0, \dots, |m|-1 ]$. 40 41 42%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 43 44\CONS 45 46If $m = 0$, the \LEH will be invoked. 47 48\begin{fcode}{ct}{multi_bigmod}{} 49 initializes the mantissa and the modulus with 0. 50\end{fcode} 51 52\begin{fcode}{ct}{multi_bigmod}{const multi_bigmod & $n$} 53 initializes with $n$. 54\end{fcode} 55 56\begin{fcode}{ct}{multi_bigmod}{const bigint & $n$, const bigint & $m$}\end{fcode} 57\begin{fcode}{ct}{multi_bigmod}{long $n$, const bigint & $m$}\end{fcode} 58\begin{fcode}{ct}{multi_bigmod}{unsigned long $n$, const bigint & $m$}\end{fcode} 59\begin{fcode}{ct}{multi_bigmod}{int $n$, const bigint & $m$} 60 initializes the mantissa with $n$ and the modulus with $|m|$. 61\end{fcode} 62 63\begin{fcode}{ct}{multi_bigmod}{double $n$, const bigint & $m$} 64 initializes the mantissa with $\lfloor d \rfloor$ and the modulus with $|m|$. 65\end{fcode} 66 67\begin{fcode}{dt}{~multi_bigmod}{} 68\end{fcode} 69 70 71%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 72 73\INIT 74 75\begin{fcode}{void}{$a$.set_modulus}{const bigint & $m$} 76 sets the modulus of the \code{multi_bigmod} $a$ to $|m|$; if $m = 0$, the \LEH will be 77 invoked. The mantissa of $a$ will not automatically be reduced modulo $m$. You have to call 78 one of the two following normalization functions to reduce the mantissa. 79\end{fcode} 80 81\begin{fcode}{void}{$a$.normalize}{} 82 normalizes the \code{multi_bigmod} $a$ such that the mantissa of $a$ is in the range $[0, 83 \dots, m-1]$, where $m$ is the modulus of $a$. 84\end{fcode} 85 86\begin{fcode}{void}{normalize}{multi_bigmod & $a$, const multi_bigmod & $b$} 87 sets the modulus of $a$ to the modulus of $b$, the mantissa of $a$ to the mantissa of $b$ and 88 normalizes $a$ such that the mantissa of $a$ is in the range $[0, \dots, m-1]$, where $m$ is 89 the modulus of $b$. 90\end{fcode} 91 92 93%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 94 95\ASGN 96 97Let $a$ be of type \code{multi_bigmod} The operator \code{=} is overloaded. The user may also 98use the following object methods for assignment: 99 100\begin{fcode}{void}{$a$.assign_zero}{} 101 $\mantissa(a) \assign 0$. 102\end{fcode} 103 104\begin{fcode}{void}{$a$.assign_one}{} 105 $\mantissa(a) \assign 1$. 106\end{fcode} 107 108\begin{fcode}{void}{$a$.assign_zero}{const bigint & $m$} 109 $\mantissa(a) \assign 0$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 110\end{fcode} 111 112\begin{fcode}{void}{$a$.assign_one}{const bigint & $m$} 113 $\mantissa(a) \assign 1$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 114\end{fcode} 115 116\begin{fcode}{void}{$a$.assign}{int $i$, const bigint & $m$} 117 $\mantissa(a) \assign i$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 118\end{fcode} 119 120\begin{fcode}{void}{$a$.assign}{long $i$, const bigint & $m$} 121 $\mantissa(a) \assign i$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 122\end{fcode} 123 124\begin{fcode}{void}{$a$.assign}{unsigned long $i$, const bigint & $m$} 125 $\mantissa(a) \assign i$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 126\end{fcode} 127 128\begin{fcode}{void}{$a$.assign}{const bigint & $b$, const bigint & $m$} 129 $\mantissa(a) \assign b$, $\modulus(a) \assign |m|$. If $m = 0$, the \LEH will be invoked. 130\end{fcode} 131 132\begin{fcode}{void}{$a$.assign}{const multi_bigmod & $b$} 133 $a \assign b$. 134\end{fcode} 135 136\begin{fcode}{void}{$a$.set_mantissa}{int $i$} 137 $\mantissa(a) \assign i$ and the mantissa of $a$ will be reduced modulo the modulus of $a$. 138\end{fcode} 139 140\begin{fcode}{void}{$a$.set_mantissa}{long $i$} 141 $\mantissa(a) \assign i$ and the mantissa of $a$ will be reduced modulo the modulus of $a$. 142\end{fcode} 143 144\begin{fcode}{void}{$a$.set_mantissa}{unsigned long $i$} 145 $\mantissa(a) \assign i$ and the mantissa of $a$ will be reduced modulo the modulus of $a$. 146\end{fcode} 147 148\begin{fcode}{void}{$a$.set_mantissa}{const bigint & $b$} 149 $\mantissa(a) \assign b$ and the mantissa of $a$ will be reduced modulo the modulus of $a$. 150\end{fcode} 151 152\begin{fcode}{double}{dbl}{const multi_bigmod & $a$} 153 returns the mantissa of $a$ as a double approximation. 154\end{fcode} 155 156\begin{cfcode}{bool}{$a$.intify}{int & $i$} 157 performs the assignment $i \assign \mantissa(a)$ provided the assignment can be done without 158 overflow. In that case the function returns \FALSE, otherwise it returns \TRUE and the value 159 of $i$ will be unchanged. 160\end{cfcode} 161 162\begin{cfcode}{bool}{$a$.longify}{long & $i$} 163 performs the assignment $i \assign \mantissa(a)$ provided the assignment can be done without 164 overflow. In that case the function returns \FALSE, otherwise it returns \TRUE and the value 165 of $i$ will be unchanged. 166\end{cfcode} 167 168 169%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 170 171\ACCS 172 173\begin{fcode}{bigint}{mantissa}{const multi_bigmod & $a$} 174 returns the mantissa of the \code{multi_bigmod} $a$. The mantissa is chosen in the interval 175 $[0, \dots, m-1]$, where $m$ is the modulus of $a$. 176\end{fcode} 177 178\begin{cfcode}{const bigint &}{$a$.mantissa}{} 179 returns the mantissa of the \code{multi_bigmod} $a$. The mantissa is chosen in the interval 180 $[0, \dots, m-1]$, where $m$ is the modulus of $a$. 181\end{cfcode} 182 183\begin{cfcode}{const bigint &}{$a$.modulus}{} 184 returns the modulus of the \code{multi_bigmod} $a$. 185\end{cfcode} 186 187 188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 189 190\MODF 191 192\begin{fcode}{void}{$a$.negate}{} 193 $a \assign -a$. 194\end{fcode} 195 196\begin{fcode}{void}{$a$.inc}{} 197\end{fcode} 198\begin{fcode}{void}{inc}{multi_bigmod & $a$} 199 $a \assign a + 1$. 200\end{fcode} 201 202\begin{fcode}{void}{$a$.dec}{}\end{fcode} 203\begin{fcode}{void}{dec}{multi_bigmod & $a$} 204 $a \assign a - 1$. 205\end{fcode} 206 207\begin{fcode}{bigint}{$a$.invert}{int $\mathit{verbose}$ = 0} 208 sets $a \assign a^{-1}$, if the inverse of $a$ exists. If the inverse does not exist and 209 $\mathit{verbose} = 0$, the \LEH will be invoked. If the inverse does not exist and 210 $\mathit{verbose} \neq 0$, then the function prints a warning and returns the gcd of $a$ and 211 its modulus. In this case $a$ remains unchanged and the program does not exit. 212\end{fcode} 213 214\begin{fcode}{void}{$a$.multiply_by_2}{} 215 $a \assign 2 \cdot a$ (using shift-operations). 216\end{fcode} 217 218\begin{fcode}{void}{$a$.divide_by_2}{} 219 computes a number $b\in [0, \dots, m-1]$ such that $2 b\equiv \mantissa(a)\bmod m$, where $m$ 220 is the modulus of $a$, and sets $\mantissa(a) \assign b$ (note: this is not equivalent to the 221 multiplication of $a$ with the inverse of 2). The \LEH will be invoked if the 222 operation is impossible, i.e.~if the mantissa of $a$ is odd and $m$ is even. 223\end{fcode} 224 225\begin{fcode}{void}{$a$.swap}{multi_bigmod & $b$}\end{fcode} 226\begin{fcode}{void}{swap}{multi_bigmod & $a$, multi_bigmod & $b$} 227 exchanges the mantissa and the modulus of $a$ and $b$. 228\end{fcode} 229 230 231 232%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 233 234\ARTH 235 236The binary operations require that the operands have the same modulus; in case of different 237moduli, the \LEH will be invoked. Binary operations that obtain an operand $a \in \ZmZ$, where 238$m$ is the modulus of $a$, and an operand $b \in \bbfZ$, i.e. $b$ of type \code{int}, 239\code{long}, \code{bigint}, map $b$ to $\ZmZ$. 240 241The following operators are overloaded and can be used in exactly the same way as in C++: 242 243\begin{center} 244 \code{(unary) -, ++, -{}-}\\ 245 \code{(binary) +, -, *, /}\\ 246 \code{(binary with assignment) +=, -=, *=, /=} 247\end{center} 248 249The operators \code{/} and \code{/=} denote ``multiplication with the inverse''. If the inverse 250does not exist, the \LEH will be invoked. To avoid copying all operators also exist as 251functions. 252 253\begin{fcode}{void}{negate}{multi_bigmod & $a$, const multi_bigmod & $b$} 254 $a \assign -b$. 255\end{fcode} 256 257\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, const multi_bigmod & $b$}\end{fcode} 258\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigmod & $b$}\end{fcode} 259\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigint & $b$}\end{fcode} 260\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, long $b$}\end{fcode} 261\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, unsigned long $b$}\end{fcode} 262\begin{fcode}{void}{add}{multi_bigmod & $c$, const multi_bigmod & $a$, int $b$} 263 $c \assign a + b$. 264\end{fcode} 265 266\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, const multi_bigmod & $b$}\end{fcode} 267\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigmod & $b$}\end{fcode} 268\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigint & $b$}\end{fcode} 269\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, long $b$}\end{fcode} 270\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, unsigned long $b$}\end{fcode} 271\begin{fcode}{void}{subtract}{multi_bigmod & $c$, const multi_bigmod & $a$, int $b$} 272 $c \assign a - b$. 273\end{fcode} 274 275\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, const multi_bigmod & $b$}\end{fcode} 276\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigmod & $b$}\end{fcode} 277\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigint & $b$}\end{fcode} 278\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, long $b$}\end{fcode} 279\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, unsigned long $b$}\end{fcode} 280\begin{fcode}{void}{multiply}{multi_bigmod & $c$, const multi_bigmod & $a$, int $b$} 281 $c \assign a \cdot b$. 282\end{fcode} 283 284\begin{fcode}{void}{square}{multi_bigmod & $c$, const multi_bigmod & $a$} 285 $c \assign a^2$. 286\end{fcode} 287 288\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, const multi_bigmod & $b$}\end{fcode} 289\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigmod & $b$}\end{fcode} 290\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigint & $b$}\end{fcode} 291\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, long $b$}\end{fcode} 292\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, unsigned long $b$}\end{fcode} 293\begin{fcode}{void}{divide}{multi_bigmod & $c$, const multi_bigmod & $a$, int $b$} 294 $c \assign a \cdot i^{-1}$, if the inverse of $i$ does not exist, the \LEH will be invoked. 295\end{fcode} 296 297\begin{fcode}{void}{invert}{multi_bigmod & $a$, const multi_bigmod & $b$} 298 sets $a \assign b^{-1}$, if the inverse of $b$ exists. Otherwise the \LEH will be invoked. 299\end{fcode} 300 301\begin{fcode}{multi_bigmod}{inverse}{const multi_bigmod & $a$} 302 returns $a^{-1}$, if the inverse of $a$ exists. Otherwise the \LEH will be invoked. 303\end{fcode} 304 305\begin{fcode}{void}{power}{multi_bigmod & $c$, const multi_bigmod & $a$, const bigint & $b$}\end{fcode} 306\begin{fcode}{void}{power}{multi_bigmod & $c$, const multi_bigmod & $a$, long $b$} 307 $c \assign a^b$ (done with right-to-left binary exponentiation). 308\end{fcode} 309 310 311%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 312 313\COMP 314 315\code{multi_bigmod} supports the binary operators \code{==}, \code{!=} and additionally the 316unary operator \code{!} (comparison with zero). Let $a$ be an instance of type 317\code{multi_bigmod}. 318 319\begin{cfcode}{bool}{$a$.is_equal}{const multi_bigmod & $b$}\end{cfcode} 320\begin{cfcode}{bool}{$a$.is_equal}{const bigmod & $b$} 321 if $b = a$ return \TRUE, else \FALSE. 322\end{cfcode} 323 324\begin{cfcode}{bool}{$a$.is_equal}{const bigint & $b$}\end{cfcode} 325\begin{cfcode}{bool}{$a$.is_equal}{long $b$} 326 if $b \geq 0$, \TRUE is returned if $b = \mantissa(a)$, \FALSE otherwise. If $b < 0$, then 327 \TRUE is returned if $b + \code{bigmod::modulus()} = \mantissa(a)$, \FALSE otherwise. 328\end{cfcode} 329 330\begin{cfcode}{bool}{$a$.is_equal}{unsigned long $b$} 331 if $b \geq 0$, \TRUE is returned if $b = \mantissa(a)$, \FALSE otherwise. 332\end{cfcode} 333 334\begin{cfcode}{bool}{$a$.is_zero}{} 335 returns \TRUE if $\mantissa(a) = 0$, \FALSE otherwise. 336\end{cfcode} 337 338\begin{cfcode}{bool}{$a$.is_one}{} 339 returns \TRUE if $\mantissa(a) = 1$, \FALSE otherwise. 340\end{cfcode} 341 342 343%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 344 345\TYPE 346 347Before assigning a \code{multi_bigmod} (i.e.~the mantissa of a \code{multi_bigmod}) to a machine 348type (e.g.~\code{int}) it is often useful to perform a test which checks whether the assignment 349could be done without overflow. Let $a$ be an object of type \code{multi_bigmod}. The 350following methods return \TRUE if the assignment would be successful, \FALSE otherwise. 351 352\begin{cfcode}{bool}{$a$.is_char}{}\end{cfcode} 353\begin{cfcode}{bool}{$a$.is_uchar}{}\end{cfcode} 354\begin{cfcode}{bool}{$a$.is_short}{}\end{cfcode} 355\begin{cfcode}{bool}{$a$.is_ushort}{}\end{cfcode} 356\begin{cfcode}{bool}{$a$.is_int}{}\end{cfcode} 357\begin{cfcode}{bool}{$a$.is_uint}{}\end{cfcode} 358\begin{cfcode}{bool}{$a$.is_long}{}\end{cfcode} 359\begin{cfcode}{bool}{$a$.is_ulong}{}\end{cfcode} 360 361There methods also exists as procedural versions, however, the object methods are preferred over 362the procedures. 363\begin{fcode}{bool}{is_char}{const multi_bigmod & $a$}\end{fcode} 364\begin{fcode}{bool}{is_uchar}{const multi_bigmod & $a$}\end{fcode} 365\begin{fcode}{bool}{is_short}{const multi_bigmod & $a$}\end{fcode} 366\begin{fcode}{bool}{is_ushort}{const multi_bigmod & $a$}\end{fcode} 367\begin{fcode}{bool}{is_int}{const multi_bigmod & $a$}\end{fcode} 368\begin{fcode}{bool}{is_uint}{const multi_bigmod & $a$}\end{fcode} 369\begin{fcode}{bool}{is_long}{const multi_bigmod & $a$}\end{fcode} 370\begin{fcode}{bool}{is_ulong}{const multi_bigmod & $a$}\end{fcode} 371 372 373%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 374 375\BASIC 376 377Let $a$ be of type \code{multi_bigmod}. 378 379\begin{cfcode}{lidia_size_t}{$a$.bit_length}{} 380 returns the bit-length of $a$'s mantissa (see class \code{bigint}, page \pageref{class:bigint}). 381\end{cfcode} 382 383\begin{cfcode}{lidia_size_t}{$a$.length}{} 384 returns the word-length of $a$'s mantissa (see class \code{bigint}, page 385 \pageref{class:bigint}). 386\end{cfcode} 387 388 389%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 390 391\HIGH 392 393\begin{fcode}{multi_bigmod}{randomize}{const multi_bigmod & $a$} 394 returns a random \code{multi_bigmod} $b$ with random mantissa in the range 395 $[0, \dots, \mantissa(b)-1]$, $\modulus(b) = \modulus(a)$. 396\end{fcode} 397 398\begin{fcode}{void}{$a$.randomize}{const bigint & $m$} 399 computes a random mantissa of $a$ in the range $[0, \dots, |m|-1]$, $\modulus(a) = |m|$. 400\end{fcode} 401 402 403%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 404 405\IO 406 407Let $a$ be of type \code{multi_bigmod}. 408 409The \code{istream} operator \code{>>} and the \code{ostream} operator \code{<<} are 410overloaded. Furthermore, you can use the following member functions for writing to and reading 411from a file in binary or ASCII format, respectively. The input and output format of a 412\code{multi_bigmod} are 413\begin{center} 414 \code{(mantissa, modulus)}. 415\end{center} 416 417\begin{fcode}{int}{$x$.read_from_file}{FILE *fp} 418 reads $x$ from the binary file \code{fp} using \code{fread}. 419\end{fcode} 420 421\begin{fcode}{int}{$x$.write_to_file}{FILE *fp} 422 writes $x$ to the binary file \code{fp} using \code{fwrite}. 423\end{fcode} 424 425\begin{fcode}{int}{$x$.scan_from_file}{FILE *fp} 426 scans $x$ from the ASCII file \code{fp} using \code{fscanf}. 427\end{fcode} 428 429\begin{fcode}{int}{$x$.print_to_file}{FILE *fp} 430 prints $x$ to the ASCII file \code{fp} using \code{fprintf}. 431\end{fcode} 432 433\begin{fcode}{int}{string_to_multi_bigmod}{char *s, multi_bigmod & $a$} 434 converts the string $s$ to a \code{multi_bigmod} $a$ and returns the number of converted 435 characters. 436\end{fcode} 437 438\begin{fcode}{int}{multi_bigmod_to_string}{const multi_bigmod & $a$, char *s} 439 converts the \code{multi_bigmod} $a$ to a string $s$ and returns the number of used 440 characters. 441\end{fcode} 442 443 444%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 445 446\SEEALSO 447 448\SEE{bigint}, \SEE{bigmod} 449 450 451%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 452 453\EXAMPLES 454 455\begin{quote} 456\begin{verbatim} 457#include <LiDIA/multi_bigmod.h> 458 459int main() 460{ 461 multi_bigmod a, b, c; 462 463 a.set_modulus(10); 464 b.set_modulus(10); 465 cout << "Please enter a : "; cin >> a ; 466 cout << "Please enter b : "; cin >> b ; 467 cout << endl; 468 c = a + b; 469 cout << "a + b = " << c << endl; 470} 471\end{verbatim} 472\end{quote} 473 474For further reference please refer to \path{LiDIA/src/simple_classes/multi_bigmod_appl.cc} 475 476 477%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 478 479\AUTHOR 480 481Markus Maurer, Thomas Papanikolaou 482 483