Example #1
0
 public static T Deserialize <T>(string filename, int?ver)
 {
     object[] objs;
     HDebug.Verify(_Deserialize(filename, ver, out objs));
     HDebug.Assert(objs.Length == 1);
     return((T)objs[0]);
 }
Example #2
0
        public static void NamedLockRelease(string name)
        {
            HDebug.Assert(_NamedLocks.ContainsKey(name) == false);
            Mutex mutex = _NamedLocks[name];

            try
            {
                mutex.ReleaseMutex();
            }
            catch (AbandonedMutexException)
            {
                HDebug.Assert(false);
            }
            HDebug.Verify(_NamedLocks.Remove(name));
        }
Example #3
0
            public static Graph <NODE, EDGE> BuildMST(Graph <NODE, EDGE> graph, Func <Edge, double> edgecost)
            {
                Func <Graph.Edge, double> fnedgecost = delegate(Graph.Edge edge)
                {
                    return(edgecost((Edge)edge));
                };
                Graph <Graph.Node, Graph.Edge> mst  = Graph.Kruskal.BuildMST(graph.graph, fnedgecost);
                Graph <NODE, EDGE>             mst2 = new Graph <NODE, EDGE>();

                foreach (Graph.Node node in mst.GetNodeValues())
                {
                    NODE nodeval = graph.GetNodeValue((Node)node);
                    HDebug.Verify(mst2.AddNode(nodeval) != null);
                }
                foreach (Graph.Edge edge in mst.GetEdgeValues())
                {
                    EDGE edgeval = ((Edge)edge).value;
                    Node node0 = (Node)edge.nodes[0]; NODE nodeval0 = graph.GetNodeValue(node0); HDebug.Assert(mst2.GetNode(nodeval0) != null);
                    Node node1 = (Node)edge.nodes[1]; NODE nodeval1 = graph.GetNodeValue(node1); HDebug.Assert(mst2.GetNode(nodeval1) != null);
                    HDebug.Verify(mst2.AddEdge(nodeval0, nodeval1, edgeval) != null);
                }
                return(mst2);
            }
Example #4
0
 public static double Corr(Vector vec1, Vector vec2)
 {
     double corr; HDebug.Verify(solver.CorrImpl(vec1, vec2, out corr)); return(corr);
 }
Example #5
0
 public static Matrix Pinv(Matrix mat, InfoPack extra = null)
 {
     Matrix pinv; HDebug.Verify(solver.PinvImpl(mat, out pinv, extra)); return(pinv);
 }
Example #6
0
 public static int Rank(Matrix mat)
 {
     int rank; HDebug.Verify(solver.RankImpl(mat, out rank)); return(rank);
 }
Example #7
0
        public static Matrix InvEig(Matrix mat, double?thresEigval, int?numZeroEigval, InfoPack extra = null)
        {
            Matrix inv;

            HDebug.Verify(solver.InvEigImpl(mat, thresEigval, numZeroEigval, out inv, extra)); return(inv);
        }