Function PGAMapIntegerToReal
Defined in File evaluate.c
Function Documentation
-
static double PGAMapIntegerToReal(PGAContext *ctx, unsigned int v, unsigned int nbits, double l, double u)
Map the value v defined on [0,(1<<nbits)-1] to double in [l,u].
Description
In the context of PGAPack \([a,b]\) is the discrete interval \([0,2^{nbits}-1]\) (i.e., the number of bits in a binary string) and \([l,u]\) represent the range of possible values of the real number \(r\).
Example
Map a five bit (that is, an integer with a range of [0, 31]) integer 7 to a real in the range [0, 3.14].
PGAContext *ctx; double x; ... x = PGAMapIntegerToReal (ctx, 7, 5, 0.0, 3.14);
- Parameters:
ctx – context variable
v – value from original interval (usually the decoded bit string)
nbits – number of bits in integer
l – lower bound of double interval
u – upper bound of double interval
- Returns:
Scaled double value of v defined on [l,u]