Ejemplo n.º 1
0
        public static Vector SolveQR(CompressedColumnStorage <double> A, Vector x, Vector b, out bool status, out string algorithm)
        {
            var orderings = new[] { CSparse.ColumnOrdering.MinimumDegreeAtA, CSparse.ColumnOrdering.MinimumDegreeAtPlusA, CSparse.ColumnOrdering.MinimumDegreeStS, CSparse.ColumnOrdering.Natural };

            status    = false;
            algorithm = "QR";
            foreach (var ordering in orderings)
            {
                try
                {
                    if (A.RowCount == A.ColumnCount)
                    {
                        var qr = new SparseQR(A, ordering);
                        var xc = x.Clone();
                        var bc = b.Clone();
                        qr.Solve(bc.ToDouble(), xc.ToDouble());
                        algorithm = "QR/" + ordering;
                        status    = true;
                        return(xc);
                    }
                }
                catch (Exception e)
                {
                    status = false;
                }
            }
            return(x);
        }
Ejemplo n.º 2
0
 public void Solve(double[] input, double[] result)
 {
     qr.Solve(input, result);
 }
Ejemplo n.º 3
0
 public void Solve(Complex[] input, Complex[] result)
 {
     qr.Solve(input, result);
 }