Changeset 2333


Ignore:
Timestamp:
Apr 3, 2012 12:34:56 AM (8 years ago)
Author:
bradbell
Message:
  1. Put AD constructors in ad_ctor.hpp and assignments in ad_assing.hpp.
  2. Make new tests for this and move old tests form example to test_more.
Location:
trunk
Files:
5 added
5 deleted
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/doxyfile.sh

    r2327 r2333  
    2626echo "create bin/doxyfile.$$"
    2727cat << EOF > bin/doxyfile.$$
     28ALWAYS_DETAILED_SEC     = YES
     29BUILTIN_STL_SUPPORT     = YES
     30EXTRACT_ALL             = YES
     31EXTRACT_LOCAL_CLASSES   = NO
     32EXTRACT_PRIVATE         = YES
     33EXTRACT_STATIC          = YES
     34FILE_PATTERNS           =  *.hpp  *.cpp
     35FULL_PATH_NAMES         = NO
     36GENERATE_LATEX          = NO
     37GENERATE_TREEVIEW       = YES
     38INHERIT_DOCS            = NO
     39INLINE_INHERITED_MEMB   = YES
     40INPUT                   = ./cppad  ./cppad/local ./cppad_ipopt/src
     41MULTILINE_CPP_IS_BRIEF  = YES
     42OUTPUT_DIRECTORY        = doxydoc
    2843PROJECT_NAME            = "CppAD: A C++ Algorithmic Differentiation Package"
    2944PROJECT_NUMBER          = $version
    30 OUTPUT_DIRECTORY        = doxydoc
    31 ALWAYS_DETAILED_SEC     = YES
    32 INLINE_INHERITED_MEMB   = YES
    33 FULL_PATH_NAMES         = NO
    3445QT_AUTOBRIEF            = YES
    35 MULTILINE_CPP_IS_BRIEF  = YES
    36 INHERIT_DOCS            = NO
     46REFERENCED_BY_RELATION  = YES
     47REFERENCES_LINK_SOURCE  = NO
    3748SEPARATE_MEMBER_PAGES   = YES
    38 TAB_SIZE                = 5
    39 BUILTIN_STL_SUPPORT     = YES
    40 SUBGROUPING             = NO
    41 EXTRACT_ALL             = YES
    42 EXTRACT_PRIVATE         = YES
    43 EXTRACT_STATIC          = YES
    44 EXTRACT_LOCAL_CLASSES   = NO
     49SHOW_DIRECTORIES        = YES
    4550SHOW_INCLUDE_FILES      = NO
    4651SORT_MEMBER_DOCS        = NO
    47 SHOW_DIRECTORIES        = YES
    48 WARN_NO_PARAMDOC        = YES
    49 WARN_LOGFILE            = doxygen.err
    50 INPUT                   = ./cppad  ./cppad/local ./cppad_ipopt/src
    51 FILE_PATTERNS           =  *.hpp  *.cpp
    5252SOURCE_BROWSER          = YES
    5353STRIP_CODE_COMMENTS     = NO
    54 REFERENCED_BY_RELATION  = YES
    55 REFERENCES_LINK_SOURCE  = NO
     54SUBGROUPING             = NO
     55TAB_SIZE                = 5
    5656VERBATIM_HEADERS        = NO
    57 GENERATE_TREEVIEW       = YES
     57WARN_LOGFILE            = doxygen.err
     58WARN_NO_PARAMDOC        = YES
    5859EOF
    5960sed \
  • trunk/cppad/local/tape_link.hpp

    r2331 r2333  
    4141
    4242\param thread
    43 is the thread number
    44 \code
    45 0 <= thread == thread_alloc::thread_num()
    46 \endcode
     43is the thread number; i.e.,
     44\code
     45thread == thread_alloc::thread_num()
     46\endcode
     47If this condition is not satisfied, and \c NDEBUG is not defined,
     48a CPPAD_ASSERT_UNKNOWN is generated.
    4749
    4850\return
     
    5355inline size_t* AD<Base>::tape_id_ptr(size_t thread)
    5456{       CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;
    55         // Section 3.6.2 of the 1998 C++ standard specifies that storage for
    56         // static objects will be zero initalized.
    5757        static size_t tape_id_table[CPPAD_MAX_NUM_THREADS];
    5858        CPPAD_ASSERT_UNKNOWN( thread == thread_alloc::thread_num() );
     
    6767is the base type for this AD<Base> class.
    6868
     69
    6970\param thread
    70 is the thread number
    71 \code
    72 0 <= thread == thread_alloc::thread_num()
    73 \endcode
     71is the thread number; i.e.,
     72\code
     73thread == thread_alloc::thread_num()
     74\endcode
     75If this condition is not satisfied, and \c NDEBUG is not defined,
     76a CPPAD_ASSERT_UNKNOWN is generated.
    7477
    7578\return
     
    8083{       CPPAD_ASSERT_FIRST_CALL_NOT_PARALLEL;
    8184        static ADTape<Base>* tape_table[CPPAD_MAX_NUM_THREADS];
    82         CPPAD_ASSERT_UNKNOWN( thread < thread_alloc::num_threads() );
     85        CPPAD_ASSERT_UNKNOWN( thread == thread_alloc::thread_num() );
     86
    8387        return tape_table + thread;
    8488}
  • trunk/cppad/local/user_ad.hpp

    r2057 r2333  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    5151
    5252$childtable%
    53         cppad/local/default.hpp%
    54         cppad/local/ad_copy.hpp%
     53        cppad/local/ad_ctor.hpp%
     54        cppad/local/ad_assign.hpp%
    5555        cppad/local/convert.hpp%
    5656        cppad/local/ad_valued.hpp%
     
    6464*/
    6565
    66 # include <cppad/local/default.hpp>
    67 # include <cppad/local/ad_copy.hpp>
     66# include <cppad/local/ad_ctor.hpp>
     67# include <cppad/local/ad_assign.hpp>
    6868# include <cppad/local/convert.hpp>
    6969# include <cppad/local/vec_ad.hpp>
  • trunk/example/example.cpp

    r2312 r2333  
    5454// external complied tests
    5555extern bool abort_recording(void);
     56extern bool ad_assign(void);
     57extern bool ad_ctor(void);
    5658extern bool abs(void);
    5759extern bool Acos(void);
     
    7678extern bool CondExp(void);
    7779extern bool conj_grad(void);
    78 extern bool CopyAD(void);
    79 extern bool CopyBase(void);
    8080extern bool Cos(void);
    8181extern bool Cosh(void);
    8282extern bool CppAD_vector(void);
    83 extern bool Default(void);
    8483extern bool Div(void);
    8584extern bool DivEq(void);
    8685extern bool epsilon(void);
    87 extern bool Eq(void);
    8886extern bool EqualOpSeq(void);
    8987extern bool Erf(void);
     
    211209        // external compiled tests
    212210        ok &= Run( abort_recording,   "abort_recording"  );
     211        ok &= Run( ad_assign,         "ad_assign"        );
     212        ok &= Run( ad_ctor,           "ad_ctor"          );
    213213        ok &= Run( abs,               "abs"              );
    214214        ok &= Run( Acos,              "Acos"             );
     
    233233        ok &= Run( CondExp,           "CondExp"          );
    234234        ok &= Run( conj_grad,         "conj_grad"        );
    235         ok &= Run( CopyAD,            "CopyAD"           );
    236         ok &= Run( CopyBase,          "CopyBase"         );
    237235        ok &= Run( Cos,               "Cos"              );
    238236        ok &= Run( Cosh,              "Cosh"             );
    239237        ok &= Run( CppAD_vector,      "CppAD_vector"     );
    240         ok &= Run( Default,           "Default"          );
    241238        ok &= Run( Div,               "Div"              );
    242239        ok &= Run( DivEq,             "DivEq"            );
    243240        ok &= Run( epsilon,           "epsilon"          );
    244         ok &= Run( Eq,                "Eq"               );
    245241        ok &= Run( EqualOpSeq,        "EqualOpSeq"       );
    246242        ok &= Run( Erf,               "Erf"              );
  • trunk/example/example.vcproj

    r2312 r2333  
    183183                        </File>
    184184                        <File
     185                                RelativePath=".\ad_assign.cpp"
     186                                >
     187                        </File>
     188                        <File
     189                                RelativePath=".\ad_ctor.cpp"
     190                                >
     191                        </File>
     192                        <File
    185193                                RelativePath=".\abs.cpp"
    186194                                >
     
    273281                        </File>
    274282                        <File
    275                                 RelativePath=".\copy_ad.cpp"
    276                                 >
    277                         </File>
    278                         <File
    279                                 RelativePath=".\copy_base.cpp"
    280                                 >
    281                         </File>
    282                         <File
    283283                                RelativePath=".\cos.cpp"
    284284                                >
     
    293293                        </File>
    294294                        <File
    295                                 RelativePath=".\default.cpp"
    296                                 >
    297                         </File>
    298                         <File
    299295                                RelativePath=".\div.cpp"
    300296                                >
     
    306302                        <File
    307303                                RelativePath=".\epsilon.cpp"
    308                                 >
    309                         </File>
    310                         <File
    311                                 RelativePath=".\eq.cpp"
    312304                                >
    313305                        </File>
  • trunk/example/makefile.am

    r2312 r2333  
    6969        add.cpp \
    7070        add_eq.cpp \
     71        ad_assign.cpp \
     72        ad_ctor.cpp \
    7173        ad_fun.cpp \
    7274        ad_in_c.cpp \
     
    8991        cond_exp.cpp \
    9092        conj_grad.cpp \
    91         copy_ad.cpp \
    92         copy_base.cpp \
    9393        cos.cpp \
    9494        cosh.cpp \
    9595        cppad_vector.cpp \
    96         default.cpp \
    9796        div.cpp \
    9897        div_eq.cpp \
    9998        epsilon.cpp \
    100         eq.cpp \
    10199        equal_op_seq.cpp \
    102100        erf.cpp \
  • trunk/example/makefile.in

    r2312 r2333  
    4545am__example_SOURCES_DIST = mul_level_adolc.cpp ode_taylor_adolc.cpp \
    4646        example.cpp abort_recording.cpp abs.cpp acos.cpp add.cpp \
    47         add_eq.cpp ad_fun.cpp ad_in_c.cpp asin.cpp atan.cpp atan_2.cpp \
    48         base_adolc.hpp base_alloc.hpp base_require.cpp bender_quad.cpp \
    49         bool_fun.cpp capacity_taylor.cpp change_const.cpp \
    50         check_numeric_type.cpp check_simple_vector.cpp checkpoint.cpp \
    51         compare.cpp compare_change.cpp complex_poly.cpp cond_exp.cpp \
    52         conj_grad.cpp copy_ad.cpp copy_base.cpp cos.cpp cosh.cpp \
    53         cppad_vector.cpp default.cpp div.cpp div_eq.cpp epsilon.cpp \
    54         eq.cpp equal_op_seq.cpp erf.cpp error_handler.cpp exp.cpp \
     47        add_eq.cpp ad_assign.cpp ad_ctor.cpp ad_fun.cpp ad_in_c.cpp \
     48        asin.cpp atan.cpp atan_2.cpp base_adolc.hpp base_alloc.hpp \
     49        base_require.cpp bender_quad.cpp bool_fun.cpp \
     50        capacity_taylor.cpp change_const.cpp check_numeric_type.cpp \
     51        check_simple_vector.cpp checkpoint.cpp compare.cpp \
     52        compare_change.cpp complex_poly.cpp cond_exp.cpp conj_grad.cpp \
     53        cos.cpp cosh.cpp cppad_vector.cpp div.cpp div_eq.cpp \
     54        epsilon.cpp equal_op_seq.cpp erf.cpp error_handler.cpp exp.cpp \
    5555        for_one.cpp for_two.cpp forward.cpp for_sparse_jac.cpp \
    5656        fun_assign.cpp fun_check.cpp hes_lagrangian.cpp hes_lu_det.cpp \
     
    8080am_example_OBJECTS = $(am__objects_1) example.$(OBJEXT) \
    8181        abort_recording.$(OBJEXT) abs.$(OBJEXT) acos.$(OBJEXT) \
    82         add.$(OBJEXT) add_eq.$(OBJEXT) ad_fun.$(OBJEXT) \
    83         ad_in_c.$(OBJEXT) asin.$(OBJEXT) atan.$(OBJEXT) \
    84         atan_2.$(OBJEXT) base_require.$(OBJEXT) bender_quad.$(OBJEXT) \
     82        add.$(OBJEXT) add_eq.$(OBJEXT) ad_assign.$(OBJEXT) \
     83        ad_ctor.$(OBJEXT) ad_fun.$(OBJEXT) ad_in_c.$(OBJEXT) \
     84        asin.$(OBJEXT) atan.$(OBJEXT) atan_2.$(OBJEXT) \
     85        base_require.$(OBJEXT) bender_quad.$(OBJEXT) \
    8586        bool_fun.$(OBJEXT) capacity_taylor.$(OBJEXT) \
    8687        change_const.$(OBJEXT) check_numeric_type.$(OBJEXT) \
     
    8889        compare.$(OBJEXT) compare_change.$(OBJEXT) \
    8990        complex_poly.$(OBJEXT) cond_exp.$(OBJEXT) conj_grad.$(OBJEXT) \
    90         copy_ad.$(OBJEXT) copy_base.$(OBJEXT) cos.$(OBJEXT) \
    91         cosh.$(OBJEXT) cppad_vector.$(OBJEXT) default.$(OBJEXT) \
    92         div.$(OBJEXT) div_eq.$(OBJEXT) epsilon.$(OBJEXT) eq.$(OBJEXT) \
     91        cos.$(OBJEXT) cosh.$(OBJEXT) cppad_vector.$(OBJEXT) \
     92        div.$(OBJEXT) div_eq.$(OBJEXT) epsilon.$(OBJEXT) \
    9393        equal_op_seq.$(OBJEXT) erf.$(OBJEXT) error_handler.$(OBJEXT) \
    9494        exp.$(OBJEXT) for_one.$(OBJEXT) for_two.$(OBJEXT) \
     
    333333        add.cpp \
    334334        add_eq.cpp \
     335        ad_assign.cpp \
     336        ad_ctor.cpp \
    335337        ad_fun.cpp \
    336338        ad_in_c.cpp \
     
    353355        cond_exp.cpp \
    354356        conj_grad.cpp \
    355         copy_ad.cpp \
    356         copy_base.cpp \
    357357        cos.cpp \
    358358        cosh.cpp \
    359359        cppad_vector.cpp \
    360         default.cpp \
    361360        div.cpp \
    362361        div_eq.cpp \
    363362        epsilon.cpp \
    364         eq.cpp \
    365363        equal_op_seq.cpp \
    366364        erf.cpp \
     
    508506@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abs.Po@am__quote@
    509507@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/acos.Po@am__quote@
     508@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ad_assign.Po@am__quote@
     509@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ad_ctor.Po@am__quote@
    510510@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ad_fun.Po@am__quote@
    511511@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ad_in_c.Po@am__quote@
     
    528528@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cond_exp.Po@am__quote@
    529529@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conj_grad.Po@am__quote@
    530 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy_ad.Po@am__quote@
    531 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copy_base.Po@am__quote@
    532530@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cos.Po@am__quote@
    533531@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cosh.Po@am__quote@
    534532@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppad_vector.Po@am__quote@
    535 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default.Po@am__quote@
    536533@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div.Po@am__quote@
    537534@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/div_eq.Po@am__quote@
    538535@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epsilon.Po@am__quote@
    539 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eq.Po@am__quote@
    540536@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/equal_op_seq.Po@am__quote@
    541537@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/erf.Po@am__quote@
  • trunk/makefile.am

    r2327 r2333  
    117117        cppad/local/abs_op.hpp \
    118118        cppad/local/acos_op.hpp \
     119        cppad/local/ad_assign.hpp \
    119120        cppad/local/ad_binary.hpp \
    120         cppad/local/ad_copy.hpp \
     121        cppad/local/ad_ctor.hpp \
    121122        cppad/local/add_eq.hpp \
    122123        cppad/local/add.hpp \
     
    150151        cppad/local/csum_op.hpp \
    151152        cppad/local/declare_ad.hpp \
    152         cppad/local/default.hpp \
    153153        cppad/local/define.hpp \
    154154        cppad/local/dependent.hpp \
  • trunk/makefile.in

    r2327 r2333  
    365365        cppad/local/abs_op.hpp \
    366366        cppad/local/acos_op.hpp \
     367        cppad/local/ad_assign.hpp \
    367368        cppad/local/ad_binary.hpp \
    368         cppad/local/ad_copy.hpp \
     369        cppad/local/ad_ctor.hpp \
    369370        cppad/local/add_eq.hpp \
    370371        cppad/local/add.hpp \
     
    398399        cppad/local/csum_op.hpp \
    399400        cppad/local/declare_ad.hpp \
    400         cppad/local/default.hpp \
    401401        cppad/local/define.hpp \
    402402        cppad/local/dependent.hpp \
  • trunk/omh/example_list.omh

    r2312 r2333  
    8484$rref Add.cpp$$
    8585$rref AddEq.cpp$$
     86$rref ad_assign.cpp$$
     87$rref ad_ctor.cpp$$
    8688$rref ad_fun.cpp$$
    8789$rref ad_in_c.cpp$$
     
    105107$rref CondExp.cpp$$
    106108$rref conj_grad.cpp$$
    107 $rref CopyAD.cpp$$
    108 $rref CopyBase.cpp$$
    109109$rref Cos.cpp$$
    110110$rref Cosh.cpp$$
    111111$rref cppad_ipopt_nlp$$
    112112$rref CppAD_vector.cpp$$
    113 $rref Default.cpp$$
    114113$rref det_by_lu.cpp$$
    115114$rref det_by_minor.cpp$$
     
    118117$rref DivEq.cpp$$
    119118$rref epsilon.cpp$$
    120 $rref Eq.cpp$$
    121119$rref EqualOpSeq.cpp$$
    122120$rref Erf.cpp$$
  • trunk/omh/glossary.omh

    r1594 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-09 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    4747An object is called an AD of $italic Base$$ object its type is
    4848either $syntax%AD<%Base%>%$$
    49 (see $cref/default/Default/$$ or
    50 $cref/constructor/ad_copy/Syntax/Constructor/$$)
     49(see the default and copy $cref/constructors/ad_ctor/$$
    5150or $syntax%VecAD<%Base%>::reference%$$ (see $xref/VecAD/$$)
    5251for some $italic Base$$ type.
  • trunk/omh/whats_new_03.omh

    r2235 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    1313$begin whats_new_03$$
    1414$spell
     15        Eq.cpp
    1516        cppad.hpp
    1617        Hess
     
    358359value was left by the previous mode calculation.
    359360This has been fixed and the
    360 $xref/Eq.cpp/$$ example has been changed to test for this case.
     361$code Eq.cpp$$ example has been changed to test for this case.
    361362$pre
    362363
     
    680681$head 07-30$$
    681682The
    682 $cref/assignment/ad_copy/Syntax/Assignment/$$
     683$cref/assignment/ad_assign/$$
    683684operator was changed so the it returns a reference to
    684685the target.
     
    691692$head 07-29$$
    692693If the
    693 $cref/AD copy constructor/ad_copy/Syntax/Constructor/$$ constructor or
    694 $cref/assignment/ad_copy/Syntax/Assignment/$$ operator
     694$cref/AD copy constructor/ad_ctor/$$ constructor or
     695$cref/assignment/ad_assign/$$ operator
    695696used an
    696697$cref/independent variable/glossary/Tape/Independent Variable/$$
     
    704705was changed to include a doubly linked list of variables.
    705706This enabled  the
    706 $cref/AD copy constructor/ad_copy/Syntax/Constructor/$$ constructor and
    707 $cref/assignment/ad_copy/Syntax/Assignment/$$ operator
     707$cref/AD copy constructor/ad_ctor/$$ constructor and
     708$cref/assignment/ad_assign/$$ operator
    708709to create multiple references to
    709710the same place in the tape.
  • trunk/omh/whats_new_04.omh

    r2235 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    429429$head 06-25$$
    430430A discussion of the order dependence of the
    431 $cref/assignment/ad_copy/Syntax/Assignment/$$ operator
     431$cref/assignment/ad_assign/$$ operator
    432432and the
    433433$xref/Independent//independent function/$$
  • trunk/omh/whats_new_05.omh

    r2235 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    704704
    705705$$
    706 The copy base section was split into the $xref/Default//default/$$
     706The copy base section was split into the default
    707707constructor and the
    708708construction for the base type.
  • trunk/omh/whats_new_06.omh

    r2210 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    973973Mention the $xref/VecAD/VecAD<Base>::reference/VecAD<Base>::reference/$$ case
    974974and generally improve
    975 $xref/Value/$$, $xref/Output/$$ and $cref/assignment/ad_copy/Syntax/Assignment/$$ documentation
     975$xref/Value/$$, $xref/Output/$$ and $cref/assignment/ad_assign/$$ documentation
    976976and examples.
    977977$pre
     
    11161116$$
    11171117The documentation and examples have been improved for the following sections:
    1118 $cref/assignment/ad_copy/Syntax/Assignment/$$, $xref/UnaryPlus/$$, $xref UnaryMinus$$.
     1118$cref/assignment/ad_assign/$$, $xref/UnaryPlus/$$, $xref UnaryMinus$$.
    11191119
    11201120$head 02-11$$
    11211121The documentation and examples have been improved for the following sections:
    1122 $xref/Default/$$,
    1123 $cref/ad_copy/$$, and
     1122$cref ad_ctor$$,
     1123$cref ad_ctor$$ and $cref ad_assign$$, and
    11241124$xref/Value/$$.
    11251125
     
    11271127This is the beginning of a pass to improve the documentation:
    11281128The documentation sections
    1129 The CopyBase (formerly FromBase and now part of $cref/ad_copy/$$) and
    1130 $cref/AD copy constructor/ad_copy/Syntax/Constructor/$$
     1129The CopyBase (formerly FromBase and now part of $cref ad_ctor$$ and $cref ad_assign$$) and
     1130$cref/AD copy constructor/ad_ctor/$$
    11311131(formerly Copy) documentation has been modified.
    11321132$pre
  • trunk/omh/whats_new_07.omh

    r2197 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    602602$$
    603603This slicing has also been fixed in the
    604 $cref/assignment/ad_copy/Syntax/Assignment/$$ operation.
     604$cref/assignment/ad_assign/$$ operation.
    605605In addition, the assignment and copy operations
    606 have been grouped together in the documentation; see $cref/ad_copy/$$.
     606have been grouped together in the documentation; see $cref ad_ctor$$ and $cref ad_assign$$.
    607607
    608608
  • trunk/omh/whats_new_09.omh

    r2235 r2333  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-11 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    472472Using complex of an AD type (instead of AD of complex) was not working
    473473correctly in $cref/not_complex_ad.cpp/$$ because the
    474 $cref/default/Default/$$ constructor for an AD object has an unspecified value.
     474$cref/default constructor/ad_ctor/$$ for an AD object has an unspecified value.
    475475This has been fixed for the complex type by changing the default constructor
    476476to use value zero.
  • trunk/omh/wish_list.omh

    r2287 r2333  
    234234$index VecAD, improve assignment$$
    235235Make assignment operation in $cref/VecAD/$$ like
    236 assignment in $cref/ad_copy/$$.
     236assignment in $cref ad_ctor$$ and $cref ad_assign$$.
    237237This will fix slicing to $code int$$ when assigning
    238238from $code double$$ to
  • trunk/test_more/copy.cpp

    r1370 r2333  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-07 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    1717# include <cppad/cppad.hpp>
    1818
    19 bool Copy(void)
     19namespace { // begin empty namespace
     20
     21bool copy_older(void)
    2022{       bool ok = true;
    2123
     
    6870}
    6971
     72bool copy_ad(void)
     73{       bool ok = true;   // initialize test result flag
     74        using CppAD::AD;  // so can use AD in place of CppAD::AD
     75
     76        // domain space vector
     77        size_t n = 1;
     78        CPPAD_TEST_VECTOR< AD<double> > x(n);
     79        x[0]     = 2.;
     80
     81        // declare independent variables and start tape recording
     82        CppAD::Independent(x);
     83
     84        // create an AD<double> that does not depend on x
     85        AD<double> b = 3.;   
     86
     87        // use copy constructor
     88        AD<double> u(x[0]);   
     89        AD<double> v = b;
     90
     91        // check which are parameters
     92        ok &= Variable(u);
     93        ok &= Parameter(v);
     94
     95        // range space vector
     96        size_t m = 2;
     97        CPPAD_TEST_VECTOR< AD<double> > y(m);
     98        y[0]  = u;
     99        y[1]  = v;
     100
     101        // create f: x -> y and vectors used for derivative calculations
     102        CppAD::ADFun<double> f(x, y);
     103        CPPAD_TEST_VECTOR<double> dx(n);
     104        CPPAD_TEST_VECTOR<double> dy(m);
     105 
     106        // check parameters flags
     107        ok &= ! f.Parameter(0);
     108        ok &=   f.Parameter(1);
     109
     110        // check function values
     111        ok &= ( y[0] == 2. );
     112        ok &= ( y[1] == 3. );
     113
     114        // forward computation of partials w.r.t. x[0]
     115        dx[0] = 1.;
     116        dy    = f.Forward(1, dx);
     117        ok   &= ( dy[0] == 1. );   // du / dx
     118        ok   &= ( dy[1] == 0. );   // dv / dx
     119
     120        return ok;
     121}
     122bool copy_base(void)
     123{       bool ok = true;    // initialize test result flag
     124        using CppAD::AD;   // so can use AD in place of CppAD::AD
     125
     126        // construct directly from Base where Base is double
     127        AD<double> x(1.);
     128
     129        // construct from a type that converts to Base where Base is double
     130        AD<double> y = 2;
     131
     132        // construct from a type that converts to Base where Base = AD<double>
     133        AD< AD<double> > z(3);
     134
     135        // check that resulting objects are parameters
     136        ok &= Parameter(x);
     137        ok &= Parameter(y);
     138        ok &= Parameter(z);
     139
     140        // check values of objects (compare AD<double> with double)
     141        ok &= ( x == 1.);
     142        ok &= ( y == 2.);
     143        ok &= ( Value(z) == 3.);
     144
     145        // user constructor through the static_cast template function
     146        x   = static_cast < AD<double> >( 4 );
     147        z  = static_cast < AD< AD<double> > >( 5 );
     148
     149        ok &= ( x == 4. );
     150        ok &= ( Value(z) == 5. );
     151
     152        return ok;
     153}
     154bool default_ctor(void)
     155{       bool ok = true;
     156        using CppAD::AD;
     157
     158        // default AD constructor
     159        AD<double> x, y;
     160
     161        // check that they are parameters
     162        ok &= Parameter(x);
     163        ok &= Parameter(y);
     164
     165        // assign them values
     166        x = 3.;
     167        y = 4.;
     168
     169        // just check a simple operation
     170        ok &= (x + y == 7.);
     171
     172        return ok;
     173}
     174
    70175// END PROGRAM
     176} // end empty namespace
     177bool copy(void)
     178{       bool ok = true;
     179        ok &= copy_older();
     180        ok &= copy_ad();
     181        ok &= copy_base();
     182        ok &= default_ctor();
     183        return ok;
     184}
  • trunk/test_more/makefile.am

    r2307 r2333  
    6060        acos.cpp \
    6161        asin.cpp \
     62        assign.cpp \
    6263        add.cpp \
    6364        add_eq.cpp \
  • trunk/test_more/makefile.in

    r2307 r2333  
    4444CONFIG_CLEAN_VPATH_FILES =
    4545am__test_more_SOURCES_DIST = base_adolc.cpp alloc_openmp.cpp \
    46         test_more.cpp abs.cpp acos.cpp asin.cpp add.cpp add_eq.cpp \
    47         add_zero.cpp atan.cpp atan_2.cpp base_alloc.cpp \
     46        test_more.cpp abs.cpp acos.cpp asin.cpp assign.cpp add.cpp \
     47        add_eq.cpp add_zero.cpp atan.cpp atan_2.cpp base_alloc.cpp \
    4848        check_simple_vector.cpp compare.cpp compare_change.cpp \
    4949        cond_exp.cpp cond_exp_ad.cpp copy.cpp cos.cpp cosh.cpp \
     
    6565am_test_more_OBJECTS = $(am__objects_1) $(am__objects_2) \
    6666        test_more.$(OBJEXT) abs.$(OBJEXT) acos.$(OBJEXT) \
    67         asin.$(OBJEXT) add.$(OBJEXT) add_eq.$(OBJEXT) \
     67        asin.$(OBJEXT) assign.$(OBJEXT) add.$(OBJEXT) add_eq.$(OBJEXT) \
    6868        add_zero.$(OBJEXT) atan.$(OBJEXT) atan_2.$(OBJEXT) \
    6969        base_alloc.$(OBJEXT) check_simple_vector.$(OBJEXT) \
     
    280280        acos.cpp \
    281281        asin.cpp \
     282        assign.cpp \
    282283        add.cpp \
    283284        add_eq.cpp \
     
    404405@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc_openmp.Po@am__quote@
    405406@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Po@am__quote@
     407@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assign.Po@am__quote@
    406408@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan.Po@am__quote@
    407409@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atan_2.Po@am__quote@
  • trunk/test_more/test_more.cpp

    r2307 r2333  
    2525extern bool alloc_openmp(void);
    2626extern bool Asin(void);
     27extern bool assign(void);
    2728extern bool Atan(void);
    2829extern bool Atan2(void);
     
    3435extern bool CondExp(void);
    3536extern bool CondExpAD(void);
    36 extern bool Copy(void);
     37extern bool copy(void);
    3738extern bool Cos(void);
    3839extern bool Cosh(void);
     
    129130        ok &= Run( AddZero,         "AddZero"        );
    130131        ok &= Run( Asin,            "Asin"           );
     132        ok &= Run( assign,          "assign"         );
    131133        ok &= Run( Atan,            "Atan"           );
    132134        ok &= Run( Atan2,           "Atan2"          );
     
    137139        ok &= Run( CondExp,         "CondExp"        );
    138140        ok &= Run( CondExpAD,       "CondExpAD"      );
    139         ok &= Run( Copy,            "Copy"           );
     141        ok &= Run( copy,            "copy"           );
    140142        ok &= Run( Cos,             "Cos"            );
    141143        ok &= Run( Cosh,            "Cosh"           );
  • trunk/test_more/test_more.vcproj

    r2281 r2333  
    203203                        </File>
    204204                        <File
     205                                RelativePath=".\assign.cpp"
     206                                >
     207                        </File>
     208                        <File
    205209                                RelativePath=".\atan.cpp"
    206210                                >
Note: See TracChangeset for help on using the changeset viewer.