internal FrugalQuantile(FrugalState state) { this.Quantile = state.Quantile; this.Estimate = state.Estimate; this._directCount = state.DirectCount == null ? null : new List <double>(state.DirectCount); StepAdjuster = ConstantStepAdjuster; Rand = new FastRandom(); }
public FrugalQuantile Deserialize(Stream stream) { using (var br = new BinaryReader(stream)) { int dataFormatMajorVersion = br.ReadUInt16(); int dataFormatMinorVersion = br.ReadUInt16(); AssertDataVersionCanBeRead(dataFormatMajorVersion, dataFormatMinorVersion); var quantile = br.ReadDouble(); var estimate = br.ReadDouble(); ICollection <double> directCount = null; var direct = br.ReadBoolean(); if (direct) { int count = br.ReadInt32(); directCount = new List <double>(); for (var i = 0; i < count; i++) { var element = br.ReadDouble(); directCount.Add(element); } } var data = new FrugalState { DirectCount = directCount, Estimate = estimate, Quantile = quantile }; var result = new FrugalQuantile(data); return(result); } }