Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## [Vxl-users] problem on vnl_sparse_symmetric_eigensystem

 [Vxl-users] problem on vnl_sparse_symmetric_eigensystem From: Gao, Yi - 2010-01-06 18:30:47 ```Dear all, I encountered some problem using the vnl_sparse_symmetric_eigensystem. To learn and test it, I generate a 100x100 sparse matrix a, in which 10 elements are non-zero (a normal random number). Then to make A symmetric-positive-def, I do a = a.mult(a, a); //(a = a*a') Then feed it to the vnl_sparse_symmetric_eigensystem, and ask for the first two (smallest by default) eigenvalues/vectors. But it runs forever... Could I get any hint on what might be going wrong? The code is as follows. It's just a minimum test... Thanks a lot! Best, yi #include "vnl/vnl_sparse_matrix.h" #include "vnl/algo/vnl_sparse_symmetric_eigensystem.h" #include "vnl/vnl_random.h" #include #include int main(int argc, char** argv) { int N = 100; vnl_sparse_matrix a(N, N); vnl_random rg; for (int i = 0; i < 10; ++i) { int x = rg.lrand32(N - 1); int y = rg.lrand32(N - 1); double v = 10*rg.normal(); a(x, y) = v; } a.mult(a, a); vnl_sparse_symmetric_eigensystem s; int b = s.CalculateNPairs(a, 2); if (b == 0) { std::cout<

 [Vxl-users] problem on vnl_sparse_symmetric_eigensystem From: Gao, Yi - 2010-01-06 18:30:47 ```Dear all, I encountered some problem using the vnl_sparse_symmetric_eigensystem. To learn and test it, I generate a 100x100 sparse matrix a, in which 10 elements are non-zero (a normal random number). Then to make A symmetric-positive-def, I do a = a.mult(a, a); //(a = a*a') Then feed it to the vnl_sparse_symmetric_eigensystem, and ask for the first two (smallest by default) eigenvalues/vectors. But it runs forever... Could I get any hint on what might be going wrong? The code is as follows. It's just a minimum test... Thanks a lot! Best, yi #include "vnl/vnl_sparse_matrix.h" #include "vnl/algo/vnl_sparse_symmetric_eigensystem.h" #include "vnl/vnl_random.h" #include #include int main(int argc, char** argv) { int N = 100; vnl_sparse_matrix a(N, N); vnl_random rg; for (int i = 0; i < 10; ++i) { int x = rg.lrand32(N - 1); int y = rg.lrand32(N - 1); double v = 10*rg.normal(); a(x, y) = v; } a.mult(a, a); vnl_sparse_symmetric_eigensystem s; int b = s.CalculateNPairs(a, 2); if (b == 0) { std::cout<
 Re: [Vxl-users] problem on vnl_sparse_symmetric_eigensystem From: Gao, Yi - 2010-01-06 18:33:22 ```oh I should have mentioned that I'm using vxl-1.13, ubuntu 9.10 with gcc/g++ 4.4.1, in Release mode of CMake, in building both vxl and my testing code. Thanks! On Wed, Jan 6, 2010 at 11:30 AM, Gao, Yi wrote: > Dear all, > > I encountered some problem using the vnl_sparse_symmetric_eigensystem. > > To learn and test it, I generate a 100x100 sparse matrix a, in which > 10 elements are non-zero (a normal random number). > > Then to make A symmetric-positive-def, I do a = a.mult(a, a);  //(a = a*a') > > Then feed it to the vnl_sparse_symmetric_eigensystem, and ask for the > first two (smallest by default) eigenvalues/vectors. But it runs > forever... > > Could I get any hint on what might be going wrong? The code is as > follows. It's just a minimum test... > > Thanks a lot! > > > Best, > yi > > > > #include "vnl/vnl_sparse_matrix.h" > #include "vnl/algo/vnl_sparse_symmetric_eigensystem.h" > > #include "vnl/vnl_random.h" > > > #include > #include > > > int main(int argc, char** argv) > { >  int N = 100; > >  vnl_sparse_matrix a(N, N); > >  vnl_random rg; > >  for (int i = 0; i < 10; ++i) >    { >      int x = rg.lrand32(N - 1); >      int y = rg.lrand32(N - 1); > >      double v = 10*rg.normal(); > >      a(x, y) = v; >    } > >  a.mult(a, a); > > >  vnl_sparse_symmetric_eigensystem s; >  int b = s.CalculateNPairs(a, 2); > >  if (b == 0) >    { >      std::cout<      std::cout< >      std::cout<      std::cout< >    } >  else >    { >      std::cerr<<"b = "<    } > > > >  return 0; > } > -- Yi Gao Graduate Student Dept. Biomedical Engineering Georgia Institute of Technology ```
 Re: [Vxl-users] problem on vnl_sparse_symmetric_eigensystem From: Peter Vanroose - 2010-01-07 15:19:11 ```> To make A symmetric-positive-def, I do > a = a.mult(a, a);  //(a = a*a') This won't work since the 2nd argument of mult() is cleared before the multiplication is performed. Try the following: vnl_sparse_matrix r=a; r.mult(r,a); > Then I feed it to vnl_sparse_symmetric_eigensystem, and > ask for the first two eigenvalues/vectors. But it > runs forever... Indeed, also here it seems to either run forever, or return: Error: vnl_sparse_symmetric_eigensystem: disastrous loss of orthogonality - internal error Seems like a bug in vnl_sparse_symmetric_eigensystem? -- Peter. ___________________________________________________ Sök efter kärleken! Hitta din tvillingsjäl på Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 ```
 Re: [Vxl-users] problem on vnl_sparse_symmetric_eigensystem From: Gao, Yi - 2010-01-07 15:37:36 ```Thanks Peter for the correction. So I changed the code to vnl_sparse_matrix r=a; r.mult(r,a); vnl_sparse_symmetric_eigensystem s; int b = s.CalculateNPairs(r, 2, true); //int b = s.CalculateNPairs(a, 2, true); and re-run the code and got same results as you got: runs forever or disastrous loss of orthogonality. Then, I reduce the matrix size to 20*20, which is really small, and I got this error: Error: vnl_sparse_symmetric_eigensystem: reached maximum operations 200 without finding all eigenvalues, found 0 eigenvalues Would this be a bug in vnl_sparse_symmetric_eigensystem? On Thu, Jan 7, 2010 at 8:19 AM, Peter Vanroose wrote: >> To make A symmetric-positive-def, I do >>  a = a.mult(a, a);  //(a = a*a') > > This won't work since the 2nd argument of mult() is cleared before the multiplication is performed. > Try the following: > >  vnl_sparse_matrix r=a; >  r.mult(r,a); > > >> Then I feed it to vnl_sparse_symmetric_eigensystem, and >> ask for the first two eigenvalues/vectors. But it >> runs forever... > > Indeed, also here it seems to either run forever, or return: >   Error: vnl_sparse_symmetric_eigensystem: >     disastrous loss of orthogonality - internal error > > Seems like a bug in vnl_sparse_symmetric_eigensystem? > > > --      Peter. > > > > > > > > > > > > > > > > > >      ___________________________________________________ > Sök efter kärleken! > Hitta din tvillingsjäl på Yahoo! Dejting: http://ad.doubleclick.net/clk;185753627;24584539;x?http://se.meetic.yahoo.net/index.php?mtcmk=148783 > -- Yi Gao Graduate Student Dept. Biomedical Engineering Georgia Institute of Technology ```