Commit Graph

8 Commits

Author SHA1 Message Date
François Coppens
3df8d33bfa Problems with MaponiA3 when calling from C++ with HDF5 datasets is fixed. Bug was caused by uninitialised values of NEWed variables at several places. There are still a few remaining memory leaks. Explore with:
valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all
2021-02-25 12:17:45 +01:00
François Coppens
225c841a88 * Fixed the 3x3 MaponiA3 C++ example. Update_index vector cannot have values that are smaller than 1 because the first colums in Fortran is stored at 1 and not 0.
* Started debugging reading from HDF5 formatted datasets. Slater_inv needs to be transposed before sent to Maponi. Algo fails at the last step. Correct Slater and Inverse fail to produce the identity matrix. Suspect that the matMul function is not working correctly eventhough it looks like it does.
2021-02-24 18:41:48 +01:00
François Coppens
8d63dd1701 The algorithm now works for the following 4x4 example with 2 updates:
S = [1,0,1,-1; 0,1,1,0; -1,0,-1,0; 1,1,1,1]
S_inv = [1,-1,1,1; 1,0,2,1; -1,1,-2,-1; -1,0,-1,0]
u1 = [0,-2,0,0]
u2 = [0,-1,0,0]
upd_idx = [2,4]

To go from Maponi's examples where the number of updates is always equal
to the the dimension of the matrix, and the decomposition is always
diagonal, to cases with a non-diagonal decomposition and a number of
updates unequal to its size, the following changed needed to be made:

* in the calculation of the {y0k} an extra inner for-loop needs to be
  added to make it a full matrix-vector multiplication due to the fact
  that A0 is not a diagonal matrix

* in some places the use of the update-order vector p needs
  the be replaced with that of upd_idx to make sure the correct
  component of the ylk is selected and the proper rank-1 matrices are
  constructed

* when a matrix is passed from Fortran to C++ with 2D adressing, it is
  passed in colum-major order. The passed matrix needs to be transposed
  before passing to C++. Doing this inside the algorithm will break
  compatibility with called from C/C++.
2021-02-22 15:41:30 +01:00
Pablo Oliveira
061c9b9f21 Add test infrastructure for datasets 2021-02-16 10:49:15 +01:00
Pablo Oliveira
6f34f485d3 C++ redesign of data-structures
- Use flat arrays
- Use real type for all matrices
- Merge _f MaponiA3 files
2021-02-09 14:34:39 +01:00
François Coppens
3f6bca2b04 The Fortran interface to C++ fuction MaponiA3() works but the mechanism of passing the 2D arrays from Fortran to C++ must be improved. Now the passed 'linear' 2D arrays are copied and reshaped into usable 2D arrays. This needs to be replaced with some suitable casting mechanism. 2021-02-06 18:59:07 +01:00
François Coppens
d03c9c665b Update of A0_inv fixed. matMul(...) breaks link between A0_inv and Slater_inv. Fixed by creating a new pointer that points to where Slater_inv points to before it gets reassigned by matMul(...) and then copy the updated elements back to the passed array pointed to by the new pointer. 2021-02-03 14:49:42 +01:00
François Coppens
aa6895a4aa Put helper functions in separate header file from the Sherman-Morrison algo. 2021-02-03 12:13:09 +01:00