Code Monkey home page Code Monkey logo

clarabel.cpp's Introduction

FeaturesInstallationLicenseDocumentation

Clarabel.cpp is a C/C++ wrapper of Clarabel.rs.

Installation

Note: The C++ interface is WIP and there might be breaking changes in future releases.

Clarabel.cpp uses CMake to generate the build system and requires the following dependencies:

  • Rust
  • Clarabel.rs (included as a submodule)
  • A compiler that supports C11 and C++11
  • Eigen (optional for the C++ interface)

You may install Eigen via the system package manager on Unix-like systems or vcpkg on Windows.

  • Follow the vcpkg instructions to compile vcpkg and add vcpkg.exe to PATH.

Ubuntu:

sudo apt install libeigen3-dev

Windows:

vcpkg install eigen3:x64-windows
  • For 32-bit platforms, use eigen3:x86-windows instead of eigen3:x64-windows.

Clone this repo

git clone --recurse-submodules https://github.com/oxfordcontrol/Clarabel.cpp.git
cd Clarabel.cpp

Build

mkdir build
cd build
cmake ..
cmake --build .

You may specify a particular build system using the -G flag for cmake (e.g. -G "Unix Makefiles").

Windows

If you are using vcpkg on Windows, you may find the vcpkg toolchain file using:

vcpkg integrate install

and then specify the vcpkg toolchain file path and target triplet to generate the build system using:

cmake .. -DCMAKE_TOOLCHAIN_FILE=VCPKG_TOOLCHAIN_PATH -DVCPKG_TARGET_TRIPLET=x64-windows

where VCPKG_TOOLCHAIN_PATH is the path to the vcpkg toolchain file.

  • For 32-bit platforms, use x86-windows instead of x64-windows.

CMake options

SDP support

To enable SDP features, set the CLARABEL_FEATURE_SDP option to one of the following values:

  • sdp-accelerate
  • sdp-netlib
  • sdp-openblas
  • sdp-mkl
  • sdp-r

By default, CLARABEL_FEATURE_SDP is none and SDP support is disabled.

Unit tests

By default, unit tests are disabled to reduce build time. To enable unit tests, set -DCLARABEL_BUILD_TESTS=true in cmake.

Release mode

The solver will build the Rust source in debug mode. To build in release mode, set -DCMAKE_BUILD_TYPE=Release in cmake.

Run examples

Examples for both C and C++ are available in examples/c and examples/cpp and can be run from the build directory using:

./examples/c/C_EXAMPLE
./examples/cpp/CPP_EXAMPLE

Usage

  • Link to the libclarabel_c_shared (shared library) or libclarabel_c_static (static library) target in CMake.
  • #include <Clarabel> in your C/C++ source files.

License 🔍

This project is licensed under the Apache License 2.0 - see the LICENSE.md file for details.

clarabel.cpp's People

Contributors

gaviny82 avatar goulart-paul avatar jwnimmer-tri avatar ghorn avatar maxschaller avatar

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.