public static List <Matrix> ReadMatrixListFromFile(string filename, int dyadicVariable) { if (filename == null) { throw new ArgumentNullException("filename"); } BufferedFileReader reader = BufferedFileTable.GetFile(filename); int numIds = reader.CountNetworkIds(); List <Matrix> mlist = new List <Matrix>(); Matrix temp; lock (reader) { switch (reader.FileType) { case BufferedFileReader.Type.Matrix: { for (int i = 0; i < numIds; i++) { temp = ReadMatrixFromMatrixFile(reader, i); mlist.Add(temp); } return(mlist); } case BufferedFileReader.Type.Dyadic: { for (int i = 0; i < numIds; i++) { temp = ReadMatrixFromDyadicFile(reader, i, dyadicVariable); mlist.Add(temp); } return(mlist); } case BufferedFileReader.Type.Vector: { for (int i = 0; i < numIds; i++) { temp = ReadMatrixFromVectorFile(reader, i); mlist.Add(temp); } return(mlist); } default: throw new FileLoadException("Invalid file type."); } } }