Пример #1
0
        /// <summary>
        /// Deserialize the message (assumes magic & type already read in)
        /// </summary>
        /// <param name="cin">Cin.</param>
        public override void Deserialize(IBinaryReader cin)
        {
            IndexByName <string> rindex = null;
            IndexByName <string> cindex = null;

            var ridxlen = cin.ReadInt32();

            if (ridxlen > 0)
            {
                rindex = new IndexByName <string> ();
                for (int i = 0; i < ridxlen; i++)
                {
                    rindex.Add(cin.ReadString());
                }
            }

            var cidxlen = cin.ReadInt32();

            if (cidxlen > 0)
            {
                cindex = new IndexByName <string> ();
                for (int i = 0; i < cidxlen; i++)
                {
                    cindex.Add(cin.ReadString());
                }
            }

            var rows = cin.ReadInt32();
            var cols = cin.ReadInt32();

            Value = new IndexedMatrix(rows, cols, rindex, cindex);

            for (int ci = 0; ci < Value.ColumnCount; ci++)
            {
                for (int ri = 0; ri < Value.RowCount; ri++)
                {
                    Value[ri, ci] = cin.ReadDouble();
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Deserialize the message (assumes magic & type already read in)
        /// </summary>
        /// <param name="cin">Cin.</param>
        public override void Deserialize(IBinaryReader cin)
        {
            var ridxlen = cin.ReadInt32();
            IndexByName <string> rindex = null;

            if (ridxlen > 0)
            {
                rindex = new IndexByName <string> ();
                for (int i = 0; i < ridxlen; i++)
                {
                    rindex.Add(cin.ReadString());
                }
            }

            var count = cin.ReadInt32();

            Value = new IndexedVector(count, rindex);

            for (int i = 0; i < count; i++)
            {
                Value[i] = cin.ReadDouble();
            }
        }