Skip to content
Snippets Groups Projects
Commit 11933b6f authored by Tim Behrens's avatar Tim Behrens
Browse files

*** empty log message ***

parent 2238587b
No related branches found
No related tags found
No related merge requests found
......@@ -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))));
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment