Example #1
0
int main(int argc, char **argv)
{
    print_version(argv[0]);

    if(argc==1)
    {
        cerr << "Not enough arguments \nPlease try \"" << argv[0] << " -h\" or \"" << argv[0] << " --help \" \n" << endl;
        return 0;
    }

    if ((!strcmp(argv[1],"-h")) | (!strcmp(argv[1],"--help"))) getHelp(argv);

    disp_argv(argc,argv);

    // Start Chrono
    cpuChrono C;
    C.start();

    SymMatrix HeadMat;

    HeadMat.load(argv[1]);
    HeadMat.invert(); // invert inplace
    HeadMat.save(argv[2]);

    // Stop Chrono
    C.stop();
    C.dispEllapsed();

    return 0;
}
Example #2
0
int main(int argc, char **argv)
{
    print_version(argv[0]);

    if(argc==1)
    {
        cerr << "Not enough arguments \nPlease try \"" << argv[0] << " -h\" or \"" << argv[0] << " --help \" \n" << endl;
        return 0;
    }

    if ((!strcmp(argv[1],"-h")) | (!strcmp(argv[1],"--help"))) getHelp(argv);

    disp_argv(argc,argv);

    // Start Chrono
    auto start_time = std::chrono::system_clock::now();

    SymMatrix HeadMat;

    HeadMat.load(argv[1]);
    HeadMat.invert(); // invert inplace
    HeadMat.save(argv[2]);

    // Stop Chrono
    auto end_time = std::chrono::system_clock::now();
    dispEllapsed(end_time-start_time);

    return 0;
}
Example #3
0
int main( int argc, char **argv)
{
    print_version(argv[0]);
    //TODO doesn't say txt, if you don't specify it

    command_usage("Provides informations on a Matrix generated with OpenMEEG");
    const char *filename = command_option("-i",(const char *) NULL,"Matrix file");
    const char *txt = command_option("-txt",(const char *) 0,"Force reading data stored in ascii format");
    const char *sym = command_option("-sym",(const char *) 0,"Data are symmetric matrices");
    const char *sparse = command_option("-sparse",(const char *) 0,"Data are sparse matrices");
    const char *mat = command_option("-mat",(const char *) 0,"Data are matlab format");
    const char *bin = command_option("-bin",(const char *) 0,"Data are binary format");
    if (command_option("-h",(const char *)0,0)) return 0;

    if (!filename) {
        cerr << "Please set Matrix File" << endl;
        exit(1);
    }

    cout << "Loading : " << filename << endl;

    if (sym) {
        if (txt) {
            SymMatrix M;
            M.load(filename);
            cout << "Format : ASCII" << endl;
            print_infos(M);
        } else if (mat) {
            cerr << "Unsupported Format : MAT for symmetric matrices" << endl;
            exit(1);
        } else if (bin) {
            SymMatrix M;
            M.load(filename);
            cout << "Format : BINARY" << endl;
            print_infos(M);
        } else {
            SymMatrix M;
            M.load(filename);
            print_infos(M);
        }
    } else if (sparse) {
        if (txt) {
            SparseMatrix M;
            M.load(filename);
            cout << "Format : ASCII" << endl;
            print_infos(M);
        } else if (mat) {
            SparseMatrix M;
            M.load(filename);
            cout << "Format : MAT" << endl;
            print_infos(M);
        } else if (bin) {
            SparseMatrix M;
            M.load(filename);
            cout << "Format : BINARY" << endl;
            print_infos(M);
        } else {
            SparseMatrix M;
            M.load(filename);
            print_infos(M);
        }
    } else {
        if (txt) {
            Matrix M;
            M.load(filename);
            cout << "Format : ASCII" << endl;
            print_infos(M);
        } else if (mat) {
            Matrix M;
            M.load(filename);
            cout << "Format : MAT" << endl;
            print_infos(M);
        } else if (bin) {
            Matrix M;
            M.load(filename);
            cout << "Format : BINARY" << endl;
            print_infos(M);
        } else {
            Matrix M;
            M.load(filename);
            print_infos(M);
        }
    }

    return 0;
}