Index: /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/AutoDiffForDynamicalModelsTest.csproj
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/AutoDiffForDynamicalModelsTest.csproj	(revision 16225)
+++ /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/AutoDiffForDynamicalModelsTest.csproj	(revision 16225)
@@ -0,0 +1,83 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>AutoDiffForDynamicalModelsTest</RootNamespace>
+    <AssemblyName>AutoDiffForDynamicalModelsTest</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="TestCvodes.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
+      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
+      <Name>HeuristicLab.Core-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
+      <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
+      <Name>HeuristicLab.Optimization-3.3</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\HeuristicLab.Problems.DynamicalSystemsModelling\3.3\HeuristicLab.Problems.DynamicalSystemsModelling-3.3.csproj">
+      <Project>{EDCC8202-4463-4122-B01F-21B664343DFB}</Project>
+      <Name>HeuristicLab.Problems.DynamicalSystemsModelling-3.3</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
+  </Target>
+  <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
+</Project>
Index: /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/Properties/AssemblyInfo.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/Properties/AssemblyInfo.cs	(revision 16225)
+++ /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/Properties/AssemblyInfo.cs	(revision 16225)
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("AutoDiffForDynamicalModelsTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("HP Inc.")]
+[assembly: AssemblyProduct("AutoDiffForDynamicalModelsTest")]
+[assembly: AssemblyCopyright("Copyright Â© HP Inc. 2018")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("ac89ae49-1ce8-4e5c-9f27-d99f0020a593")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Index: /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/TestCvodes.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/TestCvodes.cs	(revision 16225)
+++ /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/TestCvodes.cs	(revision 16225)
@@ -0,0 +1,92 @@
+﻿using System;
+using HeuristicLab.Problems.DynamicalSystemsModelling;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace AutoDiffForDynamicalModelsTest {
+  [TestClass]
+  public class TestCvodes {
+    [TestMethod]
+    public unsafe void TestCvodesMethod() {
+      // test vectors
+      var arr = new double[] { 3.14, 2.71 };
+      var vec = Problem.N_VMake_Serial(2, arr);
+      Problem.N_VDestroy_Serial(vec);
+
+      vec = Problem.N_VNew_Serial(10);
+
+      unsafe {
+        int* content = (int*)*(int*)vec.ToPointer();
+        long length = *content;
+        Console.WriteLine(*content);
+        int own_data = *(content + 2);
+        Console.WriteLine(own_data);
+        double* data = (double*) *(content + 3);
+        double data0 = *data;
+      }
+      Problem.N_VConst_Serial(2.0, vec);
+      Problem.N_VPrint_Serial(vec);
+      Assert.AreEqual(20, Problem.N_VL1Norm_Serial(vec));
+      Problem.N_VDestroy_Serial(vec);
+
+
+      // simple temperature annealing
+      int numberOfEquations = 1;
+      var y = Problem.N_VNew_Serial(numberOfEquations);
+      Problem.N_VConst_Serial(100.0, y);
+
+      var cvode_mem = Problem.CVodeCreate(Problem.MultistepMethod.CV_ADAMS, Problem.NonlinearSolverIteration.CV_FUNCTIONAL);
+
+     var flag = Problem.CVodeInit(cvode_mem, F, 0.0, y);
+      Assert.AreEqual(Problem.CV_SUCCESS, flag);
+
+      flag = Problem.CVodeSStolerances(cvode_mem, 1E-4, 1.0);
+      Assert.AreEqual(Problem.CV_SUCCESS, flag);
+
+      var A = Problem.SUNDenseMatrix(numberOfEquations, numberOfEquations);
+      Assert.AreNotSame(A, IntPtr.Zero);
+
+
+      var linearSolver = Problem.SUNDenseLinearSolver(y, A); 
+      Assert.AreNotSame(linearSolver, IntPtr.Zero);
+
+      flag = Problem.CVDlsSetLinearSolver(cvode_mem, linearSolver, A);
+      Assert.AreEqual(Problem.CV_SUCCESS, flag);
+
+      flag = Problem.CVDlsSetJacFn(cvode_mem, JacF);
+      Assert.AreEqual(Problem.CV_SUCCESS, flag);
+
+
+      double t = 0.0;
+      double tout = 0.1; // first output time
+      int nout = 100; // number of output times
+      for (int iout = 0; iout < nout; iout++) {
+        flag = Problem.CVode(cvode_mem, tout, y, ref t, Problem.CV_NORMAL);
+        Assert.AreEqual(Problem.CV_SUCCESS, flag);
+        Console.WriteLine("t={0} y={1}", t, Problem.N_VL1Norm_Serial(y));
+        // Problem.N_VPrint_Serial(y);
+        tout += 0.1; 
+      }
+
+      Problem.N_VDestroy_Serial(y);
+      Problem.CVodeFree(cvode_mem);
+      Problem.SUNLinSolFree(linearSolver);
+      Problem.SUNMatDestroy(A);
+    }
+
+    private int JacF(double t, IntPtr y, IntPtr fy, IntPtr Jac, IntPtr user_data, IntPtr tmp1, IntPtr tmp2, IntPtr tmp3) {
+      // TODO
+      return 0;
+    }
+
+    public static int F(
+      double t, // realtype
+      IntPtr y, // N_Vector
+      IntPtr ydot, // N_Vector
+      IntPtr user_data) {
+
+      Problem.N_VScale(-0.1, y, ydot);
+      return 0;
+      ;
+    }
+  }
+}
Index: /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/packages.config
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/packages.config	(revision 16225)
+++ /branches/2925_AutoDiffForDynamicalModels/AutoDiffForDynamicalModelsTest/packages.config	(revision 16225)
@@ -0,0 +1,5 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net461" />
+  <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net461" />
+</packages>
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab 3.3.sln
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab 3.3.sln	(revision 16224)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab 3.3.sln	(revision 16225)
@@ -464,4 +464,6 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.DynamicalSystemsModelling-3.3", "HeuristicLab.Problems.DynamicalSystemsModelling\3.3\HeuristicLab.Problems.DynamicalSystemsModelling-3.3.csproj", "{EDCC8202-4463-4122-B01F-21B664343DFB}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoDiffForDynamicalModelsTest", "AutoDiffForDynamicalModelsTest\AutoDiffForDynamicalModelsTest.csproj", "{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}"
 EndProject
 Global
@@ -2263,4 +2265,16 @@
 		{EDCC8202-4463-4122-B01F-21B664343DFB}.Release|x86.ActiveCfg = Release|x86
 		{EDCC8202-4463-4122-B01F-21B664343DFB}.Release|x86.Build.0 = Release|x86
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|x64.Build.0 = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|x86.ActiveCfg = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Debug|x86.Build.0 = Debug|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|Any CPU.Build.0 = Release|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|x64.ActiveCfg = Release|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|x64.Build.0 = Release|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|x86.ActiveCfg = Release|Any CPU
+		{AC89AE49-1CE8-4E5C-9F27-D99F0020A593}.Release|x86.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/HeuristicLab.Problems.DynamicalSystemsModelling-3.3.csproj
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/HeuristicLab.Problems.DynamicalSystemsModelling-3.3.csproj	(revision 16224)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/HeuristicLab.Problems.DynamicalSystemsModelling-3.3.csproj	(revision 16225)
@@ -47,4 +47,5 @@
     <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     <Prefer32Bit>false</Prefer32Bit>
+    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -216,4 +217,12 @@
       <Install>true</Install>
     </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="sundials_cvodes.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
+    <Content Include="sundials_nvecserial.dll">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs
===================================================================
--- /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16224)
+++ /branches/2925_AutoDiffForDynamicalModels/HeuristicLab.Problems.DynamicalSystemsModelling/3.3/Problem.cs	(revision 16225)
@@ -24,4 +24,5 @@
 using System.Diagnostics;
 using System.Linq;
+using System.Runtime.InteropServices;
 using HeuristicLab.Analysis;
 using HeuristicLab.Collections;
@@ -39,4 +40,5 @@
 
 namespace HeuristicLab.Problems.DynamicalSystemsModelling {
+
   public class Vector {
     public readonly static Vector Zero = new Vector(new double[0]);
@@ -126,4 +128,237 @@
   [StorableClass]
   public sealed class Problem : SingleObjectiveBasicProblem<MultiEncoding>, IRegressionProblem, IProblemInstanceConsumer<IRegressionProblemData>, IProblemInstanceExporter<IRegressionProblemData> {
+
+    // CVODES types
+    public enum MultistepMethod : int { CV_ADAMS = 1, CV_BDF = 2 };
+    public enum NonlinearSolverIteration : int { CV_NEWTON = 1, CV_FUNCTIONAL = 2 };
+
+
+    /* itask */
+    public const int CV_NORMAL = 1;
+    public const int CV_ONE_STEP = 2;
+
+    /* ism */
+    public const int CV_SIMULTANEOUS = 1;
+    public const int CV_STAGGERED = 2;
+    public const int CV_STAGGERED1 = 3;
+
+    /* DQtype */
+    public const int CV_CENTERED = 1;
+    public const int CV_FORWARD = 2;
+
+    /* interp */
+    public const int CV_HERMITE = 1;
+    public const int CV_POLYNOMIAL = 2;
+
+    /* 
+     * ----------------------------------------
+     * CVODES return flags
+     * ----------------------------------------
+     */
+
+    public const int CV_SUCCESS = 0;
+    public const int CV_TSTOP_RETURN = 1;
+    public const int CV_ROOT_RETURN = 2;
+
+    public const int CV_WARNING = 99;
+
+    public const int CV_TOO_MUCH_WORK = -1;
+    public const int CV_TOO_MUCH_ACC = -2;
+    public const int CV_ERR_FAILURE = -3;
+    public const int CV_CONV_FAILURE = -4;
+
+    public const int CV_LINIT_FAIL = -5;
+    public const int CV_LSETUP_FAIL = -6;
+    public const int CV_LSOLVE_FAIL = -7;
+    public const int CV_RHSFUNC_FAIL = -8;
+    public const int CV_FIRST_RHSFUNC_ERR = -9;
+    public const int CV_REPTD_RHSFUNC_ERR = -10;
+    public const int CV_UNREC_RHSFUNC_ERR = -11;
+    public const int CV_RTFUNC_FAIL = -12;
+    public const int CV_CONSTR_FAIL = -13;
+
+    public const int CV_MEM_FAIL = -20;
+    public const int CV_MEM_NULL = -21;
+    public const int CV_ILL_INPUT = -22;
+    public const int CV_NO_MALLOC = -23;
+    public const int CV_BAD_K = -24;
+    public const int CV_BAD_T = -25;
+    public const int CV_BAD_DKY = -26;
+    public const int CV_TOO_CLOSE = -27;
+
+    public const int CV_NO_QUAD = -30;
+    public const int CV_QRHSFUNC_FAIL = -31;
+    public const int CV_FIRST_QRHSFUNC_ERR = -32;
+    public const int CV_REPTD_QRHSFUNC_ERR = -33;
+    public const int CV_UNREC_QRHSFUNC_ERR = -34;
+
+    public const int CV_NO_SENS = -40;
+    public const int CV_SRHSFUNC_FAIL = -41;
+    public const int CV_FIRST_SRHSFUNC_ERR = -42;
+    public const int CV_REPTD_SRHSFUNC_ERR = -43;
+    public const int CV_UNREC_SRHSFUNC_ERR = -44;
+
+    public const int CV_BAD_IS = -45;
+
+    public const int CV_NO_QUADSENS = -50;
+    public const int CV_QSRHSFUNC_FAIL = -51;
+    public const int CV_FIRST_QSRHSFUNC_ERR = -52;
+    public const int CV_REPTD_QSRHSFUNC_ERR = -53;
+    public const int CV_UNREC_QSRHSFUNC_ERR = -54;
+
+    /* 
+     * ----------------------------------------
+     * CVODEA return flags
+     * ----------------------------------------
+     */
+
+    public const int CV_NO_ADJ = -101;
+    public const int CV_NO_FWD = -102;
+    public const int CV_NO_BCK = -103;
+    public const int CV_BAD_TB0 = -104;
+    public const int CV_REIFWD_FAIL = -105;
+    public const int CV_FWD_FAIL = -106;
+    public const int CV_GETY_BADT = -107;
+
+    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+    public delegate int CVRhsFunc(
+        double t, // realtype
+        IntPtr y, // N_Vector
+        IntPtr ydot, // N_Vector
+        IntPtr user_data
+      );
+
+    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+    public delegate int CVDlsJacFunc(
+      double t,
+      IntPtr y, // N_Vector
+      IntPtr fy, // N_Vector
+      IntPtr Jac, // SUNMatrix
+      IntPtr user_data,
+      IntPtr tmp1, // N_Vector
+      IntPtr tmp2, // N_Vector
+      IntPtr tmp3 // N_Vector
+      );
+
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVodeCreate", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    // returns a void* to the cvodes memory block if successful otherwise NULL
+    public static extern IntPtr CVodeCreate(MultistepMethod lmm, NonlinearSolverIteration iter);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVodeInit", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+
+    public static extern int CVodeInit(
+      IntPtr cvode_mem, // pointer returned by CVodeCreate
+      CVRhsFunc f,
+      double t0, // realtype, the inital value of t
+      IntPtr y0 // N_Vector the initial value of y
+    );
+
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVodeSStolerances", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int CVodeSStolerances(
+      IntPtr cvode_mem, 
+      double reltol, 
+      double abstol
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVDlsSetLinearSolver", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int CVDlsSetLinearSolver(
+      IntPtr cvode_mem,
+      IntPtr linearSolver, // SUNLinearSolver
+      IntPtr j // SUNMatrix
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVDlsSetJacFn", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int CVDlsSetJacFn(
+      IntPtr cvode_mem, 
+      CVDlsJacFunc jacFunc
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVode", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int CVode(
+      IntPtr cvode_mem,
+      double tout, // next time at which a solution is desired
+      IntPtr yout, // N_Vector
+      ref double tret, // the time reached by the solver (output)
+      int itask // flag indicating the job of the solver for the next step. 
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "CVodeFree", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+
+    public static extern int CVodeFree(IntPtr cvode_mem);
+
+    #region matrix
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNDenseMatrix", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern IntPtr SUNDenseMatrix(long m, long n);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNMatDestroy", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern void SUNMatDestroy(IntPtr A);
+    #endregion
+
+    #region linear solver
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNDenseLinearSolver", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern IntPtr SUNDenseLinearSolver(
+      IntPtr y, // N_Vector
+      IntPtr A // SUNMatrix
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNLinSolInitialize", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int SUNLinSolInitialize(IntPtr linearSolver);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNLinSolSetup", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int SUNLinSolSetup(
+      IntPtr linearSolver, 
+      IntPtr A // SUNMatrix
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNLinSolSolve", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int SUNLinSolSolve(
+      IntPtr linearSolver,
+      IntPtr A, // SUNMatrix
+      IntPtr x, // N_Vector
+      IntPtr b, // N_Vector
+      double tol
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "SUNLinSolFree", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern int SUNLinSolFree(IntPtr linearSolver);
+
+    #endregion
+
+    #region N_Vector
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VNew_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern IntPtr N_VNew_Serial(long vec_length);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VDestroy_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern void N_VDestroy_Serial(IntPtr vec);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VPrint_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern void N_VPrint_Serial(IntPtr vec);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VConst_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern void N_VConst_Serial(double c, IntPtr vec);
+
+    
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VL1Norm_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern double N_VL1Norm_Serial(IntPtr vec);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VMake_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public static extern IntPtr N_VMake_Serial(long vec_length, double[] v_data);
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VScale", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    ///  Performs the operation z = c*x
+    public static extern void N_VScale(double s,
+      IntPtr x, // N_Vector
+      IntPtr z // N_Vector
+      );
+
+    [DllImport("sundials_cvodes.dll", EntryPoint = "N_VMake_Serial", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
+    public unsafe static extern double* N_VGetArrayPointer_Serial(IntPtr vec);
+    #endregion
+
+
+
+
 
     #region parameter names
