Giter Club home page Giter Club logo

fortran_davidson's People

Contributors

felipez avatar lopeztarifa avatar nicorenaud avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fortran_davidson's Issues

Change the max dimension of the subspace

Currently the maximum dimension of the subspace is set to half the number of columns of the matrix. This number is too big.
Make this dimension an optional value and add a default value of 10 times the number of requested eigenvalues

Search for a better cost function

Currently we are checking that the algorithm converges using the following formula

norm(H * computed_eigenvectors - computed_eigenvalues) < tolerance 

This condition is quite stringent for convergence and expensive, specially for the matrix-free version

floating invalid

When using ifort together when MKL the following error is thrown:

 forrtl: error (65): floating invalid

The subroutine throwing the error is DGEQRF

Improve DPR correction

The current implementation of the dense correction for the DPR use m x m matrices to build the correction but some further optimizations can be done for the matrices where all the off-diagonal elements are 0

ritz vector recomputation

The ritz_vectors are recomputed for the correction of the dense version. The correction function should receive the ritz_vector as input. Also, the residues matrix is recomputed:

TODO:

  • removed the recomputation of the ritz_vectors
  • Compute the residues only once.

matrix free implementation issue

In the current implementation of the Matrix-free version:

  • The projected matrix is updated by block but the QR factorization could change the sign of the vectors making a block-update unfeasible.
  • It was assumed that matrix multiplication of a diagonal matrix is commutative that is wrong for nonsymmetric matrices.
  • The correction matrix is computed with the wrong diagonal matrix because for each eigenvalue/eigenvector pair a diagonal matrix must be formed containing a single eigenvalue in the diagonal.
  • The calls to the function that computes the matrix ( the matrix-free component) are duplicated in several locations

Todo:

  • Remove the block update
  • Fix multiplication matrix
  • Fix diagonal matrix
  • Optimize the number of calls to the function that computes the target matrix.

Improve convergence by deflating the converged eigenvalues

In the current Davidson implementation, all the pair of eigenvalues/eigenvectors are constantly optimized until every pair converge. It would be desirable to deflate the pairs that are already converge and dynamically changed the size of the block for the next iterations.
See this paper

optimize the subspace calculation

Append the orthonormalized correction vector to the previous subspace and compute the new reduce Hamiltonian
H' = V^T H V
by computing only the matrix elements involved with the new correction vector.

separate dense and free

Should we separate the dense and free part of the code ? Having everything in one file makes it difficult to navigate (at least for me).

Also some subroutines have a dense and a free version while I think they should be the same (for example the DPR correction). We should simplify that.

Test are not found ...

It might be me but I get that error message when trying to run the test

UpdateCTestConfiguration  from :/home/nico/Fortran_Davidson/build/DartConfiguration.tcl
Parse Config file:/home/nico/Fortran_Davidson/build/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/nico/Fortran_Davidson/build/DartConfiguration.tcl
Parse Config file:/home/nico/Fortran_Davidson/build/DartConfiguration.tcl
Test project /home/nico/Fortran_Davidson/build
Constructing a list of tests
Done constructing a list of tests
Updating test list for fixtures
Added 0 tests to meet fixture requirements
Checking test dependency graph...
Checking test dependency graph end
No tests were found!!!

Davidson free version can be speed-up in the calculation of the residues

The calculation of the residues in the free version:

do j=1,lowest
guess = eigenvalues_sub(j) * fun_stx_gemv(reshape(ritz_vectors(:, j),(/dim_mtx,1/) ) )
rs = fun_mtx_gemv(reshape(ritz_vectors(:, j), (/dim_mtx,1/))) - guess
errors(j) = norm(reshape(rs,(/dim_mtx/)))
end do

can be vectorised to avoid the callings to fun_mtx_gemv and fun_stx_gemv. The trick was inspired by Votca lines:

https://github.com/votca/xtp/blob/0b1252f2f0e18d22b2eeba8428afd59c87490425/include/votca/xtp/davidsonsolver.h#L118-L122

And consists in constructing a squere matrix with the eingevalues in the diagonal first, e.g.:

! 6. Construction of lambda matrix 
lambda= eye( size( V, 2), size( V, 2))
do j= 1, size(V,2) 
 lambda( j, j)= eigenvalues_sub( j)
enddo

then followed by the residue calculation:

! 7. Residue calculation
rs = lapack_matmul('N', 'N', stxV, eigenvectors_sub)
guess =  lapack_matmul('N', 'N', rs, lambda)  
deallocate(rs)
rs =  lapack_matmul('N', 'N', mtxV, eigenvectors_sub) - guess 
do j=1,lowest
  errors(j) = norm(reshape(rs,(/parameters%nparm/)))
end do

update and GS

We should replace the QR by a GS ortho and do an update of the projected matrix. That speeds up the code quite a bit for the C++ implementation

Create a matrix free version of the algorithm

Currently the matrix to be diagonalized and the optional matrix for the general eigenvalue problem are real densed matrices.
The interface to call the davidson eigensolver is:

 generalized_eigensolver(mtx, eigenvalues, ritz_vectors, lowest, method, max_iters, &
        tolerance, iters, max_dim_sub, stx)

We can overload the function call to allow the mtx and the optional argument stx to be functions allowing to have a matrix-free version of the algorithm.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.