A repository to validate the correctness of matrix operations translated from MATLAB to C++ using the Eigen library. It includes example matrix computations and GoogleTest-based tests to ensure equivalence between MATLAB and C++ implementations.
- C++ compiler
- CMake version (> 3.14)
- GNU Make (Linux and MacOS only)
- Visual Studio (Windows only)
The GoogleTest framework and the Eigen library are also required, but these are installed automatically by CMake when building the project.
This project uses CMake to build the tests according to your operating system. By default, CMake will use:
- Makefiles & GNU compilers (gcc, g++) on Linux-based systems (e.g. Ubuntu)
- Makefiles & Clang compilers on MacOS
- Visual Studio solution & compilers on Windows
# Download the project
git clone https://github.com/yiquintero/matlab-to-cpp-tests.git
cd matlab-to-cpp-tests
# Configure CMake project
mkdir build
cd build
cmake .. # this command generates the Makefile & downloads Eigen and GoogleTest
# Compile the tests
make
# Run the tests
ctestLaunch Visual Studio and open the built-in Terminal using the Menu at the top of the screen (View -> Terminal). Type the following commands in the newly opened Terminal:
# Download the project
git clone https://github.com/yiquintero/matlab-to-cpp-tests.git
cd matlab-to-cpp-tests
# Configure CMake project
mkdir build
cd build
cmake .. # this command generates the Visual Studio Solution & downloads Eigen and GoogleTest
# Compile the tests
msbuild testcppvsmatlab.vcxproj
# Run the tests
ctest