Esempio n. 1
0
        // open params from a given stream
        public void LoadParams()
        {
            Stream        str = File.OpenRead($"{saveFolder}\\params");
            XmlSerializer xs  = new XmlSerializer(typeof(ModelPrms));

            prms = (ModelPrms)xs.Deserialize(str);
            str.Close();
        }
Esempio n. 2
0
        public void Assert(ModelPrms prms)
        {
            for (int i = 0; i < dxSize; i++)
            {
                Debug.Assert(!double.IsNaN(rhs[i]), "rhs constains NaN");
            }
            for (int i = 0; i < dvalsSize; i++)
            {
                Debug.Assert(!double.IsNaN(vals[i]), "bcsr contains NaN");
            }

            csrd.Assert();
        }
Esempio n. 3
0
        public void Solve(FrameInfo cf, ModelPrms prms)
        {
            sw.Restart();

            const int check     = 0;
            const int verbosity = 0;

            int       mklMatrixType = -2; // -2 for symmetric indefinite; 11 for nonsymmetric
            int       dim           = 3;
            const int param4        = 0;

            Array.Clear(dx, 0, dx.Length);
            int mklResult = SolveDouble3(csrd.csr_cols, csrd.csr_rows, vals, csrd.N, rhs, dx, mklMatrixType, param4, dim, verbosity, check);

            if (mklResult != 0)
            {
                throw new Exception("MKL solver error");
            }

            sw.Stop();
            cf.MKLSolve += sw.ElapsedMilliseconds;
        }