mirror of
https://github.com/TREX-CoE/Sherman-Morrison.git
synced 2025-01-12 14:08:34 +01:00
File tree restructured. Written build script build.sh. TODO: convert buld script into Makefile.
This commit is contained in:
parent
00fcaf2309
commit
5d4a7af01a
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,4 +8,3 @@ Slater*
|
|||||||
Updates*
|
Updates*
|
||||||
tests/test
|
tests/test
|
||||||
datasets/datasets.*
|
datasets/datasets.*
|
||||||
|
|
||||||
|
45
Makefile
45
Makefile
@ -1,6 +1,10 @@
|
|||||||
# ARCH = -xCORE-AVX2
|
SRC_DIR := src
|
||||||
|
INC_DIR := include
|
||||||
|
OBJ_DIR := build
|
||||||
|
BIN_DIR := bin
|
||||||
|
|
||||||
## Used compilers
|
## Used compilers
|
||||||
|
ARCH = -xCORE-AVX2
|
||||||
H5CXX = h5c++
|
H5CXX = h5c++
|
||||||
CXX = icpc
|
CXX = icpc
|
||||||
FC = ifort
|
FC = ifort
|
||||||
@ -9,10 +13,11 @@ FC = ifort
|
|||||||
H5CXXFLAGS = -O0 -g
|
H5CXXFLAGS = -O0 -g
|
||||||
CXXFLAGS = -O0 -g -traceback
|
CXXFLAGS = -O0 -g -traceback
|
||||||
FFLAGS = -O0 -g -traceback
|
FFLAGS = -O0 -g -traceback
|
||||||
|
INCLUDE = -I$(INC_DIR)
|
||||||
FLIBS = -lstdc++
|
FLIBS = -lstdc++
|
||||||
OBJS = SM_MaponiA3.o
|
|
||||||
|
|
||||||
## Deps & objs for C++ cMaponiA3_test_3x3_3
|
## Deps & objs for C++ cMaponiA3_test_3x3_3
|
||||||
|
OBJS = $(OBJ_DIR)/SM_MaponiA3.o
|
||||||
cMaponiA3_test_3x3_3OBJ = cMaponiA3_test_3x3_3.o
|
cMaponiA3_test_3x3_3OBJ = cMaponiA3_test_3x3_3.o
|
||||||
fMaponiA3_test_3x3_3OBJ = SM_MaponiA3_mod.o fMaponiA3_test_3x3_3.o
|
fMaponiA3_test_3x3_3OBJ = SM_MaponiA3_mod.o fMaponiA3_test_3x3_3.o
|
||||||
fMaponiA3_test_4x4_2OBJ = Helpers_mod.o SM_MaponiA3_mod.o fMaponiA3_test_4x4_2.o
|
fMaponiA3_test_4x4_2OBJ = Helpers_mod.o SM_MaponiA3_mod.o fMaponiA3_test_4x4_2.o
|
||||||
@ -24,45 +29,45 @@ all: cMaponiA3_test_3x3_3 fMaponiA3_test_3x3_3 fMaponiA3_test_4x4_2 QMCChem_data
|
|||||||
|
|
||||||
|
|
||||||
## Compile recipes for C++
|
## Compile recipes for C++
|
||||||
%.o: %.cpp
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp | $(OBJ_DIR)
|
||||||
$(CXX) $(ARCH) $(CXXFLAGS) -c -o $@ $<
|
$(CXX) $(ARCH) $(CXXFLAGS) $(INCLUDE) -c -o $@ $<
|
||||||
|
|
||||||
## Compile recepies for Fortran
|
## Compile recepies for Fortran
|
||||||
%.o: %.f90
|
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.f90 | $(OBJ_DIR)
|
||||||
$(FC) $(ARCH) $(FFLAGS) -c -o $@ $<
|
$(FC) $(ARCH) $(FFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
## Explicit recipe to trigger rebuild and relinking when headerfile is changed
|
## Explicit recipe to trigger rebuild and relinking when headerfile is changed
|
||||||
SM_MaponiA3.o: SM_MaponiA3.cpp Helpers.hpp
|
$(OBJ_DIR)/SM_MaponiA3.o: $(SRC_DIR)/SM_MaponiA3.cpp $(INC_DIR)/Helpers.hpp| $(OBJ_DIR)
|
||||||
$(CXX) $(ARCH) $(CXXFLAGS) -fPIC -c -o $@ $<
|
$(CXX) $(ARCH) $(CXXFLAGS) $(INCLUDE) -fPIC -c -o $@ $<
|
||||||
|
|
||||||
|
|
||||||
## Build tagets
|
## Build tagets
|
||||||
.PHONY: all clean distclean
|
.PHONY: all clean distclean
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -vf *.o *.mod
|
@rm -vrf $(OBJ_DIR)
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
@rm -vf cMaponiA3_test_3x3_3 \
|
@rm -vrf $(BIN_DIR) \
|
||||||
fMaponiA3_test_3x3_3 fMaponiA3_test_4x4_2 \
|
Slater* Updates.dat
|
||||||
QMCChem_dataset_test \
|
|
||||||
Slater* Updates.dat \
|
|
||||||
tests/test
|
|
||||||
|
|
||||||
|
|
||||||
## Linking the C++ example program
|
## Linking the C++ example program
|
||||||
cMaponiA3_test_3x3_3: $(cMaponiA3_test_3x3_3OBJ) $(OBJS)
|
$(BIN_DIR)/cMaponiA3_test_3x3_3: $(OBJ_DIR)/$(cMaponiA3_test_3x3_3OBJ) $(OBJS) | $(BIN_DIR)
|
||||||
$(CXX) $(ARCH) $(CXXFLAGS) -o $@ $^
|
$(CXX) $(ARCH) $(CXXFLAGS) $(INCLUDE) -o $@ $^
|
||||||
|
|
||||||
## Linking Fortran example program calling the C++ function
|
## Linking Fortran example program calling the C++ function
|
||||||
fMaponiA3_test_3x3_3: $(fMaponiA3_test_3x3_3OBJ) $(OBJS)
|
$(BIN_DIR)/fMaponiA3_test_3x3_3: $(OBJ_DIR)/$(fMaponiA3_test_3x3_3OBJ) $(OBJS) | $(BIN_DIR)
|
||||||
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
||||||
|
|
||||||
fMaponiA3_test_4x4_2: $(fMaponiA3_test_4x4_2OBJ) $(OBJS)
|
$(BIN_DIR)/fMaponiA3_test_4x4_2: $(OBJ_DIR)/$(fMaponiA3_test_4x4_2OBJ) $(OBJS) | $(BIN_DIR)
|
||||||
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
||||||
|
|
||||||
QMCChem_dataset_test: $(QMCChem_dataset_testOBJ) $(OBJS)
|
$(BIN_DIR)/QMCChem_dataset_test: $(OBJ_DIR)/$(QMCChem_dataset_testOBJ) $(OBJS) | $(BIN_DIR)
|
||||||
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
$(FC) $(ARCH) $(FFLAGS) $(FLIBS) -o $@ $^
|
||||||
|
|
||||||
tests/test: tests/test.cpp SM_MaponiA3.o
|
$(BIN_DIR)/test: $(SRC_DIR)/test.cpp $(OBJS) | $(BIN_DIR)
|
||||||
$(H5CXX) $(ARCH) $(H5CXXFLAGS) -o $@ $^
|
$(H5CXX) $(H5CXXFLAGS) $(INCLUDE) -o $@ $^
|
||||||
|
|
||||||
|
$(BIN_DIR) $(OBJ_DIR):
|
||||||
|
mkdir -p $@
|
||||||
|
36
build.sh
Executable file
36
build.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
|
||||||
|
mkdir build/ bin/
|
||||||
|
|
||||||
|
## compile tests/test.cpp
|
||||||
|
icpc -O0 -fPIC -c src/SM_MaponiA3.cpp -o build/SM_MaponiA3.o -I include/
|
||||||
|
|
||||||
|
## compile tests/fMaponiA3_test_3x3_3.f90
|
||||||
|
ifort -c src/SM_MaponiA3_mod.f90 -o build/SM_MaponiA3_mod.o -module build
|
||||||
|
ifort -c tests/fMaponiA3_test_3x3_3.f90 -o build/fMaponiA3_test_3x3_3.o -I build/
|
||||||
|
## link bin/QMCChem_dataset_test
|
||||||
|
ifort -o bin/fMaponiA3_test_3x3_3 build/fMaponiA3_test_3x3_3.o build/SM_MaponiA3_mod.o build/SM_MaponiA3.o -lstdc++
|
||||||
|
|
||||||
|
## compile tests/fMaponiA3_test_4x4_2.f90
|
||||||
|
ifort -c src/SM_MaponiA3_mod.f90 -o build/SM_MaponiA3_mod.o -module build
|
||||||
|
ifort -c src/Helpers_mod.f90 -o build/Helpers_mod.o -module build
|
||||||
|
ifort -c tests/fMaponiA3_test_4x4_2.f90 -o build/fMaponiA3_test_4x4_2.o -I build/
|
||||||
|
## link bin/QMCChem_dataset_test
|
||||||
|
ifort -o bin/fMaponiA3_test_4x4_2 build/fMaponiA3_test_4x4_2.o build/SM_MaponiA3_mod.o build/Helpers_mod.o build/SM_MaponiA3.o -lstdc++
|
||||||
|
|
||||||
|
## compile tests/QMCChem_dataset_test.f90
|
||||||
|
ifort -c src/SM_MaponiA3_mod.f90 -o build/SM_MaponiA3_mod.o -module build
|
||||||
|
ifort -c src/Helpers_mod.f90 -o build/Helpers_mod.o -module build
|
||||||
|
ifort -c tests/QMCChem_dataset_test.f90 -o build/QMCChem_dataset_test.o -I build/
|
||||||
|
## link bin/QMCChem_dataset_test
|
||||||
|
ifort -o bin/QMCChem_dataset_test build/QMCChem_dataset_test.o build/SM_MaponiA3_mod.o build/Helpers_mod.o build/SM_MaponiA3.o -lstdc++
|
||||||
|
|
||||||
|
## compile tests/test.cpp
|
||||||
|
h5c++ -c tests/test.cpp -o build/test.o -I include/
|
||||||
|
## link bin/test
|
||||||
|
h5c++ -o bin/test build/test.o build/SM_MaponiA3.o
|
||||||
|
|
||||||
|
## compile tests/cMaponiA3_test_3x3_3.cpp
|
||||||
|
icpc -c tests/cMaponiA3_test_3x3_3.cpp -o build/cMaponiA3_test_3x3_3.o -I include/
|
||||||
|
## link bin/cMaponiA3_test_3x3_3
|
||||||
|
icpc -o bin/cMaponiA3_test_3x3_3 build/cMaponiA3_test_3x3_3.o build/SM_MaponiA3.o
|
@ -1,53 +0,0 @@
|
|||||||
// main.cpp
|
|
||||||
#include "SM_MaponiA3.hpp"
|
|
||||||
#include "Helpers.hpp"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
|
|
||||||
unsigned int M = 3; // Dimension of the Slater-matrix
|
|
||||||
unsigned int i, j; // Indices for iterators
|
|
||||||
|
|
||||||
// Declare, allocate all vectors and matrices and fill them with zeros
|
|
||||||
unsigned int *Ar_index = new unsigned int[M];
|
|
||||||
double *A = new double[M*M]; // The matrix to be inverted
|
|
||||||
double *A0 = new double[M*M]; // A diagonal matrix with the digonal elements of A
|
|
||||||
double *Ar = new double[M*M]; // The update matrix
|
|
||||||
double *A0_inv = new double[M*M]; // The inverse
|
|
||||||
|
|
||||||
// Fill with zeros
|
|
||||||
for (i = 0; i < M; i++) {
|
|
||||||
for (j = 0; j < M; j++) {
|
|
||||||
A0[i*M+j] = 0;
|
|
||||||
Ar[i*M+j] = 0;
|
|
||||||
A0_inv[i*M+j] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize A with M=3 and fill acc. to Eq. (17) from paper
|
|
||||||
A[0] = 1; A[3] = 1; A[6] = -1;
|
|
||||||
A[1] = 1; A[4] = 1; A[7] = 0;
|
|
||||||
A[2] = -1; A[5] = 0; A[8] = -1;
|
|
||||||
|
|
||||||
showMatrix(A, M, "A");
|
|
||||||
|
|
||||||
// Initialize the diagonal matrix A0,
|
|
||||||
// the inverse of A0_inv of diagonal matrix A0_inv
|
|
||||||
// and the update matrix Ar
|
|
||||||
for (i = 0; i < M; i++) {
|
|
||||||
A0[i*M + i] = A[i*M + i];
|
|
||||||
A0_inv[i*M + i] = 1.0/A[i*M + i];
|
|
||||||
Ar_index[i] = i+1; // ! First column needs to start with 1 !
|
|
||||||
for (j = 0; j < M; j++) {
|
|
||||||
Ar[i*M + j] = A[i*M + j] - A0[i*M + j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define pointers dim and n_updates to use in Sherman-Morrison(...) function call
|
|
||||||
MaponiA3(A0_inv, M, M, Ar, Ar_index);
|
|
||||||
showMatrix(A0_inv, M, "A0_inv");
|
|
||||||
|
|
||||||
// Deallocate all vectors and matrices
|
|
||||||
delete [] A, A0, A0_inv, Ar, Ar_index;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
program Interface_test
|
|
||||||
use Sherman_Morrison
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer i, j !! Iterators
|
|
||||||
integer(c_int) :: Dim, N_updates
|
|
||||||
integer(c_int), dimension(:), allocatable :: Updates_index
|
|
||||||
real(c_double), dimension(:,:), allocatable :: A, S, Updates
|
|
||||||
real(c_double), dimension(:,:), allocatable :: S_inv
|
|
||||||
|
|
||||||
Dim = 3
|
|
||||||
N_updates = 3
|
|
||||||
allocate(Updates_index(Dim), A(Dim,Dim), S(Dim,Dim), Updates(Dim,Dim), S_inv(Dim,Dim))
|
|
||||||
|
|
||||||
!! Initialize A with M=3 and fill acc. to Eq. (17) from paper
|
|
||||||
A(1,1) = 1.0d0
|
|
||||||
A(1,2) = 1.0d0
|
|
||||||
A(1,3) = -1.0d0
|
|
||||||
A(2,1) = 1.0d0
|
|
||||||
A(2,2) = 1.0d0
|
|
||||||
A(2,3) = 0.0d0
|
|
||||||
A(3,1) = -1.0d0
|
|
||||||
A(3,2) = 0.0d0
|
|
||||||
A(3,3) = -1.0d0
|
|
||||||
|
|
||||||
do i=1,Dim
|
|
||||||
do j=1,Dim
|
|
||||||
write(*,"(F3.0,3X)", advance="no") A(i,j)
|
|
||||||
end do
|
|
||||||
write(*,*)
|
|
||||||
end do
|
|
||||||
write(*,*)
|
|
||||||
|
|
||||||
!! Prepare the diagonal matrix S and the update matrix Updates
|
|
||||||
do i=1,Dim
|
|
||||||
Updates_index(i) = i
|
|
||||||
do j=1,Dim
|
|
||||||
if (i == j) then
|
|
||||||
S(i,j) = A(i,j)
|
|
||||||
S_inv(i,j) = 1.0d0 / S(i,j)
|
|
||||||
else
|
|
||||||
S(i,j) = 0.0d0
|
|
||||||
S_inv(i,j) = 0.0d0
|
|
||||||
end if
|
|
||||||
Updates(i,j) = A(i,j) - S(i,j)
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
|
|
||||||
call MaponiA3(S_inv, Dim, N_updates, Updates, Updates_index)
|
|
||||||
|
|
||||||
do i=1,Dim
|
|
||||||
do j=1,Dim
|
|
||||||
write(*,"(F3.0,3X)", advance="no") S_inv(i,j)
|
|
||||||
end do
|
|
||||||
write(*,*)
|
|
||||||
end do
|
|
||||||
|
|
||||||
deallocate(Updates_index, A, S, Updates, S_inv)
|
|
||||||
end program
|
|
@ -1,151 +0,0 @@
|
|||||||
program Interface_test
|
|
||||||
use Sherman_Morrison
|
|
||||||
use Helpers
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
integer i, j, col !! Iterators
|
|
||||||
integer(c_int) :: Dim, N_updates
|
|
||||||
integer(c_int), dimension(:), allocatable :: Updates_index
|
|
||||||
real(c_double), dimension(:,:), allocatable :: S, A, Updates
|
|
||||||
real(c_double), dimension(:,:), allocatable :: S_inv, S_inv_t, A_inv
|
|
||||||
|
|
||||||
Dim = 4
|
|
||||||
N_updates = 2
|
|
||||||
allocate( S(Dim,Dim), S_inv(Dim,Dim), S_inv_t(Dim,Dim), A(Dim,Dim), A_inv(Dim,Dim), &
|
|
||||||
Updates(Dim,N_updates), Updates_index(N_updates))
|
|
||||||
|
|
||||||
!! Initialize S, S_inv, A and A_inv
|
|
||||||
S(1,1) = 1.0d0
|
|
||||||
S(1,2) = 0.0d0
|
|
||||||
S(1,3) = 1.0d0
|
|
||||||
S(1,4) = -1.0d0
|
|
||||||
S(2,1) = 0.0d0
|
|
||||||
S(2,2) = 1.0d0
|
|
||||||
S(2,3) = 1.0d0
|
|
||||||
S(2,4) = 0.0d0
|
|
||||||
S(3,1) = -1.0d0
|
|
||||||
S(3,2) = 0.0d0
|
|
||||||
S(3,3) = -1.0d0
|
|
||||||
S(3,4) = 0.0d0
|
|
||||||
S(4,1) = 1.0d0
|
|
||||||
S(4,2) = 1.0d0
|
|
||||||
S(4,3) = 1.0d0
|
|
||||||
S(4,4) = 1.0d0
|
|
||||||
|
|
||||||
S_inv(1,1) = 1.0d0
|
|
||||||
S_inv(1,2) = -1.0d0
|
|
||||||
S_inv(1,3) = 1.0d0
|
|
||||||
S_inv(1,4) = 1.0d0
|
|
||||||
S_inv(2,1) = 1.0d0
|
|
||||||
S_inv(2,2) = 0.0d0
|
|
||||||
S_inv(2,3) = 2.0d0
|
|
||||||
S_inv(2,4) = 1.0d0
|
|
||||||
S_inv(3,1) = -1.0d0
|
|
||||||
S_inv(3,2) = 1.0d0
|
|
||||||
S_inv(3,3) = -2.0d0
|
|
||||||
S_inv(3,4) = -1.0d0
|
|
||||||
S_inv(4,1) = -1.0d0
|
|
||||||
S_inv(4,2) = 0.0d0
|
|
||||||
S_inv(4,3) = -1.0d0
|
|
||||||
S_inv(4,4) = 0.0d0
|
|
||||||
|
|
||||||
A(1,1) = 1.0d0
|
|
||||||
A(1,2) = 0.0d0
|
|
||||||
A(1,3) = 1.0d0
|
|
||||||
A(1,4) = -1.0d0
|
|
||||||
A(2,1) = 0.0d0
|
|
||||||
A(2,2) = -1.0d0
|
|
||||||
A(2,3) = 1.0d0
|
|
||||||
A(2,4) = -1.0d0
|
|
||||||
A(3,1) = -1.0d0
|
|
||||||
A(3,2) = 0.0d0
|
|
||||||
A(3,3) = -1.0d0
|
|
||||||
A(3,4) = 0.0d0
|
|
||||||
A(4,1) = 1.0d0
|
|
||||||
A(4,2) = 1.0d0
|
|
||||||
A(4,3) = 1.0d0
|
|
||||||
A(4,4) = 1.0d0
|
|
||||||
|
|
||||||
A_inv(1,1) = 0.0d0
|
|
||||||
A_inv(1,2) = -1.0d0
|
|
||||||
A_inv(1,3) = -2.0d0
|
|
||||||
A_inv(1,4) = -1.0d0
|
|
||||||
A_inv(2,1) = 1.0d0
|
|
||||||
A_inv(2,2) = 0.0d0
|
|
||||||
A_inv(2,3) = 2.0d0
|
|
||||||
A_inv(2,4) = 1.0d0
|
|
||||||
A_inv(3,1) = 0.0d0
|
|
||||||
A_inv(3,2) = 1.0d0
|
|
||||||
A_inv(3,3) = 1.0d0
|
|
||||||
A_inv(3,4) = 1.0d0
|
|
||||||
A_inv(4,1) = -1.0d0
|
|
||||||
A_inv(4,2) = 0.0d0
|
|
||||||
A_inv(4,3) = -1.0d0
|
|
||||||
A_inv(4,4) = 0.0d0
|
|
||||||
|
|
||||||
!! Prepare Updates and Updates_index
|
|
||||||
Updates(1,1) = 0
|
|
||||||
Updates(1,2) = 0
|
|
||||||
Updates(2,1) = -2
|
|
||||||
Updates(2,2) = -1
|
|
||||||
Updates(3,1) = 0
|
|
||||||
Updates(3,2) = 0
|
|
||||||
Updates(4,1) = 0
|
|
||||||
Updates(4,2) = 0
|
|
||||||
|
|
||||||
Updates_index(1) = 2
|
|
||||||
Updates_index(2) = 4
|
|
||||||
|
|
||||||
!! Write current S and S_inv to file for check in Octave
|
|
||||||
open(unit = 2000, file = "Slater_old.dat")
|
|
||||||
open(unit = 3000, file = "Slater_old_inv.dat")
|
|
||||||
do i=1,dim
|
|
||||||
do j=1,dim
|
|
||||||
write(2000,"(E23.15, 1X)", advance="no") S(i,j)
|
|
||||||
write(3000,"(E23.15, 1X)", advance="no") S_inv(i,j)
|
|
||||||
end do
|
|
||||||
write(2000,*)
|
|
||||||
write(3000,*)
|
|
||||||
end do
|
|
||||||
close(2000)
|
|
||||||
close(3000)
|
|
||||||
|
|
||||||
!! Write Updates to file to check
|
|
||||||
open(unit = 2000, file = "Updates.dat")
|
|
||||||
do i=1,dim
|
|
||||||
do j=1,n_updates
|
|
||||||
write(2000,"(E23.15, 1X)", advance="no") Updates(i,j)
|
|
||||||
end do
|
|
||||||
write(2000,*)
|
|
||||||
end do
|
|
||||||
close(2000)
|
|
||||||
|
|
||||||
!! Update S
|
|
||||||
do i=1,N_updates
|
|
||||||
do j=1,Dim
|
|
||||||
col = Updates_index(i)
|
|
||||||
S(j,col) = S(j,col) + Updates(j,i)
|
|
||||||
end do
|
|
||||||
end do
|
|
||||||
|
|
||||||
!! Update S_inv
|
|
||||||
call Transpose(S_inv, S_inv_t, Dim)
|
|
||||||
call MaponiA3(S_inv_t, Dim, N_updates, Updates, Updates_index)
|
|
||||||
call Transpose(S_inv_t, S_inv, Dim)
|
|
||||||
|
|
||||||
!! Write new S and S_inv to file for check in Octave
|
|
||||||
open(unit = 4000, file = "Slater.dat")
|
|
||||||
open(unit = 5000, file = "Slater_inv.dat")
|
|
||||||
do i=1,dim
|
|
||||||
do j=1,dim
|
|
||||||
write(4000,"(E23.15, 1X)", advance="no") S(i,j)
|
|
||||||
write(5000,"(E23.15, 1X)", advance="no") S_inv(i,j)
|
|
||||||
end do
|
|
||||||
write(4000,*)
|
|
||||||
write(5000,*)
|
|
||||||
end do
|
|
||||||
close(4000)
|
|
||||||
close(5000)
|
|
||||||
|
|
||||||
deallocate(Updates_index, A, A_inv, S, Updates, S_inv)
|
|
||||||
end program
|
|
@ -1 +0,0 @@
|
|||||||
icpc -c worker.cpp && ifort -c main.f90 && ifort -lstdc++ worker.o main.o -o test
|
|
23
mwe/main.cpp
23
mwe/main.cpp
@ -1,23 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
typedef int (*to2D)[3]; //pint2 is a pointer to an array of 2 ints
|
|
||||||
int linArray[9] = {0,1,2,3,4,5,6,7,8};
|
|
||||||
|
|
||||||
to2D dArray = (to2D)linArray;
|
|
||||||
|
|
||||||
std::cout << dArray[0][0] << std::endl;
|
|
||||||
std::cout << dArray[0][1] << std::endl;
|
|
||||||
std::cout << dArray[0][2] << std::endl;
|
|
||||||
std::cout << dArray[1][0] << std::endl;
|
|
||||||
std::cout << dArray[1][1] << std::endl;
|
|
||||||
std::cout << dArray[1][2] << std::endl;
|
|
||||||
std::cout << dArray[2][0] << std::endl;
|
|
||||||
std::cout << dArray[2][1] << std::endl;
|
|
||||||
std::cout << dArray[2][2] << std::endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
12
mwe/main.f90
12
mwe/main.f90
@ -1,12 +0,0 @@
|
|||||||
program test
|
|
||||||
use iso_c_binding
|
|
||||||
implicit none
|
|
||||||
|
|
||||||
interface
|
|
||||||
subroutine hello() bind(C, name="worker")
|
|
||||||
end subroutine
|
|
||||||
end interface
|
|
||||||
|
|
||||||
call hello()
|
|
||||||
|
|
||||||
end program test
|
|
@ -1,7 +0,0 @@
|
|||||||
#include "worker.h"
|
|
||||||
|
|
||||||
void worker()
|
|
||||||
{
|
|
||||||
std::cout << "Hello, World!" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
void worker();
|
|
||||||
}
|
|
@ -3,8 +3,8 @@
|
|||||||
#include "hdf5/serial/hdf5.h"
|
#include "hdf5/serial/hdf5.h"
|
||||||
#include "H5Cpp.h"
|
#include "H5Cpp.h"
|
||||||
|
|
||||||
#include "../SM_MaponiA3.hpp"
|
#include "SM_MaponiA3.hpp"
|
||||||
#include "../Helpers.hpp"
|
#include "Helpers.hpp"
|
||||||
|
|
||||||
using namespace H5;
|
using namespace H5;
|
||||||
//#define DEBUG 0
|
//#define DEBUG 0
|
||||||
|
Loading…
Reference in New Issue
Block a user