Creates unbiased bit-streams from uncorrelated values. More...
Public Member Functions | |
| ValueUnbiaser (ValueUnbiasAlgorithm algorithm) | |
| Creates an instance of a value unbiaser which converts uncorrelated values into bit-streams. | |
| string | Extract (double[] uncorrelatedData) |
| Extract an unbiased bitstream as string of 0 and 1 characters from an array of uncorrelated values. | |
Creates unbiased bit-streams from uncorrelated values.
Definition at line 39 of file ValueUnbiaser.cs.
| NewGamePhysics.Mathematics.ValueUnbiaser.ValueUnbiaser | ( | ValueUnbiasAlgorithm | algorithm | ) |
Creates an instance of a value unbiaser which converts uncorrelated values into bit-streams.
| algorithm | The value unbiasing algorithm. |
Definition at line 56 of file ValueUnbiaser.cs.
| string NewGamePhysics.Mathematics.ValueUnbiaser.Extract | ( | double[] | uncorrelatedData | ) |
Extract an unbiased bitstream as string of 0 and 1 characters from an array of uncorrelated values.
| uncorrelatedData | Uncorrelated values (i.e. timing measurements of radioactive decay events). |
Definition at line 71 of file ValueUnbiaser.cs.
00072 { 00073 if (uncorrelatedData.Length < 2) 00074 { 00075 return string.Empty; 00076 } 00077 00078 StringBuilder sb = new StringBuilder(); 00079 00080 // Calculate intervals between data values 00081 double[] intervals = new double[uncorrelatedData.Length - 1]; 00082 for (int i = 0; i < intervals.Length; i++) 00083 { 00084 intervals[i] = uncorrelatedData[i + 1] - uncorrelatedData[i]; 00085 } 00086 00087 // Unbias using selected algorithm 00088 switch (this.algorithm) 00089 { 00090 case ValueUnbiasAlgorithm.Pairwise: 00091 this.PairwiseExtract(intervals, ref sb); 00092 break; 00093 case ValueUnbiasAlgorithm.Median: 00094 this.MedianExtract(intervals, ref sb); 00095 break; 00096 case ValueUnbiasAlgorithm.Partition: 00097 this.RecursiveExtract(intervals, ref sb); 00098 break; 00099 } 00100 00101 // Return collected bits 00102 return sb.ToString(); 00103 }
1.6.2