Changeset 3214


Ignore:
Timestamp:
Mar 18, 2014 4:50:38 PM (6 years ago)
Author:
bradbell
Message:

merge in mul_dir branch except for multiple direcitons specific part:

check_include_omh.sh: ignore junk files.
search.sh: include compare_c directory, simplify.
whats_new_14.omh: change dates and contect from mul_dir to trunk.
svn_merge.sh: add --accept thiers-full option.

Location:
trunk
Files:
7 deleted
55 edited
7 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/bin/check_include_omh.sh

    r2792 r3214  
    3232                -e '/.\/new\//d' \
    3333                -e '/.\/doc\//d' \
     34                -e '/.\/junk$/d' \
     35                -e '/.\/junk\./d' \
    3436                -e 's|./||' \
    3537                > bin/check_include_omh.1.$$
  • trunk/bin/check_replace.sh

    r2997 r3214  
    22# $Id$
    33# -----------------------------------------------------------------------------
    4 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     4# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    55#
    66# CppAD is distributed under multiple licenses. This distribution is under
     
    1616        exit 1
    1717fi
    18 # -----------------------------------------------------------------------------
    19 pattern='<!-- define'
    20 extensions='.cpp .hpp'
    21 directories='cppad cppad/local'
    22 list=`find_files.sh "$pattern" "$extensions" "$directories"`
    23 echo '------------------------------------------------------------------------'
    24 echo 'check replacement text in following files:'
    25 for file in $list
    26 do
    27         echo "$file"
    28         bin/replace_html.py $file $file.rep
    29         if ! diff $file $file.rep > /dev/null
     18check_replace() {
     19        define_file="cppad/local/$1"
     20        replace_file="cppad/local/$2"
     21        new_file="cppad/local/$2.$$"
     22        bin/replace_html.py $define_file $replace_file $new_file
     23        if ! diff $replace_file $new_file > /dev/null
    3024        then
    3125                cat << EOF
    32 check_replace.sh: Error: The replacement text in $file
    33 does not match its replacement commands; see
    34         diff $file $file.rep
     26check_replace.sh: Error:
     27The replacement text in $replace_file
     28does not match its definition in $define_file.
     29Execute the following command to fix this:
     30        mv $new_file $replace_file
    3531EOF
    3632                exit 1
    3733        fi
    38         rm $file.rep
    39 done
    40 echo '------------------------------------------------------------------------'
     34        rm $new_file
     35}
     36# -----------------------------------------------------------------------------
     37# files with definitions and replacemnet in same file
     38check_replace cond_op.hpp       cond_op.hpp
     39check_replace load_op.hpp       load_op.hpp
     40check_replace store_op.hpp      store_op.hpp
     41check_replace optimize.hpp      optimize.hpp
     42check_replace forward0sweep.hpp forward1sweep.hpp
     43# -----------------------------------------------------------------------------
     44echo "replace_html.sh: OK"
    4145exit 0
  • trunk/bin/commit.sh

    r3056 r3214  
    8080# check for abort do to unknown files
    8181unknown=`svn status | sed -n -e '/^[?]/p' | \
    82         sed -e 's/^[?]//' -e "/bin\/commit.*.$$/d"`
     82        sed -e 's/^[?]//' -e "/bin\/commit.*.$$/d" -e '/\/new$/d'`
    8383msg="aborting because the following files are unknown to svn"
    8484print_msg="no"
  • trunk/bin/replace_html.py

    r3102 r3214  
    1919        sys.exit(msg)
    2020#
    21 usage = '''\nusage: replace_html.py old_file new_file
    22 where old_file is the path to the file with html text that is to be replaced
    23 and new_file is the new_file that will be created.
     21usage = '''\nusage: replace_html.py define_file replace_file new_file where
    2422
    25 Each set of replacement text is defined in the file by
     23define_file:  contains the define commands
     24replace_file: contains the replace commands (many be same as define_file)
     25new_file:     is a copy of replace file with the replacements. 
     26
     27The definitions are specified by:
    2628        <!-- define name -->source<!-- end name -->
    27 where name is any unique name, with no spaces ' '
    28 for the replacement text source and source can be any text.
     29where name is any unique name, with no spaces ' ', for the replacement text
     30and source is the replacement text.
    2931
    30 The destination, where the replacement text is placed, is specified by
     32The replacement positions are specified by:
    3133        <!-- replace name -->desination<!-- end name -->
    3234where name refers to a defined replacement text and destination
     
    3436'''
    3537narg = len(sys.argv)
    36 if narg != 3 :
    37         msg = '\nExpected 2 but found ' + str(narg-1) + ' command line arguments.'
     38if narg != 4 :
     39        msg = '\nExpected 3 but found ' + str(narg-1) + ' command line arguments.'
    3840        sys.exit(usage + msg)
    39 old_file = sys.argv[1]
    40 new_file = sys.argv[2]
     41define_file  = sys.argv[1]
     42replace_file = sys.argv[2]
     43new_file     = sys.argv[3]
    4144# -----------------------------------------------------------------------------
    42 if not os.path.exists(old_file) :
    43         msg = 'bin/replace_html.py: cannot find old_file = ' + old_file
     45if not os.path.exists(define_file) :
     46        msg = 'bin/replace_html.py: cannot find define_file = ' + define_file
     47        sys.exit(msg)
     48if not os.path.exists(replace_file) :
     49        msg = 'bin/replace_html.py: cannot find replace_file = ' + replace_file
    4450        sys.exit(msg)
    4551if os.path.exists(new_file) :
    4652        msg = 'bin/replace_html.py: cannot overwrite new_file ' + new_file
    4753        sys.exit(msg)
    48 f_in    = open(old_file, 'rb')
    49 data_in = f_in.read()
     54f_in        = open(define_file, 'rb')
     55define_data = f_in.read()
     56f_in.close()
     57f_in         = open(replace_file, 'rb')
     58replace_data = f_in.read()
    5059f_in.close()
    5160# -----------------------------------------------------------------------------
     
    5564p_end     = re.compile('<!-- end ([^ ]*) -->')
    5665start     = 0
    57 while start < len(data_in) :
    58         rest         = data_in[start : ]
     66while start < len(define_data) :
     67        rest         = define_data[start : ]
    5968        next_define  = p_define.search(rest)
    6069        if next_define == None :
    61                 start = len(data_in)
     70                start = len(define_data)
    6271        else :
    6372                name         = next_define.group(1)
    6473                if name in define :
    65                         msg  = 'bin/replace_html.py: file = ' + file_path
     74                        msg  = 'bin/replace_html.py: file = ' + define_file
    6675                        msg += '\ncontains two defintions for name = ' + name
    6776                        sys.exit(msg)
     
    7382                start       += next_define.end() + next_end.end()
    7483                if name != next_end.group(1) :
    75                         msg  = 'bin/replace_html.py: file = ' + file_path
     84                        msg  = 'bin/replace_html.py: file = ' + define_file
    7685                        msg += '\ndefine name = ' + name
    7786                        msg += ', end name = ' + next_end.group(1)
    7887                        sys.exit(msg)
    7988# -----------------------------------------------------------------------------
    80 # create data_out: a string with the replacements made
    81 data_out  = ''
     89# create new_data: a string with the replacements made
     90new_data  = ''
    8291p_replace = re.compile('<!-- replace ([^ ]*) -->')
    8392start     = 0
    84 while start < len(data_in) :
    85         rest          = data_in[start : ]
     93while start < len(replace_data) :
     94        rest          = replace_data[start : ]
    8695        next_replace  = p_replace.search(rest)
    8796        if next_replace == None :
    88                 data_out += rest
    89                 start     = len(data_in)
     97                new_data += rest
     98                start     = len(replace_data)
    9099        else :
    91100                name      = next_replace.group(1)
    92101                if name not in define :
    93                         msg  = 'bin/replace_html.py: file = ' + file_path
     102                        msg  = 'bin/replace_html.py: file = ' + define_file
    94103                        msg += '\ncontains no defintions for name = ' + name
    95104                        sys.exit(msg)
    96                 data_out    += rest[0 : next_replace.end() ]
    97                 data_out    += define[name]
     105                new_data    += rest[0 : next_replace.end() ]
     106                new_data    += define[name]
    98107                #
    99108                rest         = rest[ next_replace.end() : ]
    100109                next_end     = p_end.search(rest)
    101                 data_out    += rest[ next_end.start() : next_end.end() ]
     110                new_data    += rest[ next_end.start() : next_end.end() ]
    102111                start       += next_replace.end() + next_end.end()
    103112                if name != next_end.group(1) :
    104                         msg  = 'bin/replace_html.py: file = ' + file_path
     113                        msg  = 'bin/replace_html.py: file = ' + replace_file
    105114                        msg += '\nreplace name = ' + name
    106115                        msg += ', end name = ' + next_end.group(1)
     
    108117# -----------------------------------------------------------------------------
    109118f_out    = open(new_file, 'wb')
    110 f_out.write(data_out)
     119f_out.write(new_data)
    111120f_out.close()
    112121# -----------------------------------------------------------------------------
  • trunk/bin/svn_merge.sh

    r2991 r3214  
    3333#
    3434# Name of the directory where the changes have been committed
    35 from_branch='branches/opt_cond_exp'
     35from_branch='branches/mul_dir'
    3636#
    3737# Version of the repository corresponding to from_branch just before changes
    38 Start=2952
     38Start=3175
    3939#
    4040# Version of the repository corresponding to from_branch after the changes
    41 End=2990
     41End=3213
    4242#
    4343# the svn merge command
    44 cmd="svn merge $DryRun -r $Start:$End $repository/$from_branch"
     44cmd="svn merge  --accept theirs-full $DryRun -r $Start:$End $repository/$from_branch"
    4545echo "$cmd"
    4646$cmd
  • trunk/cppad/local/ad_fun.hpp

    r3165 r3214  
    8585        size_t compare_change_;
    8686
    87         /// number of taylor_ coefficieint per variable (currently stored)
    88         size_t taylor_per_var_;
    89 
    90         /// number of columns currently allocated for taylor_ array
    91         size_t taylor_col_dim_;
    92 
    93         /// number of rows (variables) in the recording (play_)
    94         size_t total_num_var_;
     87        /// number of orders stored in taylor_
     88        size_t num_order_taylor_;
     89
     90        /// maximum number of orders that will fit in taylor_
     91        size_t cap_order_taylor_;
     92
     93        /// number of variables in the recording (play_)
     94        size_t num_var_tape_;
    9595
    9696        /// tape address for the independent variables
     
    102102        /// which dependent variables are actually parameters
    103103        CppAD::vector<bool>   dep_parameter_;
    104 
    105         /// the operation sequence corresponding to this object
    106         player<Base> play_;
    107104
    108105        /// results of the forward mode calculations
     
    116113        /// (if zero, the operation corresponds to a parameter).
    117114        pod_vector<addr_t> load_op_;
     115
     116        /// the operation sequence corresponding to this object
     117        player<Base> play_;
    118118
    119119        /// Packed results of the forward mode Jacobian sparsity calculations.
     
    238238        /// copy constructor
    239239        ADFun(const ADFun& g)
    240         : total_num_var_(0)
     240        : num_var_tape_(0)
    241241        {       CppAD::ErrorHandler::Call(
    242242                true,
     
    277277        /// forward mode sweep
    278278        template <typename VectorBase>
    279         VectorBase Forward(
    280                 size_t p, const VectorBase& x, std::ostream& s = std::cout);
     279        VectorBase Forward(size_t q,
     280                const VectorBase& x, std::ostream& s = std::cout
     281        );
    281282
    282283        /// reverse mode sweep
     
    346347        {       return play_.num_par_rec(); }
    347348
    348         /// number of taylor_ coefficients currently calculated (per variable)
    349         size_t size_taylor(void) const
    350         {       return taylor_per_var_; }
     349        /// number taylor coefficient orders calculated
     350        size_t size_order(void) const
     351        {       return num_order_taylor_; }
    351352
    352353        /// number of characters in the operation sequence
     
    356357        /// number of variables in opertion sequence
    357358        size_t size_var(void) const
    358         {       return total_num_var_; }
     359        {       return num_var_tape_; }
    359360
    360361        /// number of VecAD indices in the operation sequence
     
    362363        {       return play_.num_vec_ind_rec(); }
    363364
    364         /// set number of coefficients currently allocated (per variable)
    365         void capacity_taylor(size_t per_var);   
     365        /// set number of orders and directions currently allocated
     366        void capacity_order(size_t c);   
    366367
    367368        /// number of variables in conditional expressions that can be skipped
     
    488489        void Dependent(const ADvector &y);
    489490
    490         /// deprecated: number of variables in opertion sequence
     491        /// Deprecated: number of variables in opertion sequence
    491492        size_t Size(void) const
    492         {       return total_num_var_; }
    493 
    494         /// deprecated: # taylor_ coefficients currently stored (per variable)
     493        {       return num_var_tape_; }
     494
     495        /// Deprecated: # taylor_ coefficients currently stored
     496        /// (per variable,direction)
    495497        size_t Order(void) const
    496         {       return taylor_per_var_ - 1; }
     498        {       return num_order_taylor_ - 1; }
    497499
    498500        /// Deprecated: amount of memory for this object
    499501        /// Note that an approximation is used for the std::set<size_t> memory
    500502        size_t Memory(void) const
    501         {       size_t pervar  = taylor_col_dim_ * sizeof(Base)
     503        {       size_t pervar  = cap_order_taylor_ * sizeof(Base)
    502504                + for_jac_sparse_pack_.memory()
    503505                + 3 * sizeof(size_t) * for_jac_sparse_set_.number_elements();
    504                 size_t total   = total_num_var_ * pervar + play_.Memory();
     506                size_t total   = num_var_tape_ * pervar + play_.Memory();
    505507                return total;
    506508        }
    507509
    508         /// deprecated: # taylor_ coefficients stored (per variable)
     510        /// Deprecated: # taylor_ coefficient orderss stored
     511        /// (per variable,direction)
    509512        size_t taylor_size(void) const
    510         {       return taylor_per_var_; }
    511 
    512         /// deprecated: Does this AD operation sequence use
    513         //VecAD<Base>::reference operands
     513        {       return num_order_taylor_; }
     514
     515        /// Deprecated: Does this AD operation sequence use
     516        /// VecAD<Base>::reference operands
    514517        bool use_VecAD(void) const
    515518        {       return play_.num_vec_ind_rec() > 0; }
     519
     520        /// Deprecated: # taylor_ coefficient orders calculated
     521        /// (per variable,direction)
     522        size_t size_taylor(void) const
     523        {       return num_order_taylor_; }
     524
     525        /// Deprecated: set number of orders currently allocated
     526        /// (per variable,direction)
     527        void capacity_taylor(size_t per_var);   
    516528};
    517529// ---------------------------------------------------------------------------
     
    522534// non-user interfaces
    523535# include <cppad/local/forward0sweep.hpp>
    524 # include <cppad/local/forward_sweep.hpp>
     536# include <cppad/local/forward1sweep.hpp>
    525537# include <cppad/local/reverse_sweep.hpp>
    526538# include <cppad/local/for_jac_sweep.hpp>
  • trunk/cppad/local/checkpoint.hpp

    r3160 r3214  
    277277                // no longer need the Taylor coefficients in f_
    278278                // (have to reconstruct them every time)
    279                 f_.capacity_taylor(0);
     279                f_.capacity_order(0);
    280280                return ok;
    281281        }
     
    320320                // no longer need the Taylor coefficients in f_
    321321                // (have to reconstruct them every time)
    322                 f_.capacity_taylor(0);
     322                f_.capacity_order(0);
    323323                return ok;
    324324        }
  • trunk/cppad/local/define.hpp

    r2910 r3214  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    3434# define CPPAD_OP_CODE_TYPE unsigned char
    3535
    36 /*!
    37 \def CPPAD_USE_FORWARD0SWEEP
    38 If ture, use compute zero order sweeps using a specialized routine.
    39 
    40 The value of this define should be zero or one.
    41 If it is one, a specialized routine is used for zero order forward sweeps.
    42 Otherwise, use the general forward routine is used for zero order.
    43 Using the specialized routine is an optimization that makes the source
    44 more complicated and a significant speed improvement has not been
    45 verified (as yet).
    46 This preprocessor symbol makes it easier to compare these two options.
    47 */
    48 # define CPPAD_USE_FORWARD0SWEEP 1
    4936
    5037/*!
  • trunk/cppad/local/dependent.hpp

    r3165 r3214  
    109109Thus, directly after this operation,
    110110$codei%
    111         %f%.size_taylor()
     111        %f%.size_order()
    112112%$$
    113 is zero (see $cref size_taylor$$).
     113is zero (see $cref size_order$$).
    114114
    115115$head Parallel Mode$$
     
    229229\param y
    230230The dependent variable vector for the function being stored in this object.
     231
     232\par
     233All of the private member data in ad_fun.hpp is set to correspond to the
     234new tape except for check_for_nan_.
    231235*/
    232236
     
    247251                "ADFun operation sequence dependent variable size is zero size"
    248252        );
    249 
    250         // set total number of variables in tape, parameter flag,
    251         // make a tape copy of dependent variables that are parameters,
    252         // and store tape address for each dependent variable
     253        // ---------------------------------------------------------------------
     254        // Begin setting ad_fun.hpp private member data
     255        // ---------------------------------------------------------------------
     256        // dep_parameter_, dep_taddr_
    253257        CPPAD_ASSERT_UNKNOWN( NumRes(ParOp) == 1 );
    254258        dep_parameter_.resize(m);
     
    257261        {       dep_parameter_[i] = CppAD::Parameter(y[i]);
    258262                if( dep_parameter_[i] )
     263                {       // make a tape copy of dependent variables that are parameters,
    259264                        y_taddr = tape->RecordParOp( y[i].value_ );
     265                }
    260266                else    y_taddr = y[i].taddr_;
    261267
     
    267273        tape->Rec_.PutOp(EndOp);
    268274
    269         // total number of variables on the tape
    270         total_num_var_ = tape->Rec_.num_var_rec();
    271 
    272         // conditional skip vector
     275        // some size_t values in ad_fun.hpp
     276        compare_change_       = 0;
     277        num_order_taylor_     = 0;
     278        cap_order_taylor_     = 0;
     279
     280        // num_var_tape_
     281        // Now that all the variables are in the tape, we can set this value.
     282        num_var_tape_       = tape->Rec_.num_var_rec();
     283
     284        // taylor_
     285        taylor_.erase();
     286
     287        // cskip_op_
    273288        cskip_op_.erase();
    274289        cskip_op_.extend( tape->Rec_.num_op_rec() );
    275290
    276         // vecad load operation vector
     291        // load_op_
    277292        load_op_.erase();
    278293        load_op_.extend( tape->Rec_.num_load_op_rec() );
    279294
    280         // now that each dependent variable has a place in the tape,
     295        // play_
     296        // Now that each dependent variable has a place in the tape,
    281297        // and there is a EndOp at the end of the tape, we can transfer the
    282298        // recording to the player and and erase the tape.
    283299        play_.get(tape->Rec_);
    284300
    285         // now we can delete the tape
    286         AD<Base>::tape_manage(tape_manage_delete);
    287 
    288         // total number of varables in this recording
    289         CPPAD_ASSERT_UNKNOWN( total_num_var_ == play_.num_var_rec() );
    290 
    291         // used to determine if there is an operation sequence in *this
    292         CPPAD_ASSERT_UNKNOWN( total_num_var_ > 0 );
    293 
    294         // free old buffers
    295         for_jac_sparse_pack_.resize(0, 0);
    296         for_jac_sparse_set_.resize(0,0);
    297 
    298         // initial row and column dimensions
    299         taylor_.erase();
    300         taylor_per_var_   = 0;
    301         taylor_col_dim_   = 0;
    302 
    303         // set tape address
     301        // ind_taddr_
     302        // Note that play_ has been set, we can use it to check operators
    304303        ind_taddr_.resize(n);
    305         CPPAD_ASSERT_UNKNOWN(
    306                 n < total_num_var_
    307         );
     304        CPPAD_ASSERT_UNKNOWN( n < num_var_tape_);
    308305        for(j = 0; j < n; j++)
    309306        {       CPPAD_ASSERT_UNKNOWN( play_.GetOp(j+1) == InvOp );
     
    311308        }
    312309
     310        // for_jac_sparse_pack_, for_jac_sparse_set_
     311        for_jac_sparse_pack_.resize(0, 0);
     312        for_jac_sparse_set_.resize(0,0);
     313        // ---------------------------------------------------------------------
     314        // End set ad_fun.hpp private member data
     315        // ---------------------------------------------------------------------
     316
     317        // now we can delete the tape
     318        AD<Base>::tape_manage(tape_manage_delete);
     319
     320        // total number of varables in this recording
     321        CPPAD_ASSERT_UNKNOWN( num_var_tape_  == play_.num_var_rec() );
     322
     323        // used to determine if there is an operation sequence in *this
     324        CPPAD_ASSERT_UNKNOWN( num_var_tape_  > 0 );
     325
    313326}
    314327
  • trunk/cppad/local/for_sparse_jac.hpp

    r2910 r3214  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    548548                r                ,
    549549                s                ,
    550                 total_num_var_   ,
     550                num_var_tape_    ,
    551551                dep_taddr_       ,
    552552                ind_taddr_       ,
     
    606606                r                ,
    607607                s                ,
    608                 total_num_var_   ,
     608                num_var_tape_    ,
    609609                dep_taddr_       ,
    610610                ind_taddr_       ,
     
    662662In this case
    663663\verbatim
    664         for_jac_sparse_pack_.n_set() == total_num_var_
     664        for_jac_sparse_pack_.n_set() == num_var_tape_
    665665        for_jac_sparse_pack_.end() == q
    666666        for_jac_sparse_set_.n_set()  == 0
     
    674674In this case
    675675\verbatim
    676         for_jac_sparse_set_.n_set()   == total_num_var_
     676        for_jac_sparse_set_.n_set()   == num_var_tape_
    677677        for_jac_sparse_set_.end()   == q
    678678        for_jac_sparse_pack_.n_set()  == 0
  • trunk/cppad/local/forward.hpp

    r3173 r3214  
    1515
    1616// documened after Forward but included here so easy to see
    17 # include <cppad/local/cap_taylor.hpp>
     17# include <cppad/local/capacity_order.hpp>
    1818# include <cppad/local/num_skip.hpp>
    1919
     
    2727
    2828/*!
    29 Compute arbitrary order forward mode Taylor coefficieints.
     29Arbitrary order, one direction, forward mode Taylor coefficieints.
    3030
    3131\tparam Base
    3232The type used during the forward mode computations; i.e., the corresponding
    33 recording of operations used the type \c AD<Base>.
     33recording of operations used the type AD<Base>.
    3434
    3535\tparam Vector
    36 is a Simple Vector class with eleements of type \c Base.
     36is a Simple Vector class with eleements of type Base.
    3737
    3838\param q
    3939is the hightest order for this forward mode computation; i.e.,
    4040after this calculation there will be <code>q+1</code>
    41 Taylor coefficients per variables.
    42 
    43 \param x_q
     41Taylor coefficients per variable.
     42
     43\param xq
    4444contains Taylor coefficients for the independent variables.
    45 The size of \a x_q must either be \c n or <code>n*(q+1)</code>,
    46 We define <code>p = q + 1 - x_q.size() / n</code>.
    47 The Taylor coefficients of order k, for
    48 k = p, ... , q are calculated.
     45The size of xq must either be n or <code>(q+1)*n</code>,
     46We define <code>p = q + 1 - xq.size()/n</code>.
     47For <code>j = 0 , ... , n-1</code>,
     48<code>k = p, ... , q</code>, are
     49<code>xq[ (q+1-p)*j + k - p ]</code>
     50is the k-th order coefficient for the j-th independent variable.
    4951
    5052\param s
    51 Is the stream where output corresponding to \c PriOp operations will written.
     53Is the stream where output corresponding to PriOp operations will written.
     54
     55\return
     56contains Taylor coefficients for the independent variables.
     57The size of the return value y is <code>m*(q+1-p)</code>.
     58For <code>i = 0, ... , m-1</code>,
     59<code>k = p, ..., q</code>,
     60<code>y[(q+1-p)*i + (k-p)]</code>
     61is the k-th order coefficient for the i-th dependent variable.
     62
     63\par taylor_
     64The Taylor coefficients up to order p-1 are inputs
     65and the coefficents from order p through q are outputs.
     66Let <code>N = num_var_tape_</code>, and
     67<code>C = cap_order_taylor_</code>.
     68Note that for
     69<code>i = 1 , ..., N-1</code>,
     70<code>k = 0 , ..., q</code>,
     71<code>taylor_[ C*i + k ]</code>
     72is the k-th order cofficent,
     73for the i-th varaible on the tape.
     74(The first independent variable has index one on the tape
     75and there is no variable with index zero.)
    5276*/
    5377
     
    5680Vector ADFun<Base>::Forward(
    5781        size_t q                    ,
    58         const Vector& x_q           ,
     82        const Vector& xq            ,
    5983        std::ostream& s             )
    6084{       // temporary indices
     
    7094        CheckSimpleVector<Base, Vector>();
    7195
     96
    7297        CPPAD_ASSERT_KNOWN(
    73                 size_t(x_q.size()) == n || size_t(x_q.size()) == n*(q+1),
    74                 "Forward: x_q.size() is not equal n or n*(q+1)"
     98                size_t(xq.size()) == n || size_t(xq.size()) == n*(q+1),
     99                "Forward(q, xq): xq.size() is not equal n or n*(q+1)"
    75100        );
    76         size_t n_order = size_t(x_q.size()) / n;
     101
     102        // lowest order we are computing
     103        size_t p = q + 1 - size_t(xq.size()) / n;
     104        CPPAD_ASSERT_UNKNOWN( p == 0 || p == q );
    77105        CPPAD_ASSERT_KNOWN(
    78                 q <= taylor_per_var_ || n_order == q + 1,
    79                 "The number of Taylor coefficient currently stored in this ADFun\n"
    80                 "is less than q and x_q.size() != n*(q+1)."
     106                q <= num_order_taylor_ || p == 0,
     107                "Forward(q, xq): Number of Taylor coefficient orders stored in this"
     108                " ADFun\nis less than q and xq.size() != n*(q+1)."
    81109        ); 
    82 
    83         // check if the taylor_ matrix needs more columns
    84         if( taylor_col_dim_ <= q )
    85                 capacity_taylor(q + 1);
    86         CPPAD_ASSERT_UNKNOWN( taylor_col_dim_ > q );
    87 
    88         // set the q-th order taylor_ coefficients for independent variables
     110        // does taylor_ need more orders or different number of directions
     111        if( cap_order_taylor_ <= q )
     112        {       if( p == 0 )
     113                {       // no need to copy old values during capacity_order
     114                        num_order_taylor_ = 0;
     115                }
     116                size_t c = std::max(q + 1, cap_order_taylor_);
     117                capacity_order(c);
     118        }
     119        CPPAD_ASSERT_UNKNOWN( cap_order_taylor_ > q );
     120
     121        // short hand notation for order capacity
     122        size_t C = cap_order_taylor_;
     123
     124        // set Taylor coefficients for independent variables
    89125        for(j = 0; j < n; j++)
    90         {       CPPAD_ASSERT_UNKNOWN( ind_taddr_[j] < total_num_var_ );
     126        {       CPPAD_ASSERT_UNKNOWN( ind_taddr_[j] < num_var_tape_ );
    91127
    92128                // ind_taddr_[j] is operator taddr for j-th independent variable
    93129                CPPAD_ASSERT_UNKNOWN( play_.GetOp( ind_taddr_[j] ) == InvOp );
    94130
    95                 // It is also variable taddr for j-th independent variable
    96                 if( n_order ==  1 )
    97                         taylor_[ind_taddr_[j] * taylor_col_dim_ + q] = x_q[j];
    98                 else for(k = 0; k < n_order; k++)
    99                         taylor_[ind_taddr_[j] * taylor_col_dim_ + k] =
    100                                 x_q[j * n_order + k];
     131                if( p ==  q )
     132                        taylor_[ C * ind_taddr_[j] + q] = xq[j];
     133                else
     134                {       for(k = 0; k <= q; k++)
     135                                taylor_[ C * ind_taddr_[j] + k] = xq[ (q+1)*j + k];
     136                }
    101137        }
    102138
    103139        // evaluate the derivatives
    104140        CPPAD_ASSERT_UNKNOWN( cskip_op_.size() == play_.num_op_rec() );
    105         CPPAD_ASSERT_UNKNOWN( load_op_.size()   == play_.num_load_op_rec() );
    106         size_t p = (q + 1) - n_order;
     141        CPPAD_ASSERT_UNKNOWN( load_op_.size()  == play_.num_load_op_rec() );
    107142        if( q == 0 )
    108143        {
    109 # if CPPAD_USE_FORWARD0SWEEP
    110144                compare_change_ = forward0sweep(s, true,
    111                         n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
    112                         cskip_op_.data(), load_op_
    113                 );
    114 # else
    115                 compare_change_ = forward_sweep(s, true, p,
    116                         q, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
    117                         cskip_op_.data(), load_op_
    118                 );
    119 # endif
     145                        n, num_var_tape_, &play_, C,
     146                        taylor_.data(), cskip_op_.data(), load_op_
     147                );
    120148        }
    121149        else if( p == 0 )
    122         {       compare_change_ = forward_sweep(s, true, p,
    123                         q, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
    124                         cskip_op_.data(), load_op_
     150        {       compare_change_ = forward1sweep(s, true, p, q,
     151                        n, num_var_tape_, &play_, C,
     152                        taylor_.data(), cskip_op_.data(), load_op_
    125153                );
    126154        }
    127155        else
    128         {       forward_sweep(s, true, p,
    129                         q, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
    130                         cskip_op_.data(), load_op_
     156        {       forward1sweep(s, true, p, q,
     157                        n, num_var_tape_, &play_, C,
     158                        taylor_.data(), cskip_op_.data(), load_op_
    131159                );
    132160        }
    133161
    134162        // return Taylor coefficients for dependent variables
    135         Vector y_q;
    136         if( n_order == 1 )
    137         {       y_q.resize(m);
     163        Vector yq;
     164        if( p == q )
     165        {       yq.resize(m);
    138166                for(i = 0; i < m; i++)
    139                 {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < total_num_var_ );
    140                         y_q[i] = taylor_[dep_taddr_[i] * taylor_col_dim_ + q];
     167                {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < num_var_tape_ );
     168                        yq[i] = taylor_[ C * dep_taddr_[i] + q];
    141169                }
    142170        }
    143171        else
    144         {       y_q.resize(m * n_order );
     172        {       yq.resize(m * (q+1) );
    145173                for(i = 0; i < m; i++) 
    146                 {       for(k = 0; k < n_order; k++)
    147                                 y_q[ i * n_order + k] =
    148                                         taylor_[ dep_taddr_[i] * taylor_col_dim_ + k ];
     174                {       for(k = 0; k <= q; k++)
     175                                yq[ (q+1) * i + k] =
     176                                        taylor_[ C * dep_taddr_[i] + k ];
    149177                }
    150178        }
     
    152180        if( check_for_nan_ )
    153181        {       bool ok = true;
    154                 if( q == 0 && n_order == 1 )
    155                         ok = ! hasnan(y_q);
    156                 else if( n_order != 1 )
     182                if( p == 0 )
    157183                {       for(i = 0; i < m; i++)
    158                         // on MS Visual Studio 2012, CppAD required in front of isnan ?
    159                         ok &= ! CppAD::isnan( y_q[ i * n_order + 0 ] );
     184                        {       // Visual Studio 2012, CppAD required in front of isnan ?
     185                                ok &= ! CppAD::isnan( yq[ (q+1) * i + 0 ] );
     186                        }
    160187                }
    161188                CPPAD_ASSERT_KNOWN(ok,
    162                         "y_q = f.Forward(q, x): has a zero order Taylor coefficient "
     189                        "yq = f.Forward(q, xq): has a zero order Taylor coefficient "
    163190                        "with the value nan."
    164191                ); 
    165                 if( q != 0 && n_order == 1 )
    166                         ok = ! hasnan(y_q);
    167                 else if( n_order != 1 )
     192                if( 0 < q )
    168193                {       for(i = 0; i < m; i++)
    169                         {       for(k = 1; k < n_order; k++)
    170                                         // Studio 2012, CppAD required in front of isnan ?
    171                                         ok &= ! CppAD::isnan( y_q[ i * n_order + k ] );
     194                        {       for(k = p; k <= q; k++)
     195                                {       // Studio 2012, CppAD required in front of isnan ?
     196                                        ok &= ! CppAD::isnan( yq[ (q+1-p)*i + k-p ] );
     197                                }
    172198                        }
    173199                }
    174200                CPPAD_ASSERT_KNOWN(ok,
    175                 "y_q = f.Forward(q, x): has a non-zero order Taylor coefficient\n"
     201                "yq = f.Forward(q, xq): has a non-zero order Taylor coefficient\n"
    176202                "with the value nan (but zero order coefficients are not nan)."
    177203                );
     
    179205# endif
    180206
    181 
    182         // now we have q + 1  taylor_ coefficients per variable
    183         taylor_per_var_ = q + 1;
    184 
    185         return y_q;
     207        // now we have q + 1  taylor_ coefficient orders per variable
     208        num_order_taylor_ = q + 1;
     209
     210        return yq;
    186211}
     212
    187213
    188214/*! \} */
  • trunk/cppad/local/forward0sweep.hpp

    r3168 r3214  
    2525\def CPPAD_ATOMIC_CALL
    2626This avoids warnings when NDEBUG is defined and user_ok is not used.
    27 If \c NDEBUG is defined, this resolves to
     27If NDEBUG is defined, this resolves to
    2828\code
    2929        user_atom->forward
     
    5454Compute zero order forward mode Taylor coefficients.
    5555
     56<!-- define forward0sweep_doc_define -->
    5657\tparam Base
    5758The type used during the forward mode computations; i.e., the corresponding
    58 recording of operations used the type \c AD<Base>.
     59recording of operations used the type AD<Base>.
    5960
    6061\param s_out
    61 Is the stream where output corresponding to \c PriOp operations will
     62Is the stream where output corresponding to PriOp operations will
    6263be written.
    6364
    6465\param print
    65 If \a print is false,
     66If print is false,
    6667suppress the output that is otherwise generated by the c PriOp instructions.
    6768
     
    7172\param numvar
    7273is the total number of variables on the tape.
    73 This is also equal to the number of rows in the matrix \a taylor; i.e.,
    74 \a play->num_var_rec().
     74This is also equal to the number of rows in the matrix taylor; i.e.,
     75play->num_var_rec().
    7576
    7677\param play
    77 The information stored in \a play
     78The information stored in play
    7879is a recording of the operations corresponding to the function
    7980\f[
     
    8485\n
    8586\n
    86 The object \a play is effectly constant.
     87The object play is effectly constant.
    8788There are two exceptions to this.
    8889The first exception is that while palying back the tape
    89 the object \a play holds information about the current location
     90the object play holds information about the current location
    9091with in the tape and this changes during palyback.
    91 The second exception is the fact that the
    92 zero order ( \a d = 0 ) versions of the VecAD operators LdpOp and LdvOp
    93 modify the corresponding \a op_arg values returned by
    94 \ref player::forward_next and \ref player::reverse_next; see the
    95 \link load_op.hpp LdpOp and LdvOp \endlink operations.
    9692
    9793\param J
    98 Is the number of columns in the coefficient matrix \a taylor.
     94Is the number of columns in the coefficient matrix taylor.
    9995This must be greater than or equal one.
    10096
     97<!-- end forward0sweep_doc_define -->
     98
    10199\param taylor
    102 \b Input: For j = 1 , ... , \a n,
    103 \a taylor [ j * J + 0 ]
    104 variable with index i on the tape
    105 (independent variable with index (j-1) in the independent variable vector).
     100\n
     101\b Input:
     102For j = 1 , ... , n,
     103<code>taylor [j * J + 0]</code>
     104variable with index j on the tape
     105(these are the independent variables).
    106106\n
    107107\n
    108 \b Output: For i = \a n + 1, ... , \a numvar - 1,
    109 \a taylor [ i * J + 0 ]
     108\b Output:
     109For i = n + 1, ... , numvar - 1,
     110<code>taylor [i * J + 0]</code>
    110111is the zero order Taylor coefficient for the variable with
    111112index i on the tape.
     
    126127the instruction corresponds to a parameter (not variable).
    127128
    128 \a return
     129\return
    129130The return value is equal to the number of ComOp operations
    130131that have a different result from when the information in
    131 \a play was recorded.
     132play was recorded.
    132133(Note that if NDEBUG is true, there are no ComOp operations
    133134in play and hence this return value is always zero.)
     
    147148)
    148149{       CPPAD_ASSERT_UNKNOWN( J >= 1 );
    149 
     150        CPPAD_ASSERT_UNKNOWN( play->num_var_rec() == numvar );
     151
     152        // use p, q, r so other forward sweeps can use code defined here
     153        size_t p = 0;
     154        size_t q = 0;
     155        size_t r = 1;
     156        /*
     157        <!-- define forward0sweep_code_define -->
     158        */
    150159        // op code for current instruction
    151         OpCode           op;
     160        OpCode op;
    152161
    153162        // index for current instruction
    154         size_t         i_op;
     163        size_t i_op;
    155164
    156165        // next variables
    157         size_t        i_var;
    158 
    159         // constant and non-constant version of the operation argument indices
     166        size_t i_var;
     167
     168        // operation argument indices
    160169        const addr_t*   arg = CPPAD_NULL;
    161170
     
    163172        size_t compareCount = 0;
    164173
    165         // This is an order zero calculation, initialize vecad information
     174        // If this includes a zero calculation, initialize this information
    166175        pod_vector<bool>   isvar_by_ind;
    167176        pod_vector<size_t> index_by_ind;
    168         size_t  i = play->num_vec_ind_rec();
    169         if( i > 0 )
    170         {       isvar_by_ind.extend(i);
    171                         index_by_ind.extend(i);
    172                 while(i--)
    173                 {       index_by_ind[i]  = play->GetVecInd(i);
    174                         isvar_by_ind[i]  = false;
     177        if( p == 0 )
     178        {       size_t i, ell;
     179
     180                // this includes order zero calculation, initialize vector indices
     181                size_t num = play->num_vec_ind_rec();
     182                if( num > 0 )
     183                {       isvar_by_ind.extend(num * r );
     184                        index_by_ind.extend(num * r );
     185                        for(i = 0; i < num; i++)
     186                        {       for(ell = 0; ell < r; ell++)
     187                                {       index_by_ind[num * ell + i] = play->GetVecInd(i);
     188                                        isvar_by_ind[num * ell + i] = false;
     189                                }
     190                        }
    175191                }
     192                // includes zero order, so initialize conditional skip flags
     193                num = play->num_op_rec();
     194                for(i = 0; i < num; i++)
     195                        for(ell = 0; ell < r; ell++)
     196                                cskip_op[num * ell + i] = false;
    176197        }
    177         // values of var_by_load_op do not matter.
    178 
    179         // zero order, so initialize conditional skip flags
    180         for(i = 0; i < play->num_op_rec(); i++)
    181                 cskip_op[i] = false;
    182198
    183199        // work space used by UserOp.
    184         const size_t user_q = 0;     // lowest order
    185         const size_t user_p = 0;     // highest order
    186200        vector<bool> user_vx;        // empty vecotor
    187201        vector<bool> user_vy;        // empty vecotor
     
    203217        enum { user_start, user_arg, user_ret, user_end } user_state = user_start;
    204218
    205         // check numvar argument
    206         CPPAD_ASSERT_UNKNOWN( play->num_var_rec() == numvar );
    207 
    208219        // length of the parameter vector (used by CppAD assert macros)
    209220        const size_t num_par = play->num_par_rec();
    210 
    211         // length of the text vector (used by CppAD assert macros)
    212         const size_t num_text = play->num_text_rec();
    213221
    214222        // pointer to the beginning of the parameter vector
     
    217225                parameter = play->GetPar();
    218226
     227        // length of the text vector (used by CppAD assert macros)
     228        const size_t num_text = play->num_text_rec();
     229
    219230        // pointer to the beginning of the text vector
    220231        const char* text = CPPAD_NULL;
    221232        if( num_text > 0 )
    222233                text = play->GetTxt(0);
     234        /*
     235        <!-- end forward0sweep_code_define -->
     236        */
    223237
    224238        // skip the BeginOp at the beginning of the recording
     
    614628                        {       // call users function for this operation
    615629                                user_atom->set_id(user_id);
    616                                 CPPAD_ATOMIC_CALL(user_q, user_p,
     630                                CPPAD_ATOMIC_CALL(p, q,
    617631                                        user_vx, user_vy, user_tx, user_ty
    618632                                );
     
    630644                        {       // call users function for this operation
    631645                                user_atom->set_id(user_id);
    632                                 CPPAD_ATOMIC_CALL(user_q, user_p,
     646                                CPPAD_ATOMIC_CALL(p, q,
    633647                                        user_vx, user_vy, user_tx, user_ty
    634648                                );
  • trunk/cppad/local/fun_construct.hpp

    r3165 r3214  
    171171The object $icode f$$ is not affected by this operation and
    172172can be $code const$$.
    173 Any operation sequence or other information in $icode g$$ is lost.
     173All of information (state) stored in $icode f$$ is copied to $icode g$$
     174and any information originally in $icode g$$ is lost.
    174175
    175176$subhead Taylor Coefficients$$
     
    179180Hence, directly after this operation
    180181$codei%
    181         %g%.size_taylor() == %f%.size_taylor()
     182        %g%.size_order() == %f%.size_order()
    182183%$$
    183184
     
    265266ADFun<Base>::ADFun(void) :
    266267check_for_nan_(true) ,
    267 total_num_var_(0)
     268num_var_tape_(0)
    268269{ }
    269270
     
    291292{       size_t m = f.Range();
    292293        size_t n = f.Domain();
    293 
    294         // go through member variables in order
    295         // (see ad_fun.hpp for meaning of each variable)
    296         check_for_nan_             = true;
    297         compare_change_            = 0;
    298 
    299         taylor_.erase();
    300         taylor_per_var_            = 0;
    301         taylor_col_dim_            = 0;
    302 
    303         total_num_var_             = f.total_num_var_;
     294        size_t i;
     295
     296        // go through member variables in ad_fun.hpp order
     297        //
     298        // size_t objects
     299        check_for_nan_             = f.check_for_nan_;
     300        compare_change_            = f.compare_change_;
     301        num_order_taylor_          = f.num_order_taylor_;
     302        cap_order_taylor_          = f.cap_order_taylor_;
     303        num_var_tape_              = f.num_var_tape_;
     304        //
     305        // CppAD::vector objects
    304306        ind_taddr_.resize(n);
    305307        ind_taddr_                 = f.ind_taddr_;
     
    308310        dep_parameter_.resize(m);
    309311        dep_parameter_             = f.dep_parameter_;
     312        //
     313        // pod_vector objects
     314        taylor_                    = f.taylor_;
     315        cskip_op_                  = f.cskip_op_;
     316        load_op_                   = f.load_op_;
     317        //
     318        // player
    310319        play_                      = f.play_;
     320        //
     321        // sparse_pack
    311322        for_jac_sparse_pack_.resize(0, 0);
    312         for_jac_sparse_set_.resize(0, 0);
    313 
    314         // allocate and copy the Taylor coefficients
    315         taylor_per_var_     = f.taylor_per_var_;
    316         taylor_col_dim_     = f.taylor_col_dim_;
    317         size_t length       = total_num_var_ * taylor_col_dim_;
    318         if( length > 0 )
    319                 taylor_.extend(length);
    320         size_t i, j;
    321         for(i = 0; i < total_num_var_; i++)
    322         {       for(j = 0; j < taylor_per_var_; j++)
    323                 {       taylor_[ i * taylor_col_dim_ + j ] =
    324                                 f.taylor_[ i * taylor_col_dim_ + j ];
    325                 }
    326         }
    327 
    328         // copy the conditional skip information
    329         cskip_op_ = f.cskip_op_;
    330 
    331         // copy the vecad load operation information
    332         load_op_  = f.load_op_;
    333        
    334 
    335         // allocate and copy the forward sparsity information
    336323        size_t n_set = f.for_jac_sparse_pack_.n_set();
    337324        size_t end   = f.for_jac_sparse_pack_.end();
    338325        if( n_set > 0 )
    339         {       CPPAD_ASSERT_UNKNOWN( n_set == total_num_var_ );
     326        {       CPPAD_ASSERT_UNKNOWN( n_set == num_var_tape_ );
    340327                CPPAD_ASSERT_UNKNOWN( f.for_jac_sparse_set_.n_set() == 0 );
    341328                for_jac_sparse_pack_.resize(n_set, end);
    342                 for(i = 0; i < total_num_var_ ; i++)
     329                for(i = 0; i < num_var_tape_ ; i++)
    343330                {       for_jac_sparse_pack_.assignment(
    344331                                i                       ,
     
    348335                }
    349336        }
     337        //
     338        // sparse_set
     339        for_jac_sparse_set_.resize(0, 0);
    350340        n_set = f.for_jac_sparse_set_.n_set();
    351341        end   = f.for_jac_sparse_set_.end();
    352342        if( n_set > 0 )
    353         {       CPPAD_ASSERT_UNKNOWN( n_set == total_num_var_ );
     343        {       CPPAD_ASSERT_UNKNOWN( n_set == num_var_tape_ );
    354344                CPPAD_ASSERT_UNKNOWN( f.for_jac_sparse_pack_.n_set() == 0 );
    355345                for_jac_sparse_set_.resize(n_set, end);
    356                 for(i = 0; i < total_num_var_; i++)
     346                for(i = 0; i < num_var_tape_; i++)
    357347                {       for_jac_sparse_set_.assignment(
    358348                                i                       ,
     
    362352                }
    363353        }
    364 
    365354}
    366355
     
    401390template <typename Base>
    402391template <typename VectorAD>
    403 ADFun<Base>::ADFun(const VectorAD &x, const VectorAD &y) :
    404 check_for_nan_(true) ,
    405 total_num_var_(0)
     392ADFun<Base>::ADFun(const VectorAD &x, const VectorAD &y)
    406393{
    407394        CPPAD_ASSERT_KNOWN(
     
    443430        Dependent(tape, y);
    444431
     432        // ad_fun.hpp member values not set by dependent
     433        check_for_nan_ = true;
     434
    445435        // allocate memory for one zero order taylor_ coefficient
    446         taylor_per_var_  = 1;
    447         taylor_col_dim_  = 1;
    448         taylor_.extend(total_num_var_);
     436        CPPAD_ASSERT_UNKNOWN( num_order_taylor_ == 0 );
     437        size_t c = 1;
     438        capacity_order(c);
     439        CPPAD_ASSERT_UNKNOWN( cap_order_taylor_     == c );
    449440
    450441        // set zero order coefficients corresponding to indpendent variables
     
    459450        CPPAD_ASSERT_UNKNOWN( cskip_op_.size() == play_.num_op_rec() );
    460451        CPPAD_ASSERT_UNKNOWN( load_op_.size()  == play_.num_load_op_rec() );
    461 # if CPPAD_USE_FORWARD0SWEEP
    462452        compare_change_ = forward0sweep(std::cout, false,
    463                 n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
     453                n, num_var_tape_, &play_, cap_order_taylor_, taylor_.data(),
    464454                cskip_op_.data(), load_op_
    465455        );
    466 # else
    467         size_t p = 0;
    468         compare_change_ = forward_sweep(std::cout, false,
    469                 p, p, n, total_num_var_, &play_, taylor_col_dim_, taylor_.data(),
    470                 cskip_op_.data(), load_op_
    471         );
    472 # endif
    473456        CPPAD_ASSERT_UNKNOWN( compare_change_ == 0 );
     457
     458        // now set the number of orders stored
     459        num_order_taylor_ = 1;
    474460
    475461# ifndef NDEBUG
  • trunk/cppad/local/old_atomic.hpp

    r3171 r3214  
    341341with $icode%vx%.size() = 0%$$ and
    342342$icode k$$ equal to the order of the derivative begin computed,
    343 by calls to $cref/forward/forward_any/$$.
     343by calls to $cref/forward/forward_order/$$.
    344344
    345345$subhead vx$$
  • trunk/cppad/local/optimize.hpp

    r3170 r3214  
    115115$index NDEBUG$$
    116116If $cref/NDEBUG/Faq/Speed/NDEBUG/$$ is not defined,
    117 and $cref/f.size_taylor()/size_taylor/$$ is greater than zero,
     117and $cref/f.size_order()/size_order/$$ is greater than zero,
    118118a $cref forward_zero$$ calculation is done using the optimized version
    119119of $icode f$$ and the results are checked to see that they are
     
    26142614        size_t i, j, m = dep_taddr_.size();
    26152615        CppAD::vector<Base> x(n), y(m), check(m);
    2616         bool check_zero_order = taylor_per_var_ > 0;
    26172616        Base max_taylor(0);
     2617        bool check_zero_order = num_order_taylor_ > 0;
    26182618        if( check_zero_order )
    26192619        {       // zero order coefficients for independent vars
     
    26212621                {       CPPAD_ASSERT_UNKNOWN( play_.GetOp(j+1) == InvOp );
    26222622                        CPPAD_ASSERT_UNKNOWN( ind_taddr_[j]    == j+1   );
    2623                         x[j] = taylor_[ ind_taddr_[j] * taylor_col_dim_ + 0];
     2623                        x[j] = taylor_[ ind_taddr_[j] * cap_order_taylor_ + 0];
    26242624                }
    26252625                // zero order coefficients for dependent vars
    26262626                for(i = 0; i < m; i++)
    2627                 {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < total_num_var_ );
    2628                         y[i] = taylor_[ dep_taddr_[i] * taylor_col_dim_ + 0];
     2627                {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < num_var_tape_ );
     2628                        y[i] = taylor_[ dep_taddr_[i] * cap_order_taylor_ + 0];
    26292629                }
    26302630                // maximum zero order coefficient not counting BeginOp at beginning
    26312631                // (which is correpsonds to uninitialized memory).
    2632                 for(i = 1; i < total_num_var_; i++)
    2633                 {       if(  abs_geq(taylor_[i*taylor_col_dim_+0] , max_taylor) )
    2634                                 max_taylor = taylor_[i*taylor_col_dim_+0];
     2632                for(i = 1; i < num_var_tape_; i++)
     2633                {       if(  abs_geq(taylor_[i*cap_order_taylor_+0] , max_taylor) )
     2634                                max_taylor = taylor_[i*cap_order_taylor_+0];
    26352635                }
    26362636        }
     
    26412641
    26422642        // number of variables in the recording
    2643         total_num_var_ = rec.num_var_rec();
     2643        num_var_tape_ = rec.num_var_rec();
    26442644
    26452645        // now replace the recording
     
    26532653        // free old Taylor coefficient memory
    26542654        taylor_.free();
    2655         taylor_per_var_ = 0;
    2656         taylor_col_dim_ = 0;
     2655        num_order_taylor_    = 0;
     2656        cap_order_taylor_    = 0;
    26572657
    26582658        // resize and initilaize conditional skip vector
     
    26762676                // Erase memory that this calculation was done so NDEBUG gives
    26772677                // same final state for this object (from users perspective)
    2678                 taylor_per_var_ = 0;
     2678                num_order_taylor_    = 0;
    26792679        }
    26802680# endif
  • trunk/cppad/local/rev_sparse_hes.hpp

    r2910 r3214  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    634634        );
    635635        CPPAD_ASSERT_UNKNOWN( for_jac_sparse_set_.n_set() == 0 );
    636         CPPAD_ASSERT_UNKNOWN( for_jac_sparse_pack_.n_set() == total_num_var_ );
     636        CPPAD_ASSERT_UNKNOWN( for_jac_sparse_pack_.n_set() == num_var_tape_ );
    637637       
    638638        // use sparse_pack for the calculation
     
    642642                s                        ,
    643643                h                        ,
    644                 total_num_var_           ,
     644                num_var_tape_            ,
    645645                dep_taddr_               ,
    646646                ind_taddr_               ,
     
    692692        );
    693693        CPPAD_ASSERT_UNKNOWN( for_jac_sparse_pack_.n_set() == 0 );
    694         CPPAD_ASSERT_UNKNOWN( for_jac_sparse_set_.n_set() == total_num_var_ );
     694        CPPAD_ASSERT_UNKNOWN( for_jac_sparse_set_.n_set() == num_var_tape_ );
    695695       
    696696        // use sparse_pack for the calculation
     
    700700                s                        ,
    701701                h                        ,
    702                 total_num_var_           ,
     702                num_var_tape_            ,
    703703                dep_taddr_               ,
    704704                ind_taddr_               ,
  • trunk/cppad/local/rev_sparse_jac.hpp

    r2994 r3214  
    44
    55/* --------------------------------------------------------------------------
    6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     6CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    77
    88CppAD is distributed under multiple licenses. This distribution is under
     
    532532                r              ,
    533533                s              ,
    534                 total_num_var_ ,
     534                num_var_tape_ ,
    535535                dep_taddr_     ,
    536536                ind_taddr_     ,
     
    587587                r              ,
    588588                s              ,
    589                 total_num_var_ ,
     589                num_var_tape_ ,
    590590                dep_taddr_     ,
    591591                ind_taddr_     ,
  • trunk/cppad/local/reverse.hpp

    r3174 r3214  
    106106
    107107        pod_vector<Base> Partial;
    108         Partial.extend(total_num_var_ * q);
     108        Partial.extend(num_var_tape_ * q);
    109109
    110110        // update maximum memory requirement
    111111        // memoryMax = std::max( memoryMax,
    112         //      Memory() + total_num_var_ * q * sizeof(Base)
     112        //      Memory() + num_var_tape_ * q * sizeof(Base)
    113113        // );
    114114
     
    126126        ); 
    127127        CPPAD_ASSERT_KNOWN(
    128                 taylor_per_var_ >= q,
     128                num_order_taylor_ >= q,
    129129                "Less that q taylor_ coefficients are currently stored"
    130130                " in this ADFun object."
     
    132132
    133133        // initialize entire Partial matrix to zero
    134         for(i = 0; i < total_num_var_; i++)
     134        for(i = 0; i < num_var_tape_; i++)
    135135                for(j = 0; j < q; j++)
    136136                        Partial[i * q + j] = zero;
     
    139139        // (use += because two dependent variables can point to same location)
    140140        for(i = 0; i < m; i++)
    141         {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < total_num_var_ );
     141        {       CPPAD_ASSERT_UNKNOWN( dep_taddr_[i] < num_var_tape_ );
    142142                if( size_t(w.size()) == m )
    143143                        Partial[dep_taddr_[i] * q + q - 1] += w[i];
     
    155155                q - 1,
    156156                n,
    157                 total_num_var_,
     157                num_var_tape_,
    158158                &play_,
    159                 taylor_col_dim_,
     159                cap_order_taylor_,
    160160                taylor_.data(),
    161161                q,
     
    168168        VectorBase value(n * q);
    169169        for(j = 0; j < n; j++)
    170         {       CPPAD_ASSERT_UNKNOWN( ind_taddr_[j] < total_num_var_ );
     170        {       CPPAD_ASSERT_UNKNOWN( ind_taddr_[j] < num_var_tape_ );
    171171
    172172                // independent variable taddr equals its operator taddr
  • trunk/cppad/local/undef.hpp

    r3142 r3214  
    8686# undef CPPAD_TRACE_THREAD
    8787# undef CPPAD_TRACK_DEBUG
    88 # undef CPPAD_USE_FORWARD0SWEEP
    8988# undef CPPAD_USER_MACRO
    9089# undef CPPAD_USER_MACRO_ONE
  • trunk/cppad/local/vec_ad.hpp

    r3166 r3214  
    277277
    278278$list number$$
    279 In the file $code cppad/local/forward_sweep.h$$,
    280 change the definition of $code CPPAD_FORWARD_SWEEP_TRACE$$ to
     279In the file $code cppad/local/forward1sweep.h$$,
     280change the definition of $code CPPAD_FORWARD1SWEEP_TRACE$$ to
    281281$codep
    282         # define CPPAD_FORWARD_SWEEP_TRACE 1
     282        # define CPPAD_FORWARD1SWEEP_TRACE 1
    283283$$
    284284$lnext
  • trunk/example/CMakeLists.txt

    r3119 r3214  
    8888        bender_quad.cpp
    8989        bool_fun.cpp
    90         capacity_taylor.cpp
     90        capacity_order.cpp
    9191        change_const.cpp
    9292        check_for_nan.cpp
     
    110110        for_two.cpp
    111111        forward.cpp
    112         forward_mul.cpp
     112        forward_order.cpp
    113113        for_sparse_jac.cpp
    114114        fun_assign.cpp
  • trunk/example/atomic/old_usead_2.cpp

    r3160 r3214  
    149149                // no longer need the Taylor coefficients in r_ptr_
    150150                // (have to reconstruct them every time)
    151                 r_ptr_->capacity_taylor(0);
     151                r_ptr_->capacity_order(0);
    152152                return ok;
    153153        }
     
    195195                // no longer need the Taylor coefficients in r_ptr_
    196196                // (have to reconstruct them every time)
    197                 r_ptr_->capacity_taylor(0);
     197                r_ptr_->capacity_order(0);
    198198
    199199                return ok;
  • trunk/example/example.cpp

    r3116 r3214  
    6262extern bool BenderQuad(void);
    6363extern bool BoolFun(void);
    64 extern bool capacity_taylor(void);
     64extern bool capacity_order(void);
    6565extern bool change_const(void);
    6666extern bool check_for_nan(void);
     
    8888extern bool ForSparseJac(void);
    8989extern bool Forward(void);
    90 extern bool forward_mul(void);
     90extern bool forward_order(void);
    9191extern bool fun_assign(void);
    9292extern bool FunCheck(void);
     
    222222        ok &= Run( BenderQuad,        "BenderQuad"       );
    223223        ok &= Run( BoolFun,           "BoolFun"          );
    224         ok &= Run( capacity_taylor,   "capacity_taylor"  );
     224        ok &= Run( capacity_order,    "capacity_order"   );
    225225        ok &= Run( change_const,      "change_const"     );
    226226        ok &= Run( check_for_nan,     "check_for_nan"    );
     
    244244        ok &= Run( ForTwo,            "ForTwo"           );
    245245        ok &= Run( Forward,           "Forward"          );
    246         ok &= Run( forward_mul,       "forward_mul"      );
     246        ok &= Run( forward_order,     "forward_order"    );
    247247        ok &= Run( ForSparseJac,      "ForSparseJac"     );
    248248        ok &= Run( fun_assign,        "fun_assign"       );
  • trunk/example/forward.cpp

    r3171 r3214  
    2929*/
    3030// BEGIN C++
     31# include <limits>
    3132# include <cppad/cppad.hpp>
    3233namespace { // --------------------------------------------------------
     
    3738        using CppAD::AD;
    3839        using CppAD::NearEqual;
     40        double eps = 10. * std::numeric_limits<double>::epsilon();
    3941
    4042        // domain space vector
    4143        size_t n = 2;
    42         CPPAD_TESTVECTOR(AD<double>) X(n);
    43         X[0] = 0.;
    44         X[1] = 1.;
     44        CPPAD_TESTVECTOR(AD<double>) ax(n);
     45        ax[0] = 0.;
     46        ax[1] = 1.;
    4547
    4648        // declare independent variables and starting recording
    47         CppAD::Independent(X);
     49        CppAD::Independent(ax);
    4850
    4951        // range space vector
    5052        size_t m = 1;
    51         CPPAD_TESTVECTOR(AD<double>) Y(m);
    52         Y[0] = X[0] * X[0] * X[1];
     53        CPPAD_TESTVECTOR(AD<double>) ay(m);
     54        ay[0] = ax[0] * ax[0] * ax[1];
    5355
    54         // create f: X -> Y and stop tape recording
    55         CppAD::ADFun<double> f(X, Y);
     56        // create f: x -> y and stop tape recording
     57        CppAD::ADFun<double> f(ax, ay);
    5658
    5759        // initially, the variable values during taping are stored in f
    58         ok &= f.size_taylor() == 1;
     60        ok &= f.size_order() == 1;
    5961
    60         // zero order forward mode using notaiton in forward_zero
     62        // zero order forward mode using notation in forward_zero
    6163        // use the template parameter Vector for the vector type
    62         Vector x(n);
    63         Vector y(m);
    64         x[0] = 3.;
    65         x[1] = 4.;
    66         y    = f.Forward(0, x);
    67         ok  &= NearEqual(y[0] , x[0]*x[0]*x[1], 1e-10, 1e-10);
    68         ok  &= f.size_taylor() == 1;
     64        Vector x0(n), y0(m);
     65        x0[0] = 3.;
     66        x0[1] = 4.;
     67        y0    = f.Forward(0, x0);
     68        ok  &= NearEqual(y0[0] , x0[0]*x0[0]*x0[1], eps, eps);
     69        ok  &= f.size_order() == 1;
    6970
    7071        // first order forward mode using notation in forward_one
    71         // X(t)           = x + dx * t
    72         // Y(t) = F[X(t)] = y + dy * t + o(t)
    73         Vector dx(n);
    74         Vector dy(m);
    75         dx[0] = 1.;
    76         dx[1] = 0.;
    77         dy    = f.Forward(1, dx); // partial F w.r.t. x[0]
    78         ok   &= NearEqual(dy[0] , 2.*x[0]*x[1], 1e-10, 1e-10);
    79         ok   &= f.size_taylor() == 2;
     72        // X(t)           = x0 + x1 * t
     73        // Y(t) = F[X(t)] = y0 + y1 * t + o(t)
     74        Vector x1(n), y1(m);
     75        x1[0] = 1.;
     76        x1[1] = 0.;
     77        y1    = f.Forward(1, x1); // partial F w.r.t. x_0
     78        ok   &= NearEqual(y1[0] , 2.*x0[0]*x0[1], eps, eps);
     79        ok   &= f.size_order() == 2;
    8080
    81         // second order forward mode using notaiton in forward_any
    82         // X(t) =           x + dx * t + x_2 * t^2
    83         // Y(t) = F[X(t)] = y + dy * t + y_2 * t^2 + o(t^3)
    84         Vector x_2(n);
    85         Vector y_2(m);
    86         x_2[0]      = 0.;
    87         x_2[1]      = 0.;
    88         y_2         = f.Forward(2, x_2);
    89         double F_00 = 2. * y_2[0]; // second partial F w.r.t. x[0], x[0]
    90         ok         &= NearEqual(F_00, 2.*x[1], 1e-10, 1e-10);
    91         ok         &= f.size_taylor() == 3;
     81        // second order forward mode using notation in forward_order
     82        // X(t) =           x0 + x1 * t + x2 * t^2
     83        // Y(t) = F[X(t)] = y0 + y1 * t + y2 * t^2 + o(t^3)
     84        Vector x2(n), y2(m);
     85        x2[0]      = 0.;
     86        x2[1]      = 0.;
     87        y2         = f.Forward(2, x2);
     88        double F_00 = 2. * y2[0]; // second partial F w.r.t. x_0, x_0
     89        ok         &= NearEqual(F_00, 2.*x0[1], eps, eps);
     90        ok         &= f.size_order() == 3;
    9291
    9392        return ok;
  • trunk/example/fun_assign.cpp

    r2506 r3214  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    7272
    7373        // check values that should be equal
    74         ok &= ( g.size_taylor()       == f.size_taylor() );
     74        ok &= ( g.size_order()       == f.size_order() );
    7575        ok &= ( g.size_forward_bool() == f.size_forward_bool() );
    7676        ok &= ( g.size_forward_set()  == f.size_forward_set() );
  • trunk/example/fun_check.cpp

    r2506 r3214  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    9494        // stop tape and store operation sequence in f : X -> Y
    9595        f.Dependent(X, Y);
    96         ok &= (f.size_taylor() == 0);  // no implicit forward operation
     96        ok &= (f.size_order() == 0);  // no implicit forward operation
    9797
    9898        // create function object to use with double
     
    123123        // stop tape and store operation sequence in f : X -> Y
    124124        f.Dependent(X, Y);
    125         ok &= (f.size_taylor() == 0);  // no implicit forward with this x
     125        ok &= (f.size_order() == 0);  // no implicit forward with this x
    126126
    127127        // function values should agree now
  • trunk/example/makefile.am

    r3117 r3214  
    8888        bender_quad.cpp \
    8989        bool_fun.cpp \
    90         capacity_taylor.cpp \
     90        capacity_order.cpp \
    9191        change_const.cpp \
    9292        check_for_nan.cpp \
     
    110110        for_two.cpp \
    111111        forward.cpp \
    112         forward_mul.cpp \
     112        forward_order.cpp \
    113113        for_sparse_jac.cpp \
    114114        fun_assign.cpp \
  • trunk/example/reverse_any.cpp

    r2859 r3214  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    180180                else   
    181181                {       // free all the Taylor coefficients stored in f
    182                         f.capacity_taylor(0);
     182                        f.capacity_order(0);
    183183                }
    184184
  • trunk/makefile.am

    r3116 r3214  
    150150        cppad/local/bool_fun.hpp \
    151151        cppad/local/bool_valued.hpp \
    152         cppad/local/cap_taylor.hpp \
     152        cppad/local/capacity_order.hpp \
    153153        cppad/local/checkpoint.hpp \
    154154        cppad/local/compare.hpp \
     
    182182        cppad/local/for_two.hpp \
    183183        cppad/local/forward0sweep.hpp \
     184        cppad/local/forward1sweep.hpp \
    184185        cppad/local/forward.hpp \
    185         cppad/local/forward_sweep.hpp \
    186186        cppad/local/fun_check.hpp \
    187187        cppad/local/fun_construct.hpp \
  • trunk/omh/check_for_nan.omh

    r3171 r3214  
    3030$head Purpose$$
    3131If $code NDEBUG$$ is not defined and
    32 the result of a $cref/forward/forward_any/$$ or $cref/reverse/reverse_any/$$
     32the result of a $cref/forward/forward_order/$$ or $cref/reverse/reverse_any/$$
    3333calculation contains a  $cref nan$$,
    3434CppAD halts with an error message.
     
    5656depending on if $icode b$$ is true (false).
    5757
     58$head Default$$
     59The value for this setting after construction of $icode f$$) is true.
     60The value of this setting is not affected by calling
     61$cref Dependent$$ for this function object.
     62
    5863$head Example$$
    5964$children%
  • trunk/omh/deprecated/fun_deprecated.omh

    r2652 r3214  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    3535%$$
    3636$icode%u% = %f%.use_VecAD()
     37%$$
     38$icode%v% = %f%.size_taylor()
     39%$$
     40$icode%w% = %f%.capacity_taylor()
    3741%$$
    3842
     
    8387values so that $icode f$$ uses less memory.
    8488In this case, the return value of $code Order$$ would not make sense.
    85 Use $cref size_taylor$$ to obtain
     89Use $cref size_order$$ to obtain
    8690the number of Taylor coefficients currently stored
    8791in the ADFun object $icode f$$
     
    137141        size_t %t%
    138142%$$
    139 and is the number of Taylor coefficients,
    140 per variable in the AD operation sequence,
     143and is the number of Taylor coefficient orders
    141144currently calculated and stored in the ADFun object $icode f$$.
    142145
    143146$subhead Deprecated$$
    144 For the purpose of uniform naming,
    145 this function has been replaced by $cref size_taylor$$.
     147This function has been replaced by $cref size_order$$.
    146148
    147149$head use_VecAD$$
     
    165167%$$
    166168
     169$head size_taylor$$
     170$index ADFun, size_taylor$$
     171$index size_taylor, ADFun$$
     172The result $icode v$$ has prototype
     173$codei%
     174        size_t %v%
     175%$$
     176and is the number of Taylor coefficient orders
     177currently calculated and stored in the ADFun object $icode f$$.
     178
     179$subhead Deprecated$$
     180This function has been replaced by $cref size_order$$.
     181
     182$head capacity_taylor$$
     183$index ADFun, capacity_taylor$$
     184$index capacity_taylor, ADFun$$
     185The result $icode w$$ has prototype
     186$codei%
     187        size_t %w%
     188%$$
     189and is the number of Taylor coefficient orders currently allocated
     190in the ADFun object $icode f$$.
     191
     192$subhead Deprecated$$
     193This function has been replaced by $cref capacity_order$$.
     194
    167195
    168196$end
  • trunk/omh/example_list.omh

    r3116 r3214  
    107107$rref bender_quad.cpp$$
    108108$rref bool_fun.cpp$$
    109 $rref capacity_taylor.cpp$$
     109$rref capacity_order.cpp$$
    110110$rref change_const.cpp$$
    111111$rref check_for_nan.cpp$$
     
    138138$rref for_two.cpp$$
    139139$rref forward.cpp$$
    140 $rref forward_mul.cpp$$
     140$rref forward_order.cpp$$
    141141$rref fun_assign.cpp$$
    142142$rref fun_check.cpp$$
  • trunk/omh/forward

    • Property svn:ignore set to
      aclocal.m4
      autom4te.cache
      build
      check_all.err
      commit.sh.old
      configure.hpp
      doc
      doxydoc
      doxyfile
      doxyfile.*
      doxygen.err
      junk
      junk.*
      *.log
      new
      temp
      temp.sh
      test_one.exe
      test_one.sh
      test_one.cpp
      *.tmp
  • trunk/omh/forward/forward.omh

    r3173 r3214  
    2828        omh/forward/forward_zero.omh%
    2929        omh/forward/forward_one.omh%
    30         omh/forward/forward_any.omh%
    31         omh/forward/size_taylor.omh%
     30        omh/forward/forward_two.omh%
     31        omh/forward/forward_order.omh%
     32        omh/forward/size_order.omh%
    3233        omh/forward/compare_change.omh%
    33         cppad/local/cap_taylor.hpp%
    34         cppad/local/num_skip.hpp%
    35         example/forward.cpp%
    36         example/forward_mul.cpp
     34        cppad/local/capacity_order.hpp%
     35        cppad/local/num_skip.hpp
    3736%$$
    3837
  • trunk/omh/forward/forward_one.omh

    r3173 r3214  
    1212$begin forward_one$$
    1313$spell
    14         dy
    1514        Jacobian
    1615        Taylor
     
    2625
    2726$head Syntax$$
    28 $icode%dy% = %f%.Forward(1, %dx%)
    29 %$$
    30 $icode%dy% = %f%.Forward(1, %dx%, %s%)
    31 %$$
    32 
     27$icode%y1% = %f%.Forward(1, %x1%)%$$
    3328
    3429$head Purpose$$
     
    3732The result of the syntax above is
    3833$latex \[
    39         dy = F^{(1)} (x) * dx
     34        y1 = F^{(1)} (x0) * x1
    4035\] $$
    41 where $latex F^{(1)} (x)$$ is the Jacobian of $latex F$$
    42 evaluated at $latex x$$.
     36where $latex F^{(1)} (x0)$$ is the Jacobian of $latex F$$
     37evaluated at $icode x0$$.
    4338
    4439$head f$$
     
    5045Before this call to $code Forward$$, the value returned by
    5146$codei%
    52         %f%.size_taylor()
     47        %f%.size_order()
    5348%$$
    5449must be greater than or equal one.
    55 After this call it will be will be two (see $cref size_taylor$$).
     50After this call it will be will be two (see $cref size_order$$).
    5651
    57 $head x$$
    58 The vector $icode x$$ in expression for $icode dy$$ above
     52$head x0$$
     53The vector $icode x0$$ in the formula
     54$latex \[
     55        y1 = F^{(1)} (x0) * x1
     56\] $$
    5957corresponds to the previous call to $cref forward_zero$$
    6058using this ADFun object $icode f$$; i.e.,
    6159$codei%
    62         %f%.Forward(0, %x%)
     60        %f%.Forward(0, %x0%)
    6361%$$
    6462If there is no previous call with the first argument zero,
    6563the value of the $cref/independent/Independent/$$ variables
    6664during the recording of the AD sequence of operations is used
    67 for $icode x$$.
     65for $icode x0$$.
    6866
    69 $head dx$$
    70 The argument $icode dx$$ has prototype
     67$head x1$$
     68The argument $icode x1$$ has prototype
    7169$codei%
    72         const %Vector%& %x%
     70        const %Vector%& %x1%
    7371%$$
    7472(see $cref/Vector/forward_one/Vector/$$ below)
    75 and its size
    76 must be equal to $icode n$$, the dimension of the
     73and its size must be equal to $icode n$$, the dimension of the
    7774$cref/domain/seq_property/Domain/$$ space for $icode f$$.
    78 
    79 $head s$$
    80 The argument $icode s$$, if present, is not used during this operation.
    81 
    82 $head dy$$
    83 The result $icode dy$$ has prototype
    84 $codei%
    85         %Vector% %dy%
    86 %$$
    87 (see $cref/Vector/forward_one/Vector/$$ below)
    88 and its value is $latex F^{(1)} (x) * dx$$.
    89 The size of $icode dy$$
    90 is equal to $icode m$$, the dimension of the
    91 $cref/range/seq_property/Range/$$ space for $icode f$$.
    9275
    9376$head Vector$$
     
    10487It returns true if it succeeds and false otherwise.
    10588
     89$head Special Case$$
     90This is special case of $cref forward_order$$ where
     91$latex \[
     92\begin{array}{rcl}
     93Y(t) & = & F[ X(t) ]
     94\\
     95X(t) & = & x^{(0)} t^0 + x^{(1)} * t^1 + \cdots, + x^{(q)} * t^q + o( t^q )
     96\\
     97Y(t) & = & y^{(0)} t^0 + y^{(1)} * t^1 + \cdots, + y^{(q)} * t^q + o( t^q )
     98\end{array}
     99\] $$
     100and $latex o( t^q ) * t^{-q} \rightarrow 0$$ as $latex t \rightarrow 0$$.
     101For this special case, $latex q = 1$$,
     102$latex x^{(0)}$$ $codei%= %x0%$$,
     103$latex x^{(1)}$$ $codei%= %x1%$$,
     104$latex X(t) = x^{(0)} + x^{(1)} t$$, and
     105$latex \[
     106        y^{(0)} + y^{(1)} t  = F [ x^{(0)} + x^{(1)} t ] + o(t)
     107\] $$
     108Taking the derivative with respect to $latex t$$, at $latex t = 0$$,
     109we obtain
     110$latex \[
     111        y^{(1)} = F^{(1)} [ x^{(0)} ] x^{(1)}
     112\] $$
     113which agrees with the specifications for
     114$icode y1$$ in the $cref/purpose/forward_one/Purpose/$$ above.
     115
    106116$end
  • trunk/omh/forward/forward_zero.omh

    r3173 r3214  
    2626
    2727$head Syntax$$
    28 $icode%y% = %f%.Forward(0, %x%)
     28$icode%y0% = %f%.Forward(0, %x0%)
    2929%$$
    30 $icode%y% = %f%.Forward(0, %x%, %s%)%$$
     30$icode%y0% = %f%.Forward(0, %x0%, %s%)%$$
    3131
    3232$head Purpose$$
     
    3535The result of the syntax above is
    3636$latex \[
    37         y = F(x)
     37        y0 = F(x0)
    3838\] $$
    39 (See the $cref/FunCheck discussion/FunCheck/Discussion/$$ for
     39See the $cref/FunCheck discussion/FunCheck/Discussion/$$ for
    4040possible differences between $latex F(x)$$ and the algorithm that defined
    41 the operation sequence.)
     41the operation sequence.
    4242
    4343$head f$$
     
    4949After this call to $code Forward$$, the value returned by
    5050$codei%
    51         %f%.size_taylor()
     51        %f%.size_order()
    5252%$$
    53 will be equal to one (see $cref size_taylor$$).
     53will be equal to one (see $cref size_order$$).
    5454
    55 $head x$$
    56 The argument $icode x$$ has prototype
     55$head x0$$
     56The argument $icode x0$$ has prototype
    5757$codei%
    58         const %Vector%& %x%
     58        const %Vector%& %x0%
    5959%$$
    6060(see $cref/Vector/forward_zero/Vector/$$ below)
    61 and its size
    62 must be equal to $icode n$$, the dimension of the
     61and its size must be equal to $icode n$$, the dimension of the
    6362$cref/domain/seq_property/Domain/$$ space for $icode f$$.
    6463
     
    7372and this zero order forward mode call, will be written.
    7473
    75 $head y$$
    76 The result $icode y$$ has prototype
     74$head y0$$
     75The result $icode y0$$ has prototype
    7776$codei%
    78         %Vector% %y%
     77        %Vector% %y0%
    7978%$$
    8079(see $cref/Vector/forward_zero/Vector/$$ below)
    81 and its value is $latex F(x)$$.
    82 The size of $icode y$$
    83 is equal to $icode m$$, the dimension of the
     80and its value is $latex F(x)$$ at $icode%x% = %x0%$$. 
     81The size of $icode y0$$ is equal to $icode m$$, the dimension of the
    8482$cref/range/seq_property/Range/$$ space for $icode f$$.
    8583
     
    9795It returns true if it succeeds and false otherwise.
    9896
     97$head Special Case$$
     98This is special case of $cref forward_order$$ where
     99$latex \[
     100\begin{array}{rcl}
     101Y(t) & = & F[ X(t) ]
     102\\
     103X(t) & = & x^{(0)} t^0 + x^{(1)} * t^1 + \cdots, + x^{(q)} * t^q + o( t^q )
     104\\
     105Y(t) & = & y^{(0)} t^0 + y^{(1)} * t^1 + \cdots, + y^{(q)} * t^q + o( t^q )
     106\end{array}
     107\] $$
     108and $latex o( t^q ) * t^{-q} \rightarrow 0$$ as $latex t \rightarrow 0$$.
     109For this special case, $latex q = 0$$,
     110$latex x^{(0)}$$ $codei%= %x0%$$,
     111$latex X(t) = x^{(0)}$$, and
     112$latex \[
     113        y^{(0)} = Y(t) = F[ X(t) ] = F( x^{(0)} )
     114\] $$
     115which agrees with the specifications for
     116$icode y0$$ in the $cref/purpose/forward_zero/Purpose/$$ above.
     117
     118
     119
    99120$end
  • trunk/omh/reverse

    • Property svn:ignore set to
      aclocal.m4
      autom4te.cache
      build
      check_all.err
      commit.sh.old
      configure.hpp
      doc
      doxydoc
      doxyfile
      doxyfile.*
      doxygen.err
      junk
      junk.*
      *.log
      new
      temp
      temp.sh
      test_one.exe
      test_one.sh
      test_one.cpp
      *.tmp
  • trunk/omh/reverse/reverse_any.omh

    r3174 r3214  
    114114Before this call to $code Reverse$$, the value returned by
    115115$codei%
    116         %f%.size_taylor()
     116        %f%.size_order()
    117117%$$
    118118must be greater than or equal $icode q$$
    119 (see $cref size_taylor$$).
     119(see $cref size_order$$).
    120120
    121121$head q$$
     
    124124        size_t %q%
    125125%$$
    126 and specifies the number of Taylor coefficients to be differentiated
     126and specifies the number of Taylor coefficient orders to be differentiated
    127127(for each variable).
    128128
  • trunk/omh/reverse/reverse_one.omh

    r3174 r3214  
    5151Before this call to $code Reverse$$, the value returned by
    5252$codei%
    53         %f%.size_taylor()
     53        %f%.size_order()
    5454%$$
    55 must be greater than or equal one (see $cref size_taylor$$).
     55must be greater than or equal one (see $cref size_order$$).
    5656
    5757$head x$$
  • trunk/omh/reverse/reverse_two.omh

    r3174 r3214  
    8383Before this call to $code Reverse$$, the value returned by
    8484$codei%
    85         %f%.size_taylor()
     85        %f%.size_order()
    8686%$$
    87 must be greater than or equal two (see $cref size_taylor$$).
     87must be greater than or equal two (see $cref size_order$$).
    8888
    8989$head w$$
  • trunk/omh/seq_property.omh

    r2991 r3214  
    11$Id$
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    5252
    5353$subhead See Also$$
    54 $cref size_taylor$$, $cref capacity_taylor$$.
     54$cref size_order$$, $cref capacity_order$$.
    5555
    5656$head Purpose$$
     
    138138The amount of work and memory necessary for computing function values
    139139and derivatives using $icode f$$ is roughly proportional to $icode s$$.
    140 (The function call $cref/f.size_taylor()/size_taylor/$$
    141 returns the number of Taylor coefficients, per variable,
     140(The function call $cref/f.size_order()/size_order/$$
     141returns the number of Taylor coefficient orders, per variable,direction,
    142142currently stored in $icode f$$.)
    143143$pre
  • trunk/omh/theory

    • Property svn:ignore set to
      aclocal.m4
      autom4te.cache
      build
      check_all.err
      commit.sh.old
      configure.hpp
      doc
      doxydoc
      doxyfile
      doxyfile.*
      doxygen.err
      junk
      junk.*
      *.log
      new
      temp
      temp.sh
      test_one.exe
      test_one.sh
      test_one.cpp
      *.tmp
  • trunk/omh/whats_new/whats_new_06.omh

    r3170 r3214  
    577577
    578578$subhead 06-17$$
    579 Added $cref capacity_taylor$$ which can be used to control
     579Added $cref capacity_order$$ which can be used to control
    580580the amount of memory used to store $cref Forward$$ results.
    581581Also $cref/deprecated/FunDeprecated/$$ $code taylor_size$$, and defined
    582 $cref size_taylor$$ in its place.
     582$cref size_order$$ in its place.
    583583
    584584$subhead 06-18$$
     
    822822$$
    823823The ADFun $cref/Size/FunDeprecated/Size/$$ member function
    824 has been deprecated (use $cref size_taylor$$ instead).
     824has been deprecated (use $cref size_order$$ instead).
    825825$pre
    826826
  • trunk/omh/whats_new/whats_new_07.omh

    r3171 r3214  
    701701$$
    702702There was a typo in the
    703 $cref/second order/forward_any/Second Order/$$ discussion
     703$cref/second order/forward_order/Second Order/$$ discussion
    704704(found by Kipp Martin).
    705705It has been fixed.
  • trunk/omh/whats_new/whats_new_09.omh

    r3170 r3214  
    6868Taylor coefficients and sparsity pattern information.
    6969(This assignment operator was added on $cref/10-24/whats_new_09/10-24/$$.)
    70 You can use $cref capacity_taylor$$ to delete the Taylor coefficients
     70You can use $cref capacity_order$$ to delete the Taylor coefficients
    7171before copying them.
    7272Two new functions were added so that you can query and delete the
  • trunk/omh/whats_new/whats_new_12.omh

    r3139 r3214  
    793793Calling $code taylor_capacity$$, with to with capacity equal to zero,
    794794was not
    795 $cref/freeing memory/capacity_taylor/c/Freeing Memory/$$.
     795$cref/freeing memory/capacity_order/c/Freeing Memory/$$.
    796796This has been fixed.
    797797
  • trunk/omh/whats_new/whats_new_13.omh

    r3171 r3214  
    305305Check $cref/reverse/reverse_any/$$  mode results when
    306306$cref check_for_nan$$ is true.
    307 (It used to be the case that only $cref/forward/forward_any/$$ results
     307(It used to be the case that only $cref/forward/forward_order/$$ results
    308308were checked for $code nan$$.)
    309309$lend
     
    385385$head 05-04$$
    386386The option to compute
    387 $cref/multiple orders/forward_any/x_q/Multiple Orders/$$ was added.
     387$cref/multiple orders/forward_order/xq/Multiple Orders/$$ was added.
    388388The $cref old_usead_2.cpp$$ example shows the need for this.
    389389The problem is that a new atomic function interface needs to be designed
  • trunk/omh/whats_new/whats_new_14.omh

    r3213 r3214  
    1414$dollar @$$
    1515$spell
     16        taylor
    1617        forwardzero
    1718        forwardone
     
    4748assist you in learning about changes between various versions of CppAD.
    4849
     50$head 03-18$$
     51$list number$$
     52The
     53$cref/size_taylor/FunDeprecated/size_taylor/$$
     54and
     55$cref/capacity_taylor/FunDeprecated/capacity_taylor/$$
     56functions were deprecated;
     57use $cref size_order$$ and $cref capacity_order$$ instead.
     58$lnext
     59The documentation for $cref forward$$ and the examples
     60$cref forward.cpp$$, $cref forward_order.cpp$$, have been improved.
     61To be more specific, $cref forward_order$$ now references the special
     62cases $cref forward_zero$$, $cref forward_one$$ and the new case
     63$cref forward_two$$.
     64$lend
     65
    4966$head 03-17$$
    5067The
     
    5774even if the target vector has a different size.)
    5875
    59 $head 03-12$$
    60 The documentation does not get installed if
    61 $cref/cmake_install_docdir/cmake/cmake_install_docdir/$$
    62 is not specified.
    63 The reference to a default for this directory been removed.
    64 
    6576$head 03-09$$
    6677The documentation links
     
    6879have been changed to
    6980$cref forward_zero$$, $cref forward_one$$,
    70 and $cref forward_any$$ respectively.
     81and $cref forward_order$$ respectively.
    7182This may affect links from other web pages to the CppAD documentation.
    7283
    7384$head 03-05$$
    7485The names $icode p$$ and $icode q$$ in the
    75 $cref/forward/forward_any/$$,
     86$cref/forward/forward_order/$$,
    7687$cref/reverse/reverse_any/$$,
    7788$cref atomic_forward$$, and
  • trunk/omh/wish_list.omh

    r3171 r3214  
    110110$head Forward Mode Recomputation$$
    111111$index forward$$
    112 If the results of $cref forward_any$$ have already been computed and are still
    113 stored in the $cref ADFun$$ object (see $cref size_taylor$$),
     112If the results of $cref forward_order$$ have already been computed and are still
     113stored in the $cref ADFun$$ object (see $cref size_order$$),
    114114then they do not need to be recomputed and the results can just be returned.
    115115
  • trunk/speed/cppad/poly.cpp

    r3139 r3214  
    116116
    117117                // pre-allocate memory for three forward mode calculations
    118                 f.capacity_taylor(3);
     118                f.capacity_order(3);
    119119
    120120                // evaluate the polynomial
  • trunk/test_more/CMakeLists.txt

    r3119 r3214  
    9595        for_sparse_jac.cpp
    9696        forward.cpp
    97         forward_mul.cpp
     97        forward_order.cpp
    9898        from_base.cpp
    9999        fun_check.cpp
  • trunk/test_more/fun_check.cpp

    r2506 r3214  
    11/* $Id$ */
    22/* --------------------------------------------------------------------------
    3 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-12 Bradley M. Bell
     3CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44
    55CppAD is distributed under multiple licenses. This distribution is under
     
    7070        // stop tape and store operation sequence in f : X -> Y
    7171        f.Dependent(Y);
    72         ok &= (f.size_taylor() == 0);  // no implicit forward operation
     72        ok &= (f.size_order() == 0);  // no implicit forward operation
    7373
    7474        // create function object to use with double
     
    9999        // stop tape and store operation sequence in f : X -> Y
    100100        f.Dependent(Y);
    101         ok &= (f.size_taylor() == 0);  // no implicit forward with this x
     101        ok &= (f.size_order() == 0);  // no implicit forward with this x
    102102
    103103        // function values should agree now
  • trunk/test_more/makefile.am

    r2940 r3214  
    11# $Id$
    22# -----------------------------------------------------------------------------
    3 # CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-13 Bradley M. Bell
     3# CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-14 Bradley M. Bell
    44#
    55# CppAD is distributed under multiple licenses. This distribution is under
     
    120120        for_sparse_jac.cpp \
    121121        forward.cpp \
    122         forward_mul.cpp \
     122        forward_order.cpp \
    123123        from_base.cpp \
    124124        fun_check.cpp \
  • trunk/test_more/test_more.cpp

    r3083 r3214  
    4949extern bool for_sparse_jac(void);
    5050extern bool Forward(void);
    51 extern bool forward_mul(void);
     51extern bool forward_order(void);
    5252extern bool FromBase(void);
    5353extern bool FunCheck(void);
     
    158158        ok &= Run( for_sparse_jac,  "for_sparse_jac" );
    159159        ok &= Run( Forward,         "Forward"        );
    160         ok &= Run( forward_mul,     "forward_mul"    );
     160        ok &= Run( forward_order,   "forward_order"  );
    161161        ok &= Run( FromBase,        "FromBase"       );
    162162        ok &= Run( FunCheck,        "FunCheck"       );
Note: See TracChangeset for help on using the changeset viewer.