PrevNext

Example Conversion of Matlab or Octave to C++ using Ublas

Purpose
The purpose of this package is to provide an example of converting Matlab or Octave to C++ with the aid of ublas .

Test and Install
  1. Download the source code
     
         git clone https://github.com/bradbell/mat2cpp.git mat2cpp.git
    
  2. Build the library and test program with the command
         cd mat2cpp.git
         mkdir build
         cd build
         ../configure --prefix=
    prefix_dir BOOST_DIR=boost_dir
         make
    where prefix is the prefix for this installation and boost_dir prefix for the existing boost install (check that the directory boost_dir/include/boost exists).
  3. Test the installation of the Matlab and Octave files with the commands
     
         cd mat
         octave mat2cpp_ok
         cd ..
    
    The mat2cpp_ok program should have responded that all the octave tests passed (you can also run the program in Matlab).
  4. Test the installation of the C++ files with the commands
     
         build/cpp/mat2cpp_ok
    
    The mat2cpp_ok program should have responded that all the tests passed. (you can also run the program in Matlab).
  5. Install the mat2cpp library and include file in the standard locations with the following commands
     
         cd build
         make install
         cd ..
    
  6. Compile and run the getstarted example with the following commands:
         cd build
         g++ ../cpp/getstarted.cpp -o getstarted \
              -I
    boost_dir/include \
              -I
    prefix_dir/include \
              -L
    prefix_dir/lib \
              -lmat2cpp -llapack
         ./getstarted

mat2cpp.hpp
The include file mat2cpp.hpp includes the C++ header file matrix.hpp . It then declares some library routines for that aid in converting from the Matlab or Octave languages to C++.

Contents
Table of Contents
The mat2cpp Software License
Getting Started
Operations That Have Conversions
The Matlab or Octave to C++ Using Ublas Include File
Run Matlab or Octave Version of Examples
Run C++ Version of Examples
The mat2cpp News file
Adding a New Routine to the Mat2cpp Library
C++ Marsaglia Zaman Tsang Uniform Random Number Generator
Alphabetic Listing of Cross Reference Tags
Keyword Index
Search This Web Site
External Internet References

Input File: doc.omh