Changeset 3362


Ignore:
Timestamp:
Sep 26, 2014 5:57:41 AM (6 years ago)
Author:
bradbell
Message:

Make all cache_info private data vectors pod_vector<addr_t>.

Location:
branches/cache/cppad/local
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/cache/cppad/local/cache_info.hpp

    r3355 r3362  
    1717class cache_info {
    1818private:
    19         /// Number of cache values. If this is zero, there is no cache
    20         size_t num_cache_;
     19/// Number of cache values. If this is zero, there is no cache
     20size_t num_cache_;
    2121/*!
    2222Mapping from variable index for argument, to last variable index
     
    2929\endcode
    3030*/
    31         CppAD::vector<size_t> last_use_;
     31pod_vector<addr_t> last_use_;
    3232/*!
    3333Vector that sorts last_use_; i.e.,
     
    3838othersize the size of this vector is num_var.
    3939*/
    40 CppAD::vector<size_t> order_;
     40pod_vector<addr_t> order_;
    4141/*!
    4242Mapping from variable index to cache index that is used for the variable.
     
    5252        cache_info(void) :
    5353        num_cache_(0),
    54         last_use_(0),
    55         order_(0),
     54        last_use_(  std::numeric_limits<addr_t>::max() ),
     55        order_(  std::numeric_limits<addr_t>::max() ),
    5656        var2cache_( std::numeric_limits<addr_t>::max() )
    5757        {};
     
    6060        void clear(void)
    6161        {       num_cache_ = 0;
    62                 last_use_.clear();
    63                 order_.clear();
     62                last_use_.free();
     63                order_.free();
    6464                var2cache_.free();
    6565        }
     
    6868        void operator=(const cache_info& info)
    6969        {       num_cache_   = info.num_cache_;
    70                 //
    71                 last_use_.resize( info.last_use_.size() );
    7270                last_use_    = info.last_use_;
    73                 //
    74                 order_.resize( info.order_.size() );
    7571                order_       = info.order_;
    76                 //
    7772                var2cache_   = info.var2cache_;
    7873        }
  • branches/cache/cppad/local/create_cache.hpp

    r3357 r3362  
    180180
    181181        // set the cache information for this recording
     182        last_use_.free();
     183        last_use_.extend( num_var );
     184        order_.free();
     185        order_.extend(num_var);
     186        var2cache_.free();
     187        var2cache_.extend(num_var);
     188        //
    182189        num_cache_ = number_cache;
    183         last_use_  = last_use;
    184         order_     = order;
    185         var2cache_ = variable2cache;
     190        for(i_var = 0; i_var < num_var; i_var++)
     191        {       last_use_[i_var]  = addr_t( last_use[i_var] );
     192                order_[i_var]     = addr_t( order[i_var] );
     193                var2cache_[i_var] = variable2cache[i_var];
     194        }
    186195
    187196        return;
Note: See TracChangeset for help on using the changeset viewer.