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
26d6e047
Commit
26d6e047
authored
7 months ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: remove obsolete debugging macros and statements
parent
290eb875
No related branches found
No related tags found
1 merge request
!17
ENH: Allow `Splinterpolator` instances to be created from an existing set of spline coefficients, and extend extrapolation options
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 @
26d6e047
...
@@ -553,8 +553,6 @@ namespace MISCMATHS {
...
@@ -553,8 +553,6 @@ namespace MISCMATHS {
if
(
eigenvals
(
i
+
1
)
>
tolerance
)
if
(
eigenvals
(
i
+
1
)
>
tolerance
)
therank
++
;
therank
++
;
// cout << "tolerance = " << tolerance << "\n" << "eigenvalues = " << eigenvals << "\n" << "rank = " << therank << endl;
return
therank
;
return
therank
;
}
}
...
@@ -2520,16 +2518,12 @@ namespace MISCMATHS {
...
@@ -2520,16 +2518,12 @@ namespace MISCMATHS {
/////////////////////
/////////////////////
// setup
// setup
OUT
(
"Setup"
);
int
ntpts
=
Y
.
Nrows
();
int
ntpts
=
Y
.
Nrows
();
int
nevs
=
X
.
Ncols
();
int
nevs
=
X
.
Ncols
();
if
(
ntpts
!=
X
.
Nrows
())
if
(
ntpts
!=
X
.
Nrows
())
throw
Exception
(
"COCK"
);
throw
Exception
(
"Number of time points does not match number of rows in design matrix!"
);
OUT
(
nevs
);
OUT
(
ntpts
);
ColumnVector
gam_m
(
nevs
);
ColumnVector
gam_m
(
nevs
);
gam_m
=
1e10
;
gam_m
=
1e10
;
...
@@ -2552,7 +2546,6 @@ namespace MISCMATHS {
...
@@ -2552,7 +2546,6 @@ namespace MISCMATHS {
}
}
else
else
{
{
OUT
(
"no ols"
);
B
.
ReSize
(
nevs
);
B
.
ReSize
(
nevs
);
B
=
0
;
B
=
0
;
lambdaB
=
1
;
lambdaB
=
1
;
...
@@ -2563,9 +2556,6 @@ namespace MISCMATHS {
...
@@ -2563,9 +2556,6 @@ namespace MISCMATHS {
gam_y
=
10
;
gam_y
=
10
;
}
}
// OUT(B(1));
// OUT(lambdaB(1));
float
trace_ilambdaZZ
=
1
;
float
trace_ilambdaZZ
=
1
;
SymmetricMatrix
ZZ
;
SymmetricMatrix
ZZ
;
...
@@ -2579,12 +2569,10 @@ namespace MISCMATHS {
...
@@ -2579,12 +2569,10 @@ namespace MISCMATHS {
/////////////////////
/////////////////////
// iterate
// iterate
OUT
(
"Iterate"
);
int
i
=
1
;;
int
i
=
1
;;
for
(;
i
<=
niters
;
i
++
)
for
(;
i
<=
niters
;
i
++
)
{
{
cout
<<
i
<<
","
;
////////////////////
////////////////////
// update phim
// update phim
for
(
int
l
=
1
;
l
<=
nevs
;
l
++
)
for
(
int
l
=
1
;
l
<=
nevs
;
l
++
)
...
@@ -2597,8 +2585,6 @@ namespace MISCMATHS {
...
@@ -2597,8 +2585,6 @@ namespace MISCMATHS {
gam_m
(
l
)
=
b_m
*
c_m
;
gam_m
(
l
)
=
b_m
*
c_m
;
}
}
// OUT(gam_m(1));
////////////////////
////////////////////
// update B
// update B
ColumnVector
beta
(
nevs
);
ColumnVector
beta
(
nevs
);
...
@@ -2634,7 +2620,6 @@ namespace MISCMATHS {
...
@@ -2634,7 +2620,6 @@ namespace MISCMATHS {
tmp2
<<
tmp3
*
ZZ
;
tmp2
<<
tmp3
*
ZZ
;
trace_ilambdaZZ
=
tmp2
.
Trace
();
trace_ilambdaZZ
=
tmp2
.
Trace
();
// OUT(trace_ilambdaZZ);
/////////////////////
/////////////////////
...
@@ -2649,12 +2634,7 @@ namespace MISCMATHS {
...
@@ -2649,12 +2634,7 @@ namespace MISCMATHS {
float
b_y
=
1.0
/
(
0.5
*
(
sum
+
trace_ilambdaZZ
)
+
1
/
b_y0
);
float
b_y
=
1.0
/
(
0.5
*
(
sum
+
trace_ilambdaZZ
)
+
1
/
b_y0
);
gam_y
=
b_y
*
c_y
;
gam_y
=
b_y
*
c_y
;
// OUT(gam_y);
}
}
cout
<<
endl
;
}
}
vector
<
float
>
ColumnVector2vector
(
const
ColumnVector
&
col
)
vector
<
float
>
ColumnVector2vector
(
const
ColumnVector
&
col
)
...
...
This diff is collapsed.
Click to expand it.
miscmaths.h
+
0
−
3
View file @
26d6e047
...
@@ -37,9 +37,6 @@ namespace MISCMATHS {
...
@@ -37,9 +37,6 @@ namespace MISCMATHS {
#define M_PI 3.14159265358979323846
#define M_PI 3.14159265358979323846
#endif
#endif
#define OUT(t) std::cout<<#t "="<<t<<std::endl;
#define LOGOUT(t) Utilities::LogSingleton::getInstance().str()<<#t "="<<t<<std::endl;
// IO/string stuff
// IO/string stuff
template
<
class
T
>
std
::
string
num2str
(
T
n
,
int
width
=-
1
);
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 @
26d6e047
...
@@ -354,16 +354,12 @@ namespace MISCMATHS {
...
@@ -354,16 +354,12 @@ namespace MISCMATHS {
Tracer_Plus
trace
(
"sparsefns::solvefortracex"
);
Tracer_Plus
trace
(
"sparsefns::solvefortracex"
);
int
every
=
Max
(
1
,
A
.
Ncols
()
/
nsamps
);
int
every
=
Max
(
1
,
A
.
Ncols
()
/
nsamps
);
// int every = 1;
// OUT(every);
float
tr
=
0.0
;
float
tr
=
0.0
;
// assumes symmetric A and b
// assumes symmetric A and b
for
(
int
r
=
every
;
r
<=
A
.
Ncols
();
r
+=
every
)
for
(
int
r
=
every
;
r
<=
A
.
Ncols
();
r
+=
every
)
{
{
// cout << float(r)/A.Ncols() << "\r";
// cout.flush();
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
...
@@ -381,8 +377,6 @@ namespace MISCMATHS {
...
@@ -381,8 +377,6 @@ namespace MISCMATHS {
tr
+=
xr
(
r
);
tr
+=
xr
(
r
);
}
}
cout
<<
endl
;
tr
*=
every
;
tr
*=
every
;
return
tr
;
return
tr
;
...
@@ -395,8 +389,6 @@ namespace MISCMATHS {
...
@@ -395,8 +389,6 @@ namespace MISCMATHS {
// assumes symmetric A and b
// assumes symmetric A and b
for
(
int
r
=
1
;
r
<=
A
.
Ncols
();
r
++
)
for
(
int
r
=
1
;
r
<=
A
.
Ncols
();
r
++
)
{
{
cout
<<
float
(
r
)
/
A
.
Ncols
()
<<
"
\r
"
;
cout
.
flush
();
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
br
=
b
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
ColumnVector
xr
=
x
.
RowAsColumn
(
r
);
...
@@ -411,7 +403,6 @@ namespace MISCMATHS {
...
@@ -411,7 +403,6 @@ namespace MISCMATHS {
}
}
}
}
}
}
cout
<<
endl
;
}
}
void
solveforx
(
const
SparseMatrix
&
A
,
const
ColumnVector
&
b
,
ColumnVector
&
x
,
float
tol
,
int
kmax
)
void
solveforx
(
const
SparseMatrix
&
A
,
const
ColumnVector
&
b
,
ColumnVector
&
x
,
float
tol
,
int
kmax
)
...
@@ -454,29 +445,14 @@ namespace MISCMATHS {
...
@@ -454,29 +445,14 @@ namespace MISCMATHS {
multiply
(
A
,
p
,
w
);
multiply
(
A
,
p
,
w
);
float
alpha
=
0.0
;
float
alpha
=
0.0
;
//if(k>1)
alpha
=
rho
(
k
-
1
)
/
(
p
.
t
()
*
w
).
AsScalar
();
alpha
=
rho
(
k
-
1
)
/
(
p
.
t
()
*
w
).
AsScalar
();
//else
//alpha = 1;
x
+=
alpha
*
p
;
x
+=
alpha
*
p
;
r
-=
alpha
*
w
;
r
-=
alpha
*
w
;
rho
(
k
)
=
Sqr
(
norm2
(
r
));
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
)
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