int main()
{
SampleType::Pointer sample = SampleType::New();
MeasurementVectorType mv;
mv[0] = 1.0;
mv[1] = 2.0;
mv[2] = 4.0;
sample->PushBack(mv);
mv[0] = 2.0;
mv[1] = 4.0;
mv[2] = 5.0;
sample->PushBack(mv);
mv[0] = 3.0;
mv[1] = 8.0;
mv[2] = 6.0;
sample->PushBack(mv);
SubsampleType::Pointer subsample = SubsampleType::New();
subsample->SetSample( sample );
subsample->AddInstance( 0UL );
subsample->AddInstance( 2UL );
SubsampleType::Iterator iter = subsample->Begin();
while ( iter != subsample->End() )
{
std::cout << "instance identifier = " << iter.GetInstanceIdentifier()
<< "\t measurement vector = "
<< iter.GetMeasurementVector()
<< "\t frequency = "
<< iter.GetFrequency()
<< std::endl;
++iter;
}
subsample->Swap(0, 1);
for ( int index = 0; index < subsample->Size(); ++index )
{
std::cout << "instance identifier = "
<< subsample->GetInstanceIdentifier(index)
<< "\t measurement vector = "
<< subsample->GetMeasurementVectorByIndex(index)
<< std::endl;
}
std::cout << "Size = " << subsample->Size() << std::endl;
std::cout << "Total frequency = "
<< subsample->GetTotalFrequency() << std::endl;
subsample->Clear();
std::cout << "Size = " << subsample->Size() << std::endl;
std::cout << "Total frequency = "
<< subsample->GetTotalFrequency() << std::endl;
return 0;
}