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
11933b6f
Commit
11933b6f
authored
20 years ago
by
Tim Behrens
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
2238587b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
miscmaths.cc
+19
-0
19 additions, 0 deletions
miscmaths.cc
miscmaths.h
+2
-1
2 additions, 1 deletion
miscmaths.h
with
21 additions
and
1 deletion
miscmaths.cc
+
19
−
0
View file @
11933b6f
...
...
@@ -1549,6 +1549,25 @@ void powerspectrum(const Matrix &Mat1, Matrix &Result, bool useLog)
}
void
element_mod_n
(
Matrix
&
Mat
,
double
n
)
{
//represent each element in modulo n (useful for wrapping phases (n=2*M_PI))
double
tmp
;
for
(
int
j
=
1
;
j
<=
Mat
.
Ncols
();
j
++
){
for
(
int
i
=
1
;
j
<=
Mat
.
Nrows
();
i
++
){
if
(
!
(
(
Mat
(
i
,
j
)
>
0
)
&&
(
Mat
(
i
,
j
)
<
n
)
)
){
tmp
=
(
Mat
(
i
,
j
)
-
MISCMATHS
::
round
(
Mat
(
i
,
j
)
/
n
)
*
n
);
Mat
(
i
,
j
)
=
tmp
>
0
?
tmp
:
tmp
+
n
;
}
}
}
}
int
nextpow2
(
int
n
)
{
return
(
int
)
pow
(
2
,
ceil
(
log
(
float
(
n
))
/
log
(
float
(
2
))));
...
...
This diff is collapsed.
Click to expand it.
miscmaths.h
+
2
−
1
View file @
11933b6f
...
...
@@ -196,7 +196,8 @@ namespace MISCMATHS {
ReturnMatrix
corrcoef
(
const
Matrix
&
mat
,
const
int
norm
=
0
);
void
symm_orth
(
Matrix
&
Mat
);
void
powerspectrum
(
const
Matrix
&
Mat1
,
Matrix
&
Result
,
bool
useLog
);
void
element_mod_n
(
Matrix
&
Mat
,
double
n
);
//represent each element in modulo n (useful for wrapping phases (n=2*M_PI))
// ols
// data is t x v
// des is t x ev (design matrix)
...
...
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