public double[] Compute(double[] inputs) { double[] res = new double[this.OutputsCount]; double[] topass = new double[this.InputsCount]; for (int i = 0; i < topass.Length; ++i) { if (i < inputs.Length) { topass[i] = inputs[i]; } else { topass[i] = 0.0; } } IntPtr arr = Marshal.AllocHGlobal(topass.Length * sizeof(double)); Marshal.Copy(topass, 0, arr, topass.Length); try { CNeuroNetWrapperFunctions.__InitInputs(_cnet, arr); } catch (System.Exception ex) { throw new Exception("Error during initialization", ex); } finally { Marshal.FreeHGlobal(arr); } IntPtr cres = CNeuroNetWrapperFunctions.__Compute(_cnet); Marshal.Copy(cres, res, 0, res.Length); Marshal.FreeHGlobal(cres); return(res); }