Ignore:
Timestamp:
Mar 5, 2008, 3:56:13 AM (14 years ago)
Author:
Peter
Message:

returning SmartPtr? rather than conventional pointer when object is dynamically allocated - also fixed bug in SubsetGenerator? for Kernel with feature selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/KernelLookup.cc

    r1168 r1201  
    2828
    2929#include <cassert>
    30 #ifndef NDEBUG
    31 #include <algorithm>
    32 #endif
    3330
    3431namespace theplu {
     
    187184
    188185
    189   const KernelLookup*
     186  utility::SmartPtr<const KernelLookup>
    190187  KernelLookup::selected(const utility::Index& inputs) const
    191188  {
     
    203200      kernel = kernel_->make_kernel(*ms,true);
    204201    }
    205     return new KernelLookup(*kernel, true);
    206   }
    207 
    208 
    209   const KernelLookup* KernelLookup::test_kernel(const MatrixLookup& data) const
    210   {
    211 
     202    return utility::SmartPtr<const KernelLookup>
     203      (new KernelLookup(*kernel, true));
     204  }
     205
     206
     207  utility::SmartPtr<const KernelLookup>
     208  KernelLookup::test_kernel(const MatrixLookup& data) const
     209  {
    212210    if (!weighted()){
    213211      assert(data.rows()==kernel_->data().rows());
     
    242240        kernel_->make_kernel(*tmp, true);
    243241
    244       return new KernelLookup(*kernel, utility::Index(row_index),
    245                               utility::Index(column_index), true);
     242      return utility::SmartPtr<const KernelLookup>
     243        (new KernelLookup(*kernel, utility::Index(row_index),
     244                          utility::Index(column_index), true));
    246245    }
    247246
     
    281280                                                         *weight_all, true);
    282281    const Kernel* kernel = kernel_->make_kernel(*tmp, true);
    283     return new KernelLookup(*kernel, row_index_,
    284                             utility::Index(column_index), true);
    285   }
    286 
    287 
    288 
    289   const KernelLookup*
     282
     283
     284    return utility::SmartPtr<const KernelLookup>
     285      (new KernelLookup(*kernel, row_index_,
     286                        utility::Index(column_index), true));
     287  }
     288
     289
     290
     291  utility::SmartPtr<const KernelLookup>
    290292  KernelLookup::test_kernel(const MatrixLookupWeighted& data) const
    291293  {
     
    329331    const Kernel* kernel =
    330332      kernel_->make_kernel(MatrixLookupWeighted(*data_all, *weight_all, true));
    331     return new KernelLookup(*kernel, row_index_,
    332                             utility::Index(column_index), true);
     333    return utility::SmartPtr<const KernelLookup>
     334      (new KernelLookup(*kernel, row_index_,
     335                        utility::Index(column_index), true));
    333336  }
    334337
Note: See TracChangeset for help on using the changeset viewer.