Function PGAGetBinaryAllele
Defined in File binary.c
Function Documentation
-
int PGAGetBinaryAllele(PGAContext *ctx, int p, int pop, int i)
Return the value of a (binary) allele.
Description
Applies to the binary data type, set with parameter
PGA_DATATYPE_BINARY
ofPGACreate()
.Example
Copies the alleles from member
p
inPGA_OLDPOP
to memberq
PGA_NEWPOP
. Assumes the strings are of the same length.PGAContext *ctx; int p, q, i; ... for (i=PGAGetStringLength (ctx)-1; i>=0; i--) { int a = PGAGetBinaryAllele (ctx, p, PGA_OLDPOP, i); PGASetBinaryAllele (ctx, q, PGA_NEWPOP, i, a); }
- Parameters
ctx – context variable
p – string index
pop – symbolic constant of the population the string is in
i – allele index
- Returns
The value of the ith allele of string p in population pop