
Hi, thanks to Johannes Loehnert and Waltraut Wustmann the previous f2py wrappers have been supplied with many more unit-tests, documentation and wrappers for hermitian band matrices. The wrappers deals with: <s,d>sbev <s,d>sbevd <s,d>sbevx <c,z>hbevd <c,z>hbevx <s,d,c,z>gbtrf <s,d,c,z>gbtrs <s,d>lamch In addition front-end routines `eig_banded`, `eigvals_banded` for inclusion in Lib/linalg/decomp.py are provided. The current version is at http://www.physik.tu-dresden.de/~baecker/python/band.zip Pearu, it would be nice if you could have a look at the wrappers and let us know whether anything needs to be done/improved. If you prefer I can do a commit (after following the steps in the TODO), but I would like to get your ok first (I also don't mind if you prefer to make the corresponding changes ;-). Hope the result is useful not just for us but also to others. In addition, the contents of band.zip might be helpful as an example on how to provide wrappers for other LAPACK routines. Best, Arnd P.S.: In the long run one could also think of adding code for performing inverse iteration, but this might also fit into the sparse matrix department.

Hi, as I have not recieved any feedback, would anyone mind if we just do the changes and commit the code to svn? Best, Arnd On Fri, 16 Jun 2006, Arnd Baecker wrote:
Hi,
thanks to Johannes Loehnert and Waltraut Wustmann the previous f2py wrappers have been supplied with many more unit-tests, documentation and wrappers for hermitian band matrices. The wrappers deals with: <s,d>sbev <s,d>sbevd <s,d>sbevx <c,z>hbevd <c,z>hbevx <s,d,c,z>gbtrf <s,d,c,z>gbtrs <s,d>lamch In addition front-end routines `eig_banded`, `eigvals_banded` for inclusion in Lib/linalg/decomp.py are provided.
The current version is at http://www.physik.tu-dresden.de/~baecker/python/band.zip
Pearu, it would be nice if you could have a look at the wrappers and let us know whether anything needs to be done/improved. If you prefer I can do a commit (after following the steps in the TODO), but I would like to get your ok first (I also don't mind if you prefer to make the corresponding changes ;-).
Hope the result is useful not just for us but also to others. In addition, the contents of band.zip might be helpful as an example on how to provide wrappers for other LAPACK routines.
Best, Arnd
P.S.: In the long run one could also think of adding code for performing inverse iteration, but this might also fit into the sparse matrix department.
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.net http://www.scipy.net/mailman/listinfo/scipy-dev

Hi, sorry for asking again, but I would really be happy to get this finished... Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn? Best, Arnd On Tue, 27 Jun 2006, Arnd Baecker wrote:
Hi,
as I have not recieved any feedback, would anyone mind if we just do the changes and commit the code to svn?
Best, Arnd
On Fri, 16 Jun 2006, Arnd Baecker wrote:
Hi,
thanks to Johannes Loehnert and Waltraut Wustmann the previous f2py wrappers have been supplied with many more unit-tests, documentation and wrappers for hermitian band matrices. The wrappers deals with: <s,d>sbev <s,d>sbevd <s,d>sbevx <c,z>hbevd <c,z>hbevx <s,d,c,z>gbtrf <s,d,c,z>gbtrs <s,d>lamch In addition front-end routines `eig_banded`, `eigvals_banded` for inclusion in Lib/linalg/decomp.py are provided.
The current version is at http://www.physik.tu-dresden.de/~baecker/python/band.zip
Pearu, it would be nice if you could have a look at the wrappers and let us know whether anything needs to be done/improved. If you prefer I can do a commit (after following the steps in the TODO), but I would like to get your ok first (I also don't mind if you prefer to make the corresponding changes ;-).
Hope the result is useful not just for us but also to others. In addition, the contents of band.zip might be helpful as an example on how to provide wrappers for other LAPACK routines.
Best, Arnd
P.S.: In the long run one could also think of adding code for performing inverse iteration, but this might also fit into the sparse matrix department.
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.net http://www.scipy.net/mailman/listinfo/scipy-dev
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.net http://www.scipy.net/mailman/listinfo/scipy-dev

Arnd Baecker wrote:
Hi,
sorry for asking again, but I would really be happy to get this finished...
Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn?
I say go ahead. It looks like an additional feature with a reasonable interface that should not affect other code. -Travis

On Thu, 29 Jun 2006, Travis Oliphant wrote:
Arnd Baecker wrote:
Hi,
sorry for asking again, but I would really be happy to get this finished...
Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn?
I say go ahead. It looks like an additional feature with a reasonable interface that should not affect other code.
Many thanks, code is commited. All tests pass without problems. Best, Arnd

Arnd Baecker wrote:
On Thu, 29 Jun 2006, Travis Oliphant wrote:
Arnd Baecker wrote:
Hi,
sorry for asking again, but I would really be happy to get this finished...
Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn?
I say go ahead. It looks like an additional feature with a reasonable interface that should not affect other code.
Many thanks, code is commited. All tests pass without problems.
Best, Arnd _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
Hi Arnd, Thank you very much for the support of band matrices in scipy. That is very useful. BTW, is it possible to convert full matrices to band matrices and vice versa ? Nils

On Fri, 30 Jun 2006, Nils Wagner wrote:
Arnd Baecker wrote:
On Thu, 29 Jun 2006, Travis Oliphant wrote:
Arnd Baecker wrote:
Hi,
sorry for asking again, but I would really be happy to get this finished...
Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn?
I say go ahead. It looks like an additional feature with a reasonable interface that should not affect other code.
Many thanks, code is commited. All tests pass without problems.
Best, Arnd _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
Hi Arnd,
Thank you very much for the support of band matrices in scipy. That is very useful. BTW, is it possible to convert full matrices to band matrices and vice versa ?
Yes. For an example of the conversion of a full matrix to band see Lib/linalg/tests/test_decomp.py where you find code blocks like # Extract upper bands from symmetric and hermitian band matrices # (for use in dsbevd, dsbevx, zhbevd, zhbevx # and their single precision versions) LDAB = self.KU + 1 self.bandmat_sym = zeros((LDAB, N), dtype=float) self.bandmat_herm = zeros((LDAB, N), dtype=complex) for i in xrange(LDAB): self.bandmat_sym[LDAB-i-1,i:N] = diag(self.sym_mat, i) self.bandmat_herm[LDAB-i-1,i:N] = diag(self.herm_mat, i) HTH, Arnd

Arnd Baecker wrote:
On Fri, 30 Jun 2006, Nils Wagner wrote:
Arnd Baecker wrote:
On Thu, 29 Jun 2006, Travis Oliphant wrote:
Arnd Baecker wrote:
Hi,
sorry for asking again, but I would really be happy to get this finished...
Travis, Robert or Pearu: may I go ahead with integrating the band matrix wrappers into scipy svn?
I say go ahead. It looks like an additional feature with a reasonable interface that should not affect other code.
Many thanks, code is commited. All tests pass without problems.
Best, Arnd _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
Hi Arnd,
Thank you very much for the support of band matrices in scipy. That is very useful. BTW, is it possible to convert full matrices to band matrices and vice versa ?
Yes. For an example of the conversion of a full matrix to band see Lib/linalg/tests/test_decomp.py where you find code blocks like
# Extract upper bands from symmetric and hermitian band matrices # (for use in dsbevd, dsbevx, zhbevd, zhbevx # and their single precision versions) LDAB = self.KU + 1 self.bandmat_sym = zeros((LDAB, N), dtype=float) self.bandmat_herm = zeros((LDAB, N), dtype=complex) for i in xrange(LDAB): self.bandmat_sym[LDAB-i-1,i:N] = diag(self.sym_mat, i) self.bandmat_herm[LDAB-i-1,i:N] = diag(self.herm_mat, i)
HTH,
Arnd _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
Did you check general band matrices ? If you need a test for real nonsymmetric band matrices from scipy import linalg, diag, arange, linspace, sort def sylvester(n): # # Sylvester matrix # tmp = diag(arange(1,n),1)+diag(arange(n-1,0,-1),-1) return tmp n = 9 A = sylvester(n) w1=linalg.eigvals(A) w1=sort(w1.real) # # Exact eigenvalues # w_ex = linspace(-(n-1),n-1,n,endpoint=True) print linalg.norm(w1-w_ex) Nils

On Fri, 30 Jun 2006, Nils Wagner wrote: [...]
Did you check general band matrices ?
No.
If you need a test for real nonsymmetric band matrices
Not this time - the wrapped routines are for symmetric or Hermetian routines only.
from scipy import linalg, diag, arange, linspace, sort def sylvester(n): # # Sylvester matrix # tmp = diag(arange(1,n),1)+diag(arange(n-1,0,-1),-1) return tmp
n = 9 A = sylvester(n) w1=linalg.eigvals(A) w1=sort(w1.real) # # Exact eigenvalues # w_ex = linspace(-(n-1),n-1,n,endpoint=True) print linalg.norm(w1-w_ex)
Nils
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev

Arnd Baecker wrote:
On Fri, 30 Jun 2006, Nils Wagner wrote:
[...]
Did you check general band matrices ?
No.
If you need a test for real nonsymmetric band matrices
Not this time - the wrapped routines are for symmetric or Hermetian routines only.
from scipy import linalg, diag, arange, linspace, sort def sylvester(n): # # Sylvester matrix # tmp = diag(arange(1,n),1)+diag(arange(n-1,0,-1),-1) return tmp
n = 9 A = sylvester(n) w1=linalg.eigvals(A) w1=sort(w1.real) # # Exact eigenvalues # w_ex = linspace(-(n-1),n-1,n,endpoint=True) print linalg.norm(w1-w_ex)
Nils
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
_______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http://projects.scipy.org/mailman/listinfo/scipy-dev
OK, do you intend to add support for non-hermitian matrices in the near future ? eig_banded(a_band, lower=0, eigvals_only=0, overwrite_a_band=0, select='a', select_range=None, max_ev=0) Solve real symmetric or complex hermetian band matrix problem. eigvals_banded(a_band, lower=0, overwrite_a_band=0, select='a', select_range=None) Return eigenvalues of hermitean or real symmetric matrix. It should be Hermitian instead of hermetian/hermitean ;-) http://en.wikipedia.org/wiki/Hermitian_matrix Nils
participants (3)
-
Arnd Baecker
-
Nils Wagner
-
Travis Oliphant