示例#1
0
        public TagDistrTable(int numOfDimensions, double binWidth, double minValue, double maxValue, TagT[] tags)
        {
            Preconditions.CheckNotNull(tags);
            Preconditions.CheckArgumentRange(tags.Length > 1);
            NumOfDimensions = numOfDimensions;
            BinWidth        = binWidth;
            MinValue        = minValue;
            MaxValue        = maxValue;
            Tags            = tags;

            mTagCounts  = new BinTable <int> [Tags.Length];
            mTagDistrs  = new BinTable <double> [Tags.Length];
            mTagIndexes = Tags.Select((t, i) => new { t, i }).ToDictionary(ti => ti.t, ti => ti.i);

            for (int i = 0; i < mTagCounts.Length; i++)
            {
                mTagCounts[i] = new BinTable <int>(NumOfDimensions, BinWidth, MinValue, MaxValue);
                mTagDistrs[i] = new BinTable <double>(NumOfDimensions, BinWidth, MinValue, MaxValue);
            }
        }
示例#2
0
 public void Load(BinarySerializer reader)
 {
     NumOfDimensions = reader.ReadInt();
     BinWidth        = reader.ReadDouble();
     MinValue        = reader.ReadDouble();
     MaxValue        = reader.ReadDouble();
     Tags            = new TagT[reader.ReadInt()];
     for (int i = 0; i < Tags.Length; i++)
     {
         Tags[i] = reader.ReadObject <TagT>();
     }
     mTagCounts = new BinTable <int> [reader.ReadInt()];
     for (int i = 0; i < mTagCounts.Length; i++)
     {
         mTagCounts[i] = new BinTable <int>(reader);
     }
     mTagDistrs = new BinTable <double> [reader.ReadInt()];
     for (int i = 0; i < mTagDistrs.Length; i++)
     {
         mTagDistrs[i] = new BinTable <double>(reader);
     }
     mTagIndexes = reader.LoadDictionary <TagT, int>();
 }