public void ReadFields(BinaryReader input) { var probsLength = input.ReadInt32(); _probs = new double[probsLength]; for (int i = 0; i < probsLength; i++) { _probs[i] = input.ReadDouble(); } _backpointers = new List <int[]>(); int backpointersSize = input.ReadInt32(); int stateNumber = input.ReadInt32(); for (int i = 0; i < backpointersSize; ++i) { int[] optimalStates = new int[stateNumber]; for (int j = 0; j < optimalStates.Length; ++j) { optimalStates[j] = input.ReadInt32(); } _backpointers.Add(optimalStates); } Position = input.ReadInt32(); LastLikelihood = input.ReadDouble(); int mapSize = input.ReadInt32(); var nodeMap = new BiDictionary <HmmOnlineNode, int>(); // HashBiMap.create(mapSize); for (int i = 0; i < mapSize; ++i) { HmmOnlineNode.Read(nodeMap, input); } Tree = new HmmOnlineTree(); int treeSize = input.ReadInt32(); for (int i = 0; i < treeSize; ++i) { Tree.AddLast(HmmOnlineNode.Read(nodeMap, input)); } Root = HmmOnlineNode.Read(nodeMap, input); _leaves = new HmmOnlineNode[stateNumber]; for (int i = 0; i < _leaves.Length; ++i) { _leaves[i] = HmmOnlineNode.Read(nodeMap, input); } }
private void Clear() { _probs = null; Tree = new HmmOnlineTree(); _leaves = new HmmOnlineNode[HmmData.HiddenStatesCount]; Root = null; for (int i = 0; i < HmmData.HiddenStatesCount; ++i) { var node = new HmmOnlineNode(); node.Position = 0; node.State = i; Tree.AddLast(node); _leaves[i] = node; } _backpointers = new List <int[]>(); Position = 0; LastLikelihood = Double.MinValue; }