Changeset 3033


Ignore:
Timestamp:
Dec 25, 2013 7:12:56 AM (6 years ago)
Author:
bradbell
Message:

eigen_mul.sh: Demonstrate way to avoid warning.
CMakeLists.txt: Change version number.

Location:
stable/20140000
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • stable/20140000/CMakeLists.txt

    r2897 r3033  
    1717
    1818# cppad_version is used by set_version.sh to get the version number.
    19 SET(cppad_version      "20130918" )
     19SET(cppad_version      "20140000.0" )
    2020SET(cppad_url          "http://www.coin-or.org/CppAD" )
    2121SET(cppad_description  "Differentiation of C++ Algorithms" )
  • stable/20140000/bug/eigen_mul.sh

    r3021 r3033  
    1717#            ^
    1818# ------------------------------------------------------------------------------
     19# bash function that echos and executes a command
     20echo_eval() {
     21        echo $*
     22        eval $*
     23}
     24# -----------------------------------------------
    1925if [ ! -e build ]
    2026then
     
    2935#include <cppad/cppad.hpp>
    3036
     37// set this flag to 1 to get a version that works without warning
     38# define USE_EVAL 0
     39
    3140int main() {
    3241        using Eigen::Matrix;
     
    3443        typedef CppAD::AD<double> AScalar;
    3544
    36         Matrix<AScalar, Dynamic, Dynamic> A2(1,1);
    37         Matrix<AScalar, Dynamic, Dynamic> B2(1,1);
     45        Matrix<AScalar, Dynamic, Dynamic> A(1,1);
     46        Matrix<AScalar, Dynamic, Dynamic> B(1,1);
     47        Matrix<AScalar, Dynamic, Dynamic> C(1,1);
     48        Matrix<AScalar, Dynamic, Dynamic> D(1,1);
    3849
    39         A2(0,0) = 1.0;
    40         B2(0,0) = 2.0;
     50        A(0,0) = 1.0;
     51        B(0,0) = 2.0;
     52        C(0,0) = 3.0;
     53# if USE_EVAL
     54        D      = A * (B * C).eval();
     55# else
     56        D      = A * (B * C);
     57# endif
    4158
    42         A2 * B2 * A2;
    43 
     59        if( D(0,0) != 6.0 )
     60        {       std::cout << "eigen_mul: Error" << std::endl;
     61                return 1;
     62        }
     63        std::cout << "eigen_mul: OK" << std::endl;
    4464        return 0;
    4565}
    4666EOF
     67if [ -e "$name" ]
     68then
     69        echo_eval rm $name
     70fi
    4771echo_eval g++ \
    4872        $name.cpp \
Note: See TracChangeset for help on using the changeset viewer.