示例#1
0
 public static SMatrix Restore(string filePath)
 {
     using (Stream stream = File.Open(filePath, FileMode.Open))
     {
         using (var binReader = new BinaryReader(stream))
         {
             int      n       = binReader.ReadInt32();
             int      nmax    = binReader.ReadInt32();
             int      size    = nmax * (nmax + 1) / 2;
             byte[]   byteBuf = binReader.ReadBytes(size * sizeof(double));
             double[] d       = new double[size];
             Buffer.BlockCopy(byteBuf, 0, d, 0, byteBuf.Length);
             var m = new SPDMatrix(d, n, nmax);
             return(m);
         }
     }
 }