55 out.resize( in.rows(), in.cols() );
57 out.col( 0 ) = in.col( 0 );
59 for(
int i = 1; i < in.cols(); ++i )
63 std::cout << i + 1 <<
"/" << in.cols() <<
"\n";
68 out.col( i ) = in.col( i ) - ( ( in.col( i ).matrix().dot( out.col( 0 ).matrix() ) ) /
69 ( out.col( 0 ).matrix().dot( out.col( 0 ).matrix() ) ) ) *
72 for(
int j = 1; j < i; ++j )
74 out.col( i ) = out.col( i ) - ( ( out.col( i ).matrix().dot( out.col( j ).matrix() ) ) /
75 ( out.col( j ).matrix().dot( out.col( j ).matrix() ) ) ) *
82 for(
int i = 0; i < out.cols(); ++i )
84 out.col( i ) = out.col( i ) / out.col( i ).matrix().norm();
105void gramSchmidt( eigenTout &out,
const eigenTin &in,
const eigenTWin &window )
109 out.col( 0 ) = in.col( 0 );
111 for(
int i = 1; i < in.cols(); ++i )
115 std::cout << i + 1 <<
"/" << in.cols() <<
"\n";
120 out.col( i ) = in.col( i ) - ( ( ( in.col( i ) * window ).matrix().dot( out.col( 0 ).matrix() ) ) /
121 ( ( out.col( 0 ) * window ).matrix().dot( out.col( 0 ).matrix() ) ) ) *
124 for(
int j = 1; j < i; ++j )
126 out.col( i ) = out.col( i ) - ( ( ( out.col( i ) * window ).matrix().dot( out.col( j ).matrix() ) ) /
127 ( ( out.col( j ) * window ).matrix().dot( out.col( j ).matrix() ) ) ) *
132 for(
int i = 0; i < out.cols(); ++i )
134 out.col( i ) = out.col( i ) / ( out.col( i ) * window.sqrt() ).matrix().norm();
176 typename eigenTin::Scalar normPix = 0.0
180 typedef typename eigenTout::Scalar Scalar;
182 out.resize( in.rows(), in.cols() );
186 gsspect.resize( in.cols(), in.cols() );
189 out.col( 0 ) = in.col( 0 );
192 for(
int i = 1; i < in.cols(); ++i )
196 std::cout << i + 1 <<
"/" << in.cols() <<
"\n";
201 gsspect( i, 0 ) = ( ( in.col( i ).matrix().dot( out.col( 0 ).matrix() ) ) /
202 ( out.col( 0 ).matrix().dot( out.col( 0 ).matrix() ) ) );
203 out.col( i ) = in.col( i ) - gsspect( i, 0 ) * out.col( 0 );
205 for(
int j = 1; j < i; ++j )
207 gsspect( i, j ) = ( ( out.col( i ).matrix().dot( out.col( j ).matrix() ) ) /
208 ( out.col( j ).matrix().dot( out.col( j ).matrix() ) ) );
209 out.col( i ) = out.col( i ) - gsspect( i, j ) * out.col( j );
214 baseSpectrum( spect, gsspect );
220 for(
int i = 0; i < out.cols(); ++i )
222 norm = sqrt( out.col( i ).square().sum() / normPix );
224 out.col( i ) /= norm;
void gramSchmidtSpectrum(eigenTout &out, eigenTout2 &spect, const eigenTin &in, typename eigenTin::Scalar normPix=0.0)
Perform Gram-Schmidt ortogonalization of a basis set, and normalize the result, while recording the s...
void gramSchmidt(eigenTout &out, const eigenTin &in, bool normalize=true)
Perform Gram-Schmidt ortogonalization of a basis set, and normalize the result.