#include <cstdlib>#include <cstring>#include <cmath>#include <cassert>#include <algorithm>#include <vector>#include <iostream>#include "vnl_bignum.h"#include <vnl/vnl_math.h>Go to the source code of this file.
Typedefs | |
| typedef unsigned short | Counter |
| typedef unsigned short | Data |
Functions | |
| std::istream & | operator>> (std::istream &is, vnl_bignum &x) |
| Reads a vnl_bignum from a stream. More... | |
| std::ostream & | operator<< (std::ostream &os, const vnl_bignum &b) |
| Formatted output for bignum. More... | |
| std::string & | vnl_bignum_to_string (std::string &s, const vnl_bignum &b) |
| Convert the number to a decimal representation in a string. More... | |
| vnl_bignum & | vnl_bignum_from_string (vnl_bignum &b, const std::string &s) |
| Convert the number from a decimal representation in a string. More... | |
| unsigned int | ctox (int c) |
| convert hex character to integer hex value (ASCII or EBCDIC). More... | |
| void | add (const vnl_bignum &b1, const vnl_bignum &b2, vnl_bignum &sum) |
| add two non-infinite vnl_bignum values and save their sum. More... | |
| void | increment (vnl_bignum &bnum) |
| Add 1 to bnum (unsigned, non-infinite). More... | |
| void | subtract (const vnl_bignum &bmax, const vnl_bignum &bmin, vnl_bignum &diff) |
| subtract bmin from bmax (unsigned, non-infinite), result in diff. More... | |
| void | decrement (vnl_bignum &bnum) |
| Subtract 1 from bnum (unsigned, non-infinite, non-zero). More... | |
| int | magnitude_cmp (const vnl_bignum &b1, const vnl_bignum &b2) |
| compare absolute values of two vnl_bignums. More... | |
| void | multiply_aux (const vnl_bignum &b, Data d, vnl_bignum &prod, Counter i) |
| multiply a non-infinite vnl_bignum by a "single digit". More... | |
| Data | normalize (const vnl_bignum &b1, const vnl_bignum &b2, vnl_bignum &u, vnl_bignum &v) |
| normalize two vnl_bignums. More... | |
| void | divide_aux (const vnl_bignum &b1, Data d, vnl_bignum &q, Data &r) |
| divide a vnl_bignum by a "single digit". More... | |
| Data | estimate_q_hat (const vnl_bignum &u, const vnl_bignum &v, Counter j) |
| estimate next dividend. More... | |
| Data | multiply_subtract (vnl_bignum &u, const vnl_bignum &v, Data q_hat, Counter j) |
| calculate u - v*q_hat. More... | |
| void | divide (const vnl_bignum &b1, const vnl_bignum &b2, vnl_bignum &q, vnl_bignum &r) |
| divide b2 into b1, getting quotient q and remainder r. More... | |
| vnl_bignum | left_shift (const vnl_bignum &b1, int l) |
| left shift (arithmetic) non-infinite vnl_bignum by positive number. More... | |
| vnl_bignum | right_shift (const vnl_bignum &b1, int l) |
| right shift (arithmetic) non-infinite vnl_bignum by positive number. More... | |
| typedef unsigned short Counter |
Definition at line 15 of file vnl_bignum.cxx.
| typedef unsigned short Data |
Definition at line 16 of file vnl_bignum.cxx.
| void add | ( | const vnl_bignum & | b1, |
| const vnl_bignum & | b2, | ||
| vnl_bignum & | sum | ||
| ) |
add two non-infinite vnl_bignum values and save their sum.
Definition at line 887 of file vnl_bignum.cxx.
| unsigned int ctox | ( | int | c | ) |
convert hex character to integer hex value (ASCII or EBCDIC).
Definition at line 802 of file vnl_bignum.cxx.
| void decrement | ( | vnl_bignum & | bnum | ) |
Subtract 1 from bnum (unsigned, non-infinite, non-zero).
Definition at line 969 of file vnl_bignum.cxx.
| void divide | ( | const vnl_bignum & | b1, |
| const vnl_bignum & | b2, | ||
| vnl_bignum & | q, | ||
| vnl_bignum & | r | ||
| ) |
divide b2 into b1, getting quotient q and remainder r.
(Refer to Knuth, V.2, Section 4.3.1, Algorithm D for details. This function implements Algorithm D.)
Definition at line 1187 of file vnl_bignum.cxx.
| void divide_aux | ( | const vnl_bignum & | b1, |
| Data | d, | ||
| vnl_bignum & | q, | ||
| Data & | r | ||
| ) |
divide a vnl_bignum by a "single digit".
(Refer to Knuth, V.2, Section 4.3.2, exercise 16 for details. A digit here is one data element in the radix 2**2.)
Definition at line 1062 of file vnl_bignum.cxx.
| Data estimate_q_hat | ( | const vnl_bignum & | u, |
| const vnl_bignum & | v, | ||
| Counter | j | ||
| ) |
estimate next dividend.
(Refer to Knuth, V.2, Section 4.3.1, Algorithm D for details. This function estimates how many times v goes into u, starting at u's jth digit. A digit here is actually a data element, thought of as being in the radix 2**2.)
Definition at line 1082 of file vnl_bignum.cxx.
| void increment | ( | vnl_bignum & | bnum | ) |
Add 1 to bnum (unsigned, non-infinite).
Definition at line 928 of file vnl_bignum.cxx.
| vnl_bignum left_shift | ( | const vnl_bignum & | b1, |
| int | l | ||
| ) |
left shift (arithmetic) non-infinite vnl_bignum by positive number.
Definition at line 1246 of file vnl_bignum.cxx.
| int magnitude_cmp | ( | const vnl_bignum & | b1, |
| const vnl_bignum & | b2 | ||
| ) |
compare absolute values of two vnl_bignums.
Outputs: result of comparison: -1 if abs(b1) < abs(b2) 0 if abs(b1) == abs(b2) +1 if abs(b1) > abs(b2)
Definition at line 988 of file vnl_bignum.cxx.
| void multiply_aux | ( | const vnl_bignum & | b, |
| Data | d, | ||
| vnl_bignum & | prod, | ||
| Counter | i | ||
| ) |
multiply a non-infinite vnl_bignum by a "single digit".
Definition at line 1009 of file vnl_bignum.cxx.
| Data multiply_subtract | ( | vnl_bignum & | u, |
| const vnl_bignum & | v, | ||
| Data | q_hat, | ||
| Counter | j | ||
| ) |
calculate u - v*q_hat.
(Refer to Knuth, V. 2, Section 4.3.1, Algorithm D for details. A digit here is a data element, thought of as being in the radix 2**2.)
Definition at line 1129 of file vnl_bignum.cxx.
| Data normalize | ( | const vnl_bignum & | b1, |
| const vnl_bignum & | b2, | ||
| vnl_bignum & | u, | ||
| vnl_bignum & | v | ||
| ) |
normalize two vnl_bignums.
(Refer to Knuth, V.2, Section 4.3.1, Algorithm D for details. A digit here is one data element in the radix 2**2.)
Definition at line 1045 of file vnl_bignum.cxx.
| VNL_EXPORT std::ostream & operator<< | ( | std::ostream & | os, |
| const vnl_bignum & | b | ||
| ) |
| VNL_EXPORT std::istream & operator>> | ( | std::istream & | is, |
| vnl_bignum & | x | ||
| ) |
| vnl_bignum right_shift | ( | const vnl_bignum & | b1, |
| int | l | ||
| ) |
right shift (arithmetic) non-infinite vnl_bignum by positive number.
Definition at line 1284 of file vnl_bignum.cxx.
| void subtract | ( | const vnl_bignum & | bmax, |
| const vnl_bignum & | bmin, | ||
| vnl_bignum & | diff | ||
| ) |
subtract bmin from bmax (unsigned, non-infinite), result in diff.
Definition at line 947 of file vnl_bignum.cxx.
| VNL_EXPORT vnl_bignum & vnl_bignum_from_string | ( | vnl_bignum & | b, |
| const std::string & | s | ||
| ) |
Convert the number from a decimal representation in a string.
Definition at line 667 of file vnl_bignum.cxx.
| VNL_EXPORT std::string & vnl_bignum_to_string | ( | std::string & | s, |
| const vnl_bignum & | b | ||
| ) |
Convert the number to a decimal representation in a string.
Definition at line 643 of file vnl_bignum.cxx.
1.8.15