void dsp_stats(NSLNSLnet *net) { int rr,qq,pp,nn,num,parts,flds,outnum=0,probnum=0; hop_ctrl_ds *hp=nsl_drv(hop_ctrl_ds); bio_ds *np=(&hp->nio); float val,hamap,hamai,phamap,phamai,ham,prob; flds=np->fld_siz; num=dsi(np->flda,hop_tree_ds,size.part); parts=flds/num; ++stats; for(rr=0;rr<num_pats;++rr) {hamap=(float)0.0; hamai=(float)0.0; phamap=(float)0.0; phamai=(float)0.0; for(pp=0;pp<parts;++pp) {for(qq=0;qq<num;++qq) {nn=pp*num+qq; val=(float)((quant)qua(np->flda+pp,hop_tree_ds,part[qq].output)) /((float)QSCALE); hamap+=diff((float)patsa[rr][nn],val); val=(float)1.0-val; hamai+=diff((float)patsa[rr][nn],val); val=(float)((quant)qua(np->fldb+pp,hop_tree_ds,part[qq].output)) /((float)QSCALE); hamap+=diff((float)patsb[rr][nn],val); val=(float)1.0-val; hamai+=diff((float)patsb[rr][nn],val); val=dsf(np->ctrl,hop_ctrl_ds,output[nn]); phamap+=diff((float)patsa[rr][nn],val); val=(float)1.0-val; phamai+=diff((float)patsa[rr][nn],val); val=dsf(np->ctrl,hop_ctrl_ds,output[nn+flds]); phamap+=diff((float)patsb[rr][nn],val); val=(float)1.0-val; phamai+=diff((float)patsb[rr][nn],val); } } if(rr==0) {ham=hamap; prob=phamap;} if(hamap<ham) {outnum=2*rr; ham=hamap;} if(hamai<ham) {outnum=2*rr+1; ham=hamai;} if(phamap<prob) {probnum=2*rr; prob=phamap;} if(phamai<prob) {probnum=2*rr+1; prob=phamai;} } fprintf(bam_logfp,"%d,%d,%.3f,%.3f,%d,%d,", stats,curcc,ham,prob,outnum,probnum); dsp_table(); clr_table(); }
void FluctuatingChargePropagator::initialize() { if (info_->usesFluctuatingCharges()) { if (info_->getNFluctuatingCharges() > 0) { hasFlucQ_ = true; fqConstraints_ = new FluctuatingChargeConstraints(info_); fqConstraints_->setConstrainRegions(fqParams_->getConstrainRegions()); } } if (!hasFlucQ_) { initialized_ = true; return; } // SimInfo::MoleculeIterator i; // Molecule::FluctuatingChargeIterator j; // Molecule* mol; // Atom* atom; // // For single-minima flucq, this ensures a net neutral system, but // for multiple minima, this is no longer the right thing to do: // // for (mol = info_->beginMolecule(i); mol != NULL; // mol = info_->nextMolecule(i)) { // for (atom = mol->beginFluctuatingCharge(j); atom != NULL; // atom = mol->nextFluctuatingCharge(j)) { // atom->setFlucQPos(0.0); // atom->setFlucQVel(0.0); // } // } FluctuatingChargeObjectiveFunction flucQobjf(info_, forceMan_, fqConstraints_); DynamicVector<RealType> initCoords = flucQobjf.setInitialCoords(); Problem problem(flucQobjf, *(new NoConstraint()), *(new NoStatus()), initCoords); EndCriteria endCriteria(1000, 100, 1e-5, 1e-5, 1e-5); OptimizationMethod* minim = OptimizationFactory::getInstance()->createOptimization("SD", info_); DumpStatusFunction dsf(info_); // we want a dump file written // every iteration minim->minimize(problem, endCriteria); cerr << "back from minim\n"; initialized_ = true; }
void initialize() { shared_ptr<IDataSourceFactory> dsf(static_cast<IDataSourceFactory*>(new XMPDataSourceFactory())); Initialize(dsf); }
void MultipleDatasetComparisonSecondExperiment::runExperiment(std::string outputDir) { // Set up the image filters DownsampleFilter dsf(64, 64); // Dataset images are in a 1:1 ratio. GreyscaleFilter gf; std::list<ImageFilterInterface*> filters; filters.push_back(&dsf); filters.push_back(&gf); // Load the reference dataset std::unique_ptr<CachedDataset> referenceDataset = loadDataset( MultipleDatasetComparisonSecondExperiment::TIME_OF_DAY_NOON, MultipleDatasetComparisonSecondExperiment::PASS_BASELINE, filters); std::cout << "Loaded reference dataset... (" << referenceDataset->count() << " images)" << std::endl; // Set up the place recognition object, salience mask generator, and output image PlaceRecognition placerecog; SumOfAbsoluteDifferencesMatcher sadMatcher; cv::Mat diagonalMatrix; float performance; // Create a RapidJson document to write the results into. rapidjson::Document results(rapidjson::kObjectType); // Set some standard criteria for considering two images to have a 'similar' location SimilarityCriteria similarityCriteria(300.0); // For each test time of day, for each pass through, measure the performance // This will match the reference set against itself for (int timeOfDay = MultipleDatasetComparisonSecondExperiment::TIME_OF_DAY_DAWN; timeOfDay <= MultipleDatasetComparisonSecondExperiment::TIME_OF_DAY_SUNSET; ++timeOfDay) { std::string timeOfDayString = getTimeOfDayString(timeOfDay); rapidjson::Value nestedResults(rapidjson::kObjectType); for (int pass = MultipleDatasetComparisonSecondExperiment::PASS_FIRST; pass <= MultipleDatasetComparisonSecondExperiment::PASS_LAST; ++pass) { std::string passString = getPassString(pass); std::unique_ptr<CachedDataset> queryDataset = loadDataset(timeOfDay, pass, filters); std::cout << "Loaded test dataset \"" << timeOfDayString << "\" subset \"" << passString << "\" (" << queryDataset->count() << " images)" << std::endl; performance = placerecog.generateDiagonalMatrix(*referenceDataset, *queryDataset, sadMatcher, similarityCriteria, diagonalMatrix); writeFloatImage(outputDir + "\\diagonal matrix " + timeOfDayString + " " + passString + ".png", diagonalMatrix); std::cout << "Matching accuracy for " << timeOfDayString << " " << passString << ": " << (performance * 100) << "%" << std::endl; nestedResults.AddMember( rapidjson::Value(passString.c_str(), results.GetAllocator()).Move(), performance, results.GetAllocator()); } results.AddMember( rapidjson::Value(timeOfDayString.c_str(), results.GetAllocator()).Move(), nestedResults, results.GetAllocator()); } // Serialze the json output. rapidjson::StringBuffer jsonBuffer; rapidjson::PrettyWriter<rapidjson::StringBuffer> jsonWriter(jsonBuffer); results.Accept(jsonWriter); // Write the json file to a string std::ofstream output(outputDir + "\\multiple comparison results.txt"); output << jsonBuffer.GetString(); output.close(); }
int main(int argc, char **argv) { QApplication app(argc, argv); int err = 0; { TestSettingsBookmarks testSettingsBookmarks; err = qMax(err, QTest::qExec(&testSettingsBookmarks, app.arguments())); } { TestPictureItemData testPictureItemData; err = qMax(err, QTest::qExec(&testPictureItemData, app.arguments())); } { TestPictureItemRaster testPictureItemRaster; err = qMax(err, QTest::qExec(&testPictureItemRaster, app.arguments())); } { TestZoomWidget testZoomWidget; err = qMax(err, QTest::qExec(&testZoomWidget, app.arguments())); } { TestZoomWidgetNoDefaults testZoomWidget; err = qMax(err, QTest::qExec(&testZoomWidget, app.arguments())); } const QString base_dir( QDir::cleanPath(QCoreApplication::applicationDirPath() + QDir::separator() + "assets" + QDir::separator() + "images")); DirStructureFixture dsf( DirStructureFixturePathsUnicodeOutsideBMP::getPath , DirStructureFixturePathsUnicodeOutsideBMP::getDirName , DirStructureFixtureDateTimes::getDateTime , DirStructureFixtureSize::getSize , base_dir ); // InitTestData itd; // InitTestArchives ita = itd.makeTestData(dsf); // ita.createZip(); const ArchiveExtractor archive_extractor; { TestArchiveFileListRar5 testArchiveFileListRar5(&archive_extractor, dsf, base_dir); err = qMax(err, QTest::qExec(&testArchiveFileListRar5, app.arguments())); } DirStructureFixture dsfZip( DirStructureFixturePathsUnicodeOutsideBMP::getPath , DirStructureFixturePathsUnicodeOutsideBMP::getDirName , DirStructureFixtureDateTimesLocal::getDateTime , DirStructureFixtureSize::getSize , base_dir ); { TestArchiveFileListZip testArchiveFileListZip(&archive_extractor, dsfZip, base_dir); err = qMax(err, QTest::qExec(&testArchiveFileListZip, app.arguments())); } { TestArchiveFilesZip testArchiveFiles(&archive_extractor, dsfZip); err = qMax(err, QTest::qExec(&testArchiveFiles, app.arguments())); } DirStructureFixture dsfRar4( DirStructureFixturePathsUnicodeInsideBMP::getPath , DirStructureFixturePathsUnicodeInsideBMP::getDirName , DirStructureFixtureDateTimesLocal::getDateTime , DirStructureFixtureSizeUnicodeInsideBMP::getSize , base_dir ); // ita = itd.makeTestData(dsfRar4); // ita.createRar4(); { // TODO: Check rar4 file times behaviour TestArchiveFileListRar4 testArchiveFileListRar4(&archive_extractor, dsfRar4, base_dir); err = qMax(err, QTest::qExec(&testArchiveFileListRar4, app.arguments())); } { TestArchiveFilesRar4 testArchiveFilesRar4(&archive_extractor, dsfRar4); err = qMax(err, QTest::qExec(&testArchiveFilesRar4, app.arguments())); } return err; }
int ocos_probe(NSLNSLnet *net,va_list args) { nio_ds *np=nsl_drv(nio_ds); np->xx=0; dsf(np->d0,data_ds,output)=rndf(); dsf(np->d0+1,data_ds,output)=rndf(); return(0); }