예제 #1
0
파일: diag.cpp 프로젝트: ramja/TDA-1
 // [[Rcpp::export]]
Rcpp::List
GridDiag(const Rcpp::NumericVector & FUNvalues
       , const Rcpp::IntegerVector & gridDim
       , const int                   maxdimension
       , const std::string         & decomposition
       , const std::string         & library
       , const bool                  location
       , const bool                  printProgress
	) {
#ifdef LOGGING
	//rlog::RLogInit(argc, argv);

	stdoutLog.subscribeTo(RLOG_CHANNEL("topology/persistence"));
	//stdoutLog.subscribeTo(RLOG_CHANNEL("topology/chain"));
	//stdoutLog.subscribeTo(RLOG_CHANNEL("topology/vineyard"));
#endif

	std::vector< std::vector< std::vector< double > > > persDgm;
	std::vector< std::vector< std::vector< unsigned > > > persLoc;
	std::vector< std::vector< std::vector< std::vector< unsigned > > > > persCycle;

	Fltr f;

	// Generate simplicial complex from function values and grid
	if (decomposition[0] == '5') {
		simplicesFromGrid(f, FUNvalues, gridDim, maxdimension + 1);
	}
	if (decomposition[0] == 'b') {
		simplicesFromGridBarycenter(f, FUNvalues, gridDim, maxdimension + 1);
	}
	if (printProgress) {
		Rprintf("# Generated complex of size: %d \n", f.size());
	}

	// Sort the simplices with respect to function values
	f.sort(Smplx::DataComparison());

	// Compute the persistence diagram of the complex
	if (library[0] == 'D') {
		computePersistenceDionysus< Persistence >(f, Smplx::DataEvaluator(),
				maxdimension, FUNvalues, location, printProgress,
				persDgm, persLoc, persCycle);
	}
	if (library[0] == 'P') {
		 computePersistencePhat(f, Smplx::DataEvaluator(), maxdimension,
				FUNvalues, location, printProgress, persDgm, persLoc);
	}

	// Output persistent diagram
	return Rcpp::List::create(
		concatStlToRcpp< Rcpp::NumericMatrix >(persDgm, true, 3),
		concatStlToRcpp< Rcpp::NumericMatrix >(persLoc, false, 2),
		StlToRcppMatrixList< Rcpp::List, Rcpp::NumericMatrix >(persCycle));
}
예제 #2
0
void        program_options(int argc, char* argv[], std::string& complex_fn, 
                                                    std::string& values_fn, 
                                                    std::string& output_prefix, 
                                                    bool& skip_infinite_vines,
                                                    bool& save_vines,
                                                    bool& explicit_events)
{
    namespace po = boost::program_options;

    po::options_description     hidden("Hidden options");
    hidden.add_options()
        ("complex-file",        po::value<std::string>(&complex_fn),            "file listing the simplices of the complex")
        ("values-file",         po::value<std::string>(&values_fn),             "file listing the values at the vertices")
        ("output-prefix",       po::value<std::string>(&output_prefix),         "output prefix");
    
    po::options_description visible("Allowed options", 100);
    visible.add_options()
        ("skip-infinite,s",     po::bool_switch(&skip_infinite_vines),                          "skip infinite vines in the output")
        ("explicit-events,e",   po::bool_switch(&explicit_events),                              "process kinetic sort events one by one")
        ("save-vines,v",        po::bool_switch(&save_vines),                                   "save vines instead of edges")
        ("help,h",                                                                              "produce help message");
#if LOGGING
    std::vector<std::string>    log_channels;
    visible.add_options()
        ("log,l",               po::value< std::vector<std::string> >(&log_channels),           "log channels to turn on (info, debug, etc)");
#endif

    po::positional_options_description pos;
    pos.add("complex-file", 1);
    pos.add("values-file", 1);
    pos.add("output-prefix", 1);
    
    po::options_description all; all.add(visible).add(hidden);

    po::variables_map vm;
    po::store(po::command_line_parser(argc, argv).
                  options(all).positional(pos).run(), vm);
    po::notify(vm);

#if LOGGING
    for (std::vector<std::string>::const_iterator cur = log_channels.begin(); cur != log_channels.end(); ++cur)
        stderrLog.subscribeTo( RLOG_CHANNEL(cur->c_str()) );
#endif

    if (vm.count("help") || !vm.count("complex-file") || !vm.count("values-file") || !vm.count("output-prefix"))
    { 
        std::cout << "Usage: " << argv[0] << " [options] complex-file values-file output-prefix" << std::endl;
        std::cout << visible << std::endl; 
        std::abort();
    }
}
예제 #3
0
int main(int argc, char **argv) {


    rlog::StdioNode client_log(1, rlog::StdioNode::OutputColor);

    client_log.subscribeTo( RLOG_CHANNEL("debug") ) ;
    client_log.subscribeTo( RLOG_CHANNEL("error") ) ;
    client_log.subscribeTo( RLOG_CHANNEL("info") );
    client_log.subscribeTo( RLOG_CHANNEL("warning") );

    client_log.subscribeTo( RLOG_CHANNEL("fuse/control") ) ;
    client_log.subscribeTo( RLOG_CHANNEL("intercom/user_harmony/control") ) ;
    //client_log.subscribeTo( RLOG_CHANNEL("sink") ) ;

    colony::CSScheduler::SetCSL();

    colonyfs_fusexx hello;

    // The first 3 parameters are identical to the fuse_main function.
    // The last parameter gives a pointer to a class instance, which is
    // required for static methods to access instance variables/ methods.
    return hello.main(argc, argv, NULL, &hello);
}
예제 #4
0
// This file os part of FVM
// Copyright (c) 2012 FVM Authors
// See LICENSE file for terms.

#include "RLogInterface.h"

rlog::RLogChannel* RLogInterface::ctorChannel = RLOG_CHANNEL("cdtor/ctor");
rlog::RLogChannel* RLogInterface::dtorChannel = RLOG_CHANNEL("cdtor/dtor");
rlog::RLogChannel* RLogInterface::infoChannel = RLOG_CHANNEL("info");
rlog::RLogChannel* RLogInterface::warningChannel = RLOG_CHANNEL("info/warning");
rlog::RLogChannel* RLogInterface::errorChannel = RLOG_CHANNEL("info/error");