private void ClassicSolve(out double mintime, out double maxtime, out bool Converged, out int NoOfIter) { /* * double rnk, condNo, det; * bool isPosDef; * { * MultidimensionalArray output = MultidimensionalArray.Create(1,5); * var bmc = new BatchmodeConnector(_Flav:BatchmodeConnector.Flavor.Octave, MatlabExecuteable: "d:\\cygwin64\\bin\\bash.exe"); * //var bmc = new BatchmodeConnector(_Flav: BatchmodeConnector.Flavor.Matlab); * bmc.PutSparseMatrix(this.LaplaceMtx, "Mtx"); * bmc.Cmd("condNo = condest(Mtx);"); * bmc.Cmd("rnk = rank(Mtx);"); * //bmc.Cmd("rnk = 0;"); * bmc.Cmd("[V,r]=chol(-0.5*(Mtx+Mtx'));"); * //bmc.Cmd("deti = det(Mtx);"); * bmc.Cmd("output = [condNo,rnk,0.0,4.0,r];"); * bmc.GetMatrix(output, "output"); * bmc.Execute(false); * condNo = output[0, 0]; * rnk = output[0, 1]; * det = output[0, 2]; * Debug.Assert(output[0, 3] == 4.0); * isPosDef = output[0, 4] == 0; * } * Console.WriteLine("Matrix:"); * Console.WriteLine(" size: " + this.LaplaceMtx.NoOfRows); * Console.WriteLine(" rank: " + rnk); * Console.WriteLine(" det: " + det); * Console.WriteLine(" cond. No.: {0:0.####E-00}", condNo); * Console.WriteLine(" pos. def.: " + isPosDef); */ // create sparse solver // -------------------- ISparseSolver ipSolver; { ipSolver = new ilPSP.LinSolvers.PARDISO.PARDISOSolver(); //ipSolver = new ilPSP.LinSolvers.monkey.CG(); //((ilPSP.LinSolvers.monkey.CG)ipSolver).MaxIterations = 50000; //((ilPSP.LinSolvers.monkey.CG)ipSolver).Tolerance = 1.0e-10; ipSolver.DefineMatrix(LaplaceMtx); } // call solver // ----------- mintime = double.MaxValue; maxtime = double.MinValue; SolverResult solRes = default(SolverResult); int NoOfSolverRuns = base.Control.NoOfSolverRuns; for (int i = 0; i < NoOfSolverRuns; i++) { T.Clear(); Console.WriteLine("RUN " + i + ": solving system..."); var RHSvec = RHS.CoordinateVector.ToArray(); //RHSvec.SaveToTextFile("DG" + this.T.Basis.Degree + "_RHS.txt"); BLAS.daxpy(RHSvec.Length, -1.0, this.LaplaceAffine, 1, RHSvec, 1); T.Clear(); T.InitRandom(); solRes = ipSolver.Solve(T.CoordinateVector, RHSvec); mintime = Math.Min(solRes.RunTime.TotalSeconds, mintime); maxtime = Math.Max(solRes.RunTime.TotalSeconds, maxtime); System.GC.Collect(); //T.CoordinatesAsVector.SaveToTextFile("DG" + this.T.Basis.Degree + "_SOLUTION.txt"); } Converged = solRes.Converged; NoOfIter = solRes.NoOfIterations; ipSolver.Dispose(); }