public static void CreateNumericMatrix(REngine engine, int n, Stopwatch s) { double[,] d = createDoubleMatrix(n); s.Start(); var nvec = engine.CreateNumericMatrix(d); s.Stop(); }
/// <summary> /// /// </summary> /// <param name="data"></param> /// <returns></returns> public NumericMatrix RMatrix(double[,] data) { try { NumericMatrix matrix = engine.CreateNumericMatrix(data); if (matrix == null) { throw new NullReferenceException("Evaluation of matrix expression returned null"); } matrix.Protect(); return(matrix); } catch (SEHException e) { throw new ApplicationException("R Engine has thrown an Exception - memory possibly corrupted; Matrix could not be created in R.", e); } finally { ClearMemory(); } }