Giter VIP home page Giter VIP logo

mode's Introduction

MODE

MODE: A modern ordinary differential equation solver for C++ and CUDA.

Requirements

  • CMake 3.12+

Getting Started

  • Clone the repository.
  • Run bootstrap.[bat|sh]. This will install Doctest and Eigen, and build the project under the ./build directory.
  • Optional: Run cmake on the ./build directory.
    • Toggle MODE_BUILD_TESTS to build the tests.
    • Toggle MODE_USE_EIGEN to enable implicit method support.
    • Remember to generate or run bootstrap.[bat|sh] after changes. You can ignore the cmake developer errors as long as generation is successful.
  • Alternative:
    • MODE is header-only, so you can copy the headers into your project rather than using the cmake build process.

Example usage: Lorenz system

#include <mode/mode.hpp>

using problem_type   = mode::initial_value_problem<float, Eigen::Vector3f>;
using method_type    = mode::explicit_multi_stage_method<mode::butcher_tableau::runge_kutta_4<float>, problem_type>;

std::int32_t main(std::int32_t argc, char** argv)
{
  const auto problem   = problem_type
  {
      0.0f,                                         /* t0 */
      Eigen::Vector3f(1.0f, 1.0f, 1.0f),            /* y0 */
      [&] (const float t, const Eigen::Vector3f& y) /* y' = f(t, y) */
      {
      constexpr auto sigma = 10.0f;
      constexpr auto rho   = 28.0f;
      constexpr auto beta  = 8.0f / 3.0f;
      return Eigen::Vector3f(sigma * (y[1] - y[0]), y[0] * (rho - y[2]) - y[1], y[0] * y[1] - beta * y[2]);
      }
  };
  
  auto iterator = mode::fixed_step_size_iterator<method_type>(problem, 0.01f /* h */);
  for (auto i = 0; i < 1000; ++i)
      ++iterator;

  return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.