Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
melodic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
melodic
Commits
b0a3d565
Commit
b0a3d565
authored
17 years ago
by
Christian Beckmann
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
ff383277
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.cc
+73
-77
73 additions, 77 deletions
test.cc
with
73 additions
and
77 deletions
test.cc
+
73
−
77
View file @
b0a3d565
...
@@ -4,89 +4,85 @@
...
@@ -4,89 +4,85 @@
/* CCOPYRIGHT */
/* CCOPYRIGHT */
#include
<iostream>
#include
"libvis/miscplot.h"
#include
"newmatap.h"
#include
"newmatio.h"
#include
"newimage/newimageall.h"
#include
"miscmaths/miscmaths.h"
#include
"miscmaths/miscmaths.h"
#include
"miscmaths/miscprob.h"
#include
"miscmaths/miscprob.h"
#include
<string>
#include
"utils/options.h"
#include
"utils/log.h"
#include
<vector>
#include
"melgmix.h"
#include
"meloptions.h"
using
namespace
MISCPLOT
;
#include
"melhlprfns.h"
using
namespace
MISCMATHS
;
#include
<time.h>
using
namespace
Utilities
;
#include
"miscmaths/miscprob.h"
using
namespace
std
;
// The two strings below specify the title and example usage that is
// printed out as the help or usage message
using
namespace
std
;
string
title
=
"test (Version 1.0)
\n
Copyright(c) 2007, University of Oxford (Christian F. Beckmann)"
;
using
namespace
Utilities
;
string
examples
=
"test int"
;
using
namespace
NEWIMAGE
;
using
namespace
Melodic
;
Option
<
bool
>
help
(
string
(
"--help"
),
false
,
string
(
" display this message"
),
false
,
no_argument
);
Option
<
int
>
num
(
string
(
"--num"
),
1
,
string
(
"number of iterations"
),
false
,
requires_argument
);
void
usage
(
void
)
int
nonoptarg
;
{
cout
<<
"Usage: test infile ICfile [mixfile]"
<<
endl
;
////////////////////////////////////////////////////////////////////////////
exit
(
1
);
}
int
main
(
int
argc
,
char
*
argv
[])
// Local functions
int
do_work
(
int
argc
,
char
*
argv
[])
{
{
Matrix
Mats
;
Matrix
mat
;
Matrix
A
,
C
;
mat
=
normrnd
(
300
,(
int
)
num
.
value
())
+
2
;
RowVector
B
;
cout
<<
"BLAH "
<<
num
.
value
()
<<
endl
;
Mats
=
normrnd
(
5
,
10
);
for
(
int
i
=
1
;
i
<=
(
int
)
num
.
value
();
i
++
){
std_pca
(
Mats
,
C
,
A
,
B
);
cout
<<
"Processing "
<<
i
<<
endl
;
miscplot
newplot
;
cout
<<
" STD PCA : "
<<
endl
<<
A
<<
endl
<<
endl
<<
B
<<
endl
<<
endl
;
ColumnVector
col
;
em_pca
(
Mats
,
A
,
B
,
4
);
col
=
mat
.
Column
(
i
);
cout
<<
" EM PCA : "
<<
endl
<<
A
<<
endl
<<
endl
<<
B
<<
endl
<<
endl
;
newplot
.
add_bpdata
(
col
);
newplot
.
boxplot
(
string
(
"test"
)
+
num2str
(
i
)
+
string
(
".png"
),
string
(
"TEST"
));
string
RAWfname
;
}
RAWfname
=
string
(
argv
[
1
]);
return
0
;
volume4D
<
float
>
RawData
;
volumeinfo
VolInfo
;
cout
<<
" Reading orig. data "
<<
RAWfname
<<
" ... "
<<
endl
<<
endl
;
read_volume4D
(
RawData
,
RAWfname
,
VolInfo
);
Matrix
mat
;
volume
<
float
>
RawData2
;
read_volume
(
RawData2
,
RAWfname
);
print_size
(
RawData2
);
A
=
normrnd
(
7
,
3
);
C
=
normrnd
(
5
,
3
);
cout
<<
" here "
<<
endl
;
Mats
=
krprod
(
A
,
C
);
cout
<<
" A : "
<<
A
<<
endl
<<
endl
;
cout
<<
" B : "
<<
C
<<
endl
<<
endl
;
cout
<<
" C : "
<<
Mats
<<
endl
<<
endl
;
write_ascii_matrix
(
string
(
"A"
),
A
);
write_ascii_matrix
(
string
(
"B"
),
C
);
write_ascii_matrix
(
string
(
"C"
),
Mats
);
Matrix
tmpA
,
tmpB
;
tmpA
=
zeros
(
A
.
Nrows
(),
A
.
Ncols
());
tmpB
=
zeros
(
C
.
Nrows
(),
C
.
Ncols
());
krfact
(
Mats
,
tmpA
,
tmpB
);
cout
<<
" A2 : "
<<
tmpA
<<
endl
<<
endl
;
cout
<<
" B2 : "
<<
tmpB
<<
endl
<<
endl
;
write_ascii_matrix
(
string
(
"A2"
),
tmpA
);
write_ascii_matrix
(
string
(
"B2"
),
tmpB
);
tmpA
=
krapprox
(
Mats
,
tmpA
.
Nrows
());
write_ascii_matrix
(
string
(
"C2"
),
tmpA
);
return
0
;
}
}
////////////////////////////////////////////////////////////////////////////
int
main
(
int
argc
,
char
*
argv
[])
{
Tracer
tr
(
"main"
);
OptionParser
options
(
title
,
examples
);
try
{
// must include all wanted options here (the order determines how
// the help message is printed)
options
.
add
(
help
);
options
.
add
(
num
);
options
.
parse_command_line
(
argc
,
argv
);
// line below stops the program if the help was requested or
// a compulsory option was not set
if
(
(
help
.
value
())
||
(
!
options
.
check_compulsory_arguments
(
true
))
)
{
options
.
usage
();
exit
(
EXIT_FAILURE
);
}
}
catch
(
X_OptionError
&
e
)
{
options
.
usage
();
cerr
<<
endl
<<
e
.
what
()
<<
endl
;
exit
(
EXIT_FAILURE
);
}
catch
(
std
::
exception
&
e
)
{
cerr
<<
e
.
what
()
<<
endl
;
}
// Call the local functions
return
do_work
(
argc
,
argv
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment