Changeset 1098 for trunk/yat/classifier


Ignore:
Timestamp:
Feb 18, 2008, 4:13:53 AM (13 years ago)
Author:
Jari Häkkinen
Message:

Fixes #299. Memory leak in matrix was found and removed.

Location:
trunk/yat/classifier
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/KNN.h

    r1050 r1098  
    251251    // for each test sample (column in distances) find the closest
    252252    // training samples
    253     prediction.clone(utility::matrix(target_.nof_classes(),test.columns(),0.0));
     253    prediction.resize(target_.nof_classes(),test.columns(),0.0);
    254254    for(size_t sample=0;sample<distances->columns();sample++) {
    255255      std::vector<size_t> k_index;
  • trunk/yat/classifier/Kernel_SEV.cc

    r1000 r1098  
    4747    : Kernel(data,kf, own)
    4848  {
    49     kernel_matrix_.clone(utility::matrix(data_->columns(),data_->columns()));
     49    kernel_matrix_.resize(data_->columns(),data_->columns());
    5050    for (size_t i=0; i<kernel_matrix_.rows(); i++)
    5151      for (size_t j=i; j<kernel_matrix_.columns(); j++)
     
    6666  void Kernel_SEV::build_kernel(void)
    6767  {
    68     kernel_matrix_.clone(utility::matrix(data_->columns(),data_->columns()));
     68    kernel_matrix_.resize(data_->columns(),data_->columns());
    6969    for (size_t i=0; i<kernel_matrix_.rows(); i++)
    7070      for (size_t j=i; j<kernel_matrix_.columns(); j++)
  • trunk/yat/classifier/NCC.h

    r1089 r1098  
    232232       "NCC::predict test data with incorrect number of rows");
    233233   
    234     prediction.clone(utility::matrix(centroids_->columns(), test.columns()));       
     234    prediction.resize(centroids_->columns(), test.columns());
    235235
    236236    // unweighted test data
  • trunk/yat/classifier/SVM.cc

    r1087 r1098  
    158158      const KernelLookup& input_kernel =dynamic_cast<const KernelLookup&>(input);
    159159      assert(input.rows()==alpha_.size());
    160       prediction.clone(utility::matrix(2,input.columns(),0));
     160      prediction.resize(2,input.columns(),0);
    161161      for (size_t i = 0; i<input.columns(); i++){
    162162        for (size_t j = 0; j<input.rows(); j++){
Note: See TracChangeset for help on using the changeset viewer.