forked from freesurfer/freesurfer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcpptester.cpp
112 lines (96 loc) · 2.12 KB
/
cpptester.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <fstream>
#define export
#include <vnl/vnl_matrix.h>
#include <vnl/vnl_inverse.h>
#include <vnl/algo/vnl_matrix_inverse.h>
#include "error.h"
#include "macros.h"
#include "mri.h"
#include "transform.h"
#include "resample.h"
#include "registerio.h"
#include "version.h"
using namespace std;
static void printUsage(void);
static bool parseCommandLine(int argc, char *argv[]);
static int parseNextCommand(int argc, char *argv[]);
const char *Progname = NULL;
float myrand(float f);
int main(int argc, char *argv[])
{
cout << getVersion() << endl << endl;
// Default initialization
int nargs = handleVersionOption(argc, argv, "cpptester");
if (nargs && argc - nargs == 1)
{
exit(0);
}
argc -= nargs;
Progname = argv[0];
argc--;
argv++;
ErrorInit(NULL, NULL, NULL);
while(1){
vnl_matrix<float> M(3000,3000);
vnl_matrix<float> Q = M.apply(&myrand);
}
vnl_matrix<float> N(3,2);
//vnl_matrix<float> Q = M.apply(&myrand);
//Q.print(cout);
//vnl_matrix<float> Qinv = vnl_inverse(Q);
//vnl_matrix<float> Qinv = vnl_matrix_inverse<float>(Q);
//Qinv.print(cout);
//N.fill(3);
//M.fill_diagonal(2);
//vnl_matrix<float> S = M*N;
//N.print(cout);
//printf("is_zero %d\n",M.is_zero());
//printf("is_ident %d\n",M.is_identity());
// Parse command line
if (!parseCommandLine(argc, argv))
{
//printUsage();
exit(1);
}
}
static void printUsage(void)
{
printf("usage\n");
}
static int parseNextCommand(int argc, char *argv[])
{
int nargs = 0;
char *option;
option = argv[0] + 1; // remove '-'
if (option[0] == '-')
{
option = option + 1; // remove second '-'
}
fflush(stdout);
return (nargs);
}
static bool parseCommandLine(int argc, char *argv[])
{
int nargs;
int inputargs = argc;
for (; argc > 0 && ISOPTION(*argv[0]); argc--, argv++)
{
nargs = parseNextCommand(argc, argv);
argc -= nargs;
argv += nargs;
}
if (inputargs == 0)
{
printUsage();
exit(1);
}
return true;
}
float myrand(float f)
{
return((float)drand48());
}