Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
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
miscmaths
Commits
5f6e7866
Commit
5f6e7866
authored
7 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: remove obsolete debugging macros and statements
parent
7c9e4d9f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
miscmaths.cc
+1
-21
1 addition, 21 deletions
miscmaths.cc
miscmaths.h
+0
-3
0 additions, 3 deletions
miscmaths.h
sparsefn.cc
+0
-24
0 additions, 24 deletions
sparsefn.cc
with
1 addition
and
48 deletions
miscmaths.cc
+
1
−
21
View file @
5f6e7866
...
...
@@ -553,8 +553,6 @@ namespace MISCMATHS {
if
(
eigenvals
(
i
+
1
)
>
tolerance
)
therank
++
;
// cout << "tolerance = " << tolerance << "\n" << "eigenvalues = " << eigenvals << "\n" << "rank = " << therank << endl;
return
therank
;
}
...
...
@@ -2520,16 +2518,12 @@ namespace MISCMATHS {
/////////////////////
// setup
OUT
(
"Setup"
);
int
ntpts
=
Y
.
Nrows
();
int
nevs
=
X
.
Ncols
();
if
(
ntpts
!=
X
.
Nrows
())
throw
Exception
(
"COCK"
);
OUT
(
nevs
);
OUT
(
ntpts
);
throw
Exception
(
"Number of time points does not match number of rows in design matrix!"
);
ColumnVector
gam_m
(
nevs
);
gam_m
=
1e10
;
...
...
@@ -2552,7 +2546,6 @@ namespace MISCMATHS {
}
else
{
OUT
(
"no ols"
);
B
.
ReSize
(
nevs
);
B
=
0
;
lambdaB
=
1
;
...
...
@@ -2563,9 +2556,6 @@ namespace MISCMATHS {
gam_y
=
10
;
}
// OUT(B(1));
// OUT(lambdaB(1));
float
trace_ilambdaZZ
=
1
;
SymmetricMatrix
ZZ
;
...
...
@@ -2579,12 +2569,10 @@ namespace MISCMATHS {
/////////////////////
// iterate
OUT
(
"Iterate"
);
int
i
=
1
;;
for
(;
i
<=
niters
;
i
++
)
{
cout
<<
i
<<
","
;
////////////////////
// update phim
for
(
int
l
=
1
;
l
<=
nevs
;
l
++
)
...
...
@@ -2597,8 +2585,6 @@ namespace MISCMATHS {
gam_m
(
l
)
=
b_m
*
c_m
;
}
// OUT(gam_m(1));
////////////////////
// update B
ColumnVector
beta
(
nevs
);
...
...
@@ -2634,7 +2620,6 @@ namespace MISCMATHS {
tmp2
<<
tmp3
*
ZZ
;
trace_ilambdaZZ
=
tmp2
.
Trace
();
// OUT(trace_ilambdaZZ);
/////////////////////
...
...
@@ -2649,12 +2634,7 @@ namespace MISCMATHS {
float
b_y
=
1.0
/
(
0.5
*
(
sum
+
trace_ilambdaZZ
)
+
1
/
b_y0
);
gam_y
=
b_y
*
c_y
;
// OUT(gam_y);
}
cout
<<
endl
;
}
vector
<
float
>
ColumnVector2vector
(
const
ColumnVector
&
col
)
...
...
This diff is collapsed.
Click to expand it.
miscmaths.h
+
0
−
3
View file @
5f6e7866
...
...
@@ -37,9 +37,6 @@ namespace MISCMATHS {
#define M_PI 3.14159265358979323846
#endif
#define OUT(t) std::cout<<#t "="<<t<<std::endl;
#define LOGOUT(t) Utilities::LogSingleton::getInstance().str()<<#t "="<<t<<std::endl;
// IO/string stuff
template
<
class
T
>
std
::
string
num2str
(
T
n
,
int
width
=-
1
);
...
...
This diff is collapsed.
Click to expand it.
sparsefn.cc
+
0
−
24
View file @
5f6e7866
...
...
@@ -354,16 +354,12 @@ namespace MISCMATHS {
Tracer_Plus
trace
(
"sparsefns::solvefortracex"
);
int
every
=
Max
(
1
,
A
.
Ncols
()
/
nsamps
);
// int every = 1;
// OUT(every);
float
tr
=
0.0
;
// assumes symmetric A and b
for
(
int
r
=
every
;
r
<=
A
.
Ncols
();
r
+=
every
)
{
// cout << float(r)/A.Ncols() << "\r";
// cout.flush();
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
...
...
@@ -381,8 +377,6 @@ namespace MISCMATHS {
tr
+=
xr
(
r
);
}
cout
<<
endl
;
tr
*=
every
;
return
tr
;
...
...
@@ -395,8 +389,6 @@ namespace MISCMATHS {
// assumes symmetric A and b
for
(
int
r
=
1
;
r
<=
A
.
Ncols
();
r
++
)
{
cout
<<
float
(
r
)
/
A
.
Ncols
()
<<
"
\r
"
;
cout
.
flush
();
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
...
...
@@ -411,7 +403,6 @@ namespace MISCMATHS {
}
}
}
cout
<<
endl
;
}
void
solveforx
(
const
SparseMatrix
&
A
,
const
ColumnVector
&
b
,
ColumnVector
&
x
,
float
tol
,
int
kmax
)
...
...
@@ -454,29 +445,14 @@ namespace MISCMATHS {
multiply
(
A
,
p
,
w
);
float
alpha
=
0.0
;
//if(k>1)
alpha
=
rho
(
k
-
1
)
/
(
p
.
t
()
*
w
).
AsScalar
();
//else
//alpha = 1;
x
+=
alpha
*
p
;
r
-=
alpha
*
w
;
rho
(
k
)
=
Sqr
(
norm2
(
r
));
}
if
(
k
>
kmax
/
2.0
)
{
OUT
(
std
::
sqrt
(
rho
(
k
-
1
)));
OUT
(
norm2
(
b
));
OUT
(
k
);
cout
.
flush
();
}
}
// write_ascii_matrix("rho",rho);
}
void
solveforx
(
const
SparseMatrix
&
U
,
const
SparseMatrix
&
L
,
const
ColumnVector
&
b
,
ColumnVector
&
x
)
...
...
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