Exemplo n.º 1
0
 public static void RegisterMathLinkFactory
     (string dir_ml64_dll = @"C:\Program Files\Wolfram Research\Mathematica\11.3\SystemFiles\Links\MathLink\DeveloperKit\Windows-x86-64\SystemAdditions\"
     )
 {
     HMathLinkFactory.RegisterMathLinkFactory
         (dir_ml64_dll
         );
 }
Exemplo n.º 2
0
        public static KernelLinkDelegate CreateKernelLinkDelegate()
        {
            IKernelLink ml = HMathLinkFactory.CreateKernelLink();

            ml.WaitAndDiscardAnswer();
            return(new KernelLinkDelegate
            {
                ml = ml,
            });
        }
Exemplo n.º 3
0
        public static T Evaluate <T>(string evaluate, Func <IKernelLink, T> GetT)
        {
            IKernelLink ml = HMathLinkFactory.CreateKernelLink();

            ml.WaitAndDiscardAnswer();
            ml.Evaluate(evaluate);
            ml.WaitForAnswer();

            T result;

            try
            {
                result = GetT(ml);
                //result = ml.GetDoubleArray();
                //result = ml.GetObject();
            }
            catch
            {
                result = default(T);
                //result = null;
            }
            ml.Close();
            return(result);
        }