Ignore:
Timestamp:
Apr 20, 2005, 6:19:31 PM (18 years ago)
Author:
Peter
Message:

modified to use vector views

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/RegressionLocal.cc

    r253 r280  
    2323  {
    2424    sort(data_.begin(), data_.end());
     25
     26    // coying data to 2 gslapi vectors ONCE to use views from
     27    gslapi::vector x_total(data_.size());
     28    gslapi::vector y_total(data_.size());
     29    for (size_t j=0; j<x_total.size(); j++)
     30      x_total(j)=data_[j].first;
     31    for (size_t j=0; j<y_total.size(); j++)
     32      y_total(j)=data_[j].second;
     33   
    2534    regressor_->print_header(s);
    2635    s << std::endl;
     
    5564      }
    5665
    57       // copying data
    58       // Peter, too much copying. Move the copying outside loop and
    59       // use a vector view (when available in gslapi::vector class).
    60       gslapi::vector x(nof_points);
    61       gslapi::vector y(nof_points);
     66     
     67     
     68      gslapi::vector x(x_total, min_index, nof_points);
     69      //for (size_t j=0; j<x.size(); j++)
     70      //  x(j)=data_[min_index+j].first;
     71
     72      gslapi::vector y(y_total, min_index, nof_points);
     73      //for (size_t j=0; j<y.size(); j++){
     74      //  y(j)=data_[min_index+j].second;
     75      //}
     76
     77      // calculating weights
    6278      gslapi::vector w(nof_points);
    63       for (size_t j=0; j<x.size(); j++)
    64         x(j)=data_[min_index+j].first;
    65       for (size_t j=0; j<y.size(); j++){
    66         y(j)=data_[min_index+j].second;
    67       }
    68       // calculating weights
    6979      for (size_t j=0; j<y.size(); j++)
    7080        w(j) = kernel_->weight( (x(j)-(data_[min_index].first+
Note: See TracChangeset for help on using the changeset viewer.