示例#1
0
        /// <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();
            }
        }