Ignore:
Timestamp:
Feb 26, 2008, 8:06:28 PM (14 years ago)
Author:
Peter
Message:

removed dynamic_casts

File:
1 edited

Legend:

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

    r1134 r1165  
    2626*/
    2727
    28 #include "DataLookup2D.h"
    2928#include "FeatureSelector.h"
    3029#include "KernelLookup.h"
     
    280279      training_target_.push_back(Target(target(),training_index(k)));
    281280      validation_target_.push_back(Target(target(),validation_index(k)));
    282       const DataLookup2D* matrix = kernel.data();
    283       // dynamically allocated must be deleted
    284       const DataLookup2D* training_matrix =
    285         matrix->training_data(training_index(k));
    286       if (matrix->weighted()){
    287         const MatrixLookupWeighted& ml =
    288           dynamic_cast<const MatrixLookupWeighted&>(*matrix);
    289         f_selector_->update(MatrixLookupWeighted(ml,training_index(k),false),
     281
     282      if (kernel.weighted()){
     283        utility::SmartPtr<const MatrixLookupWeighted> ml=kernel.data_weighted();
     284        f_selector_->update(MatrixLookupWeighted(*ml,training_index(k),false),
    290285                            training_target(k));
    291286      }
    292287      else {
    293         const MatrixLookup& ml =
    294           dynamic_cast<const MatrixLookup&>(*matrix);
    295         f_selector_->update(MatrixLookup(ml,training_index(k), false),
     288        utility::SmartPtr<const MatrixLookup> ml=kernel.data();
     289        f_selector_->update(MatrixLookup(*ml,training_index(k), false),
    296290                            training_target(k));
    297291      }
     
    300294      //features_.push_back(f_selector_->features());
    301295      const KernelLookup* kl = kernel.selected(features_.back());
    302       utility::yat_assert<std::runtime_error>(training_matrix);
    303       delete training_matrix;
    304296     
    305297      // Dynamically allocated. Must be deleted in destructor.
Note: See TracChangeset for help on using the changeset viewer.