Ejemplo n.º 1
0
        private void GetG()
        {
            GeneratorSet g = new GeneratorSet(new IaNode {
                Name = "G"
            }, b);

            for (int di = 0; di < var_n; di++)
            {
                long d;
                int  r;
                r = b.Reduction(A[di][di], out d);

                long[] li = new long[var_n];
                li[di] = (1L << var_w - r);

                long[] xi = b.MatrixMultiVector(T, li, var_m);

                g.AddVector(new LeadVector(xi));
            }
            g.Print();
        }
Ejemplo n.º 2
0
        private Queue <NodeVector> VariableGeneratorSets(ProgramAst prg)
        {
            Queue <NodeVector> w_queue = new Queue <NodeVector>();
            IaNode             main    = prg.Graph["main"];

            main.GeneratorSet = new GeneratorSet(main, bg);

            Queue <NodeVector> vq = new Queue <NodeVector>();

            prg.VarGraph.GeneratorSet = new GeneratorSet(prg.VarGraph, bg);
            AddIdentityVectors(vq, prg.VarGraph);

            while (vq.Count > 0)
            {
                NodeVector pair = vq.Dequeue();

                IaNode from = pair.Node;
                if (from.Edges.Count() > 0)
                {
                    foreach (IaEdge edge in from.Edges)
                    {
                        IaNode to = edge.To;

                        foreach (long[][] a_mtx in edge.MatrixSet.TMatrixes)
                        {
                            long[]     xi = bg.MatrixMultiVector(a_mtx, pair.Vector.Vr, bg.var_m);
                            LeadVector x  = new LeadVector(xi);
                            if (x.Lidx >= 0)
                            {
                                if (to.GeneratorSet == null)
                                {
                                    to.GeneratorSet = new GeneratorSet(to, bg);
                                }

                                if (to.GeneratorSet.AddVector(x))
                                {
                                    if (printG)
                                    {
                                        to.GeneratorSet.Print();
                                    }

                                    vq.Enqueue(new NodeVector {
                                        Node = to, Vector = x
                                    });
                                }
                            }
                        }
                    }
                }
                else
                {
                    // konec definice promennych
                    main.GeneratorSet.AddVector(pair.Vector);
                    w_queue.Enqueue(new NodeVector {
                        Node = main, Vector = pair.Vector
                    });
                }
            }

            return(w_queue);
        }