mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2024-12-25 13:53:56 +01:00
8d63dd1701
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++.
65 lines
1.8 KiB
Makefile
65 lines
1.8 KiB
Makefile
# ARCH = -xCORE-AVX2
|
|
|
|
## Used compilers
|
|
H5CXX = h5c++
|
|
CXX = clang++
|
|
FC = flang
|
|
|
|
## Compiler flags & common obs & libs
|
|
CXXFLAGS = -O0 -debug full -traceback
|
|
FFLAGS = -O0 -debug full -traceback
|
|
FLIBS = -lstdc++
|
|
OBJS = SM_MaponiA3.o
|
|
|
|
|
|
## Deps & objs for C++ cMaponiA3_test_3x3_3
|
|
cMaponiA3_test_3x3_3OBJ = cMaponiA3_test_3x3_3.o
|
|
## Deps & objs for Fortran fMaponiA3_test_3x3_3
|
|
fMaponiA3_test_3x3_3OBJ = SM_MaponiA3_mod.o fMaponiA3_test_3x3_3.o
|
|
## Deps & objs for Fortran fMaponiA3_test_4x4_2
|
|
fMaponiA3_test_4x4_2OBJ = SM_MaponiA3_mod.o fMaponiA3_test_4x4_2.o
|
|
## Deps & objs for Fortran QMCChem_dataset_test
|
|
QMCChem_dataset_testOBJ = Utils_mod.o SM_MaponiA3_mod.o QMCChem_dataset_test.o
|
|
|
|
|
|
## Default build target: build everything
|
|
all: cMaponiA3_test_3x3_3 fMaponiA3_test_3x3_3 fMaponiA3_test_4x4_2 QMCChem_dataset_test
|
|
|
|
|
|
## Compile recipes for C++
|
|
%.o: %.cpp
|
|
$(CXX) $(ARCH) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
## Compile recepies for Fortran
|
|
%.o: %.f90
|
|
$(FC) $(ARCH) $(FFLAGS) -c -o $@ $<
|
|
|
|
## Explicit recipe to trigger rebuild and relinking when headerfile is changed
|
|
SM_MaponiA3.o: SM_MaponiA3.cpp Helpers.hpp
|
|
$(CXX) $(ARCH) $(CXXFLAGS) -c -o $@ $<
|
|
|
|
|
|
## Build tagets
|
|
.PHONY: all clean distclean
|
|
|
|
clean:
|
|
@rm -vf *.o *.mod
|
|
|
|
distclean: clean
|
|
@rm -vf cMaponiA3_test_3x3_3 fMaponiA3_test_3x3_3 QMCChem_dataset_test Slater_* Updates.dat
|
|
|
|
|
|
## Linking the C++ example program
|
|
cMaponiA3_test_3x3_3: $(cMaponiA3_test_3x3_3OBJ) $(OBJS)
|
|
$(CXX) $(ARCH) $(CXXFLAGS) -o $@ $^
|
|
|
|
## Linking Fortran example program calling the C++ function
|
|
fMaponiA3_test_3x3_3: $(fMaponiA3_test_3x3_3OBJ) $(OBJS)
|
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
|
|
|
fMaponiA3_test_4x4_2: $(fMaponiA3_test_4x4_2OBJ) $(OBJS)
|
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
|
|
|
QMCChem_dataset_test: $(QMCChem_dataset_testOBJ) $(OBJS)
|
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|