Skip to content

Commit

Permalink
Still a problem with initializing
Browse files Browse the repository at this point in the history
  • Loading branch information
nquesada committed Jan 14, 2020
1 parent 9f0fb80 commit c66f3c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
6 changes: 6 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ example.o: example.cpp
example-cpp: example.o
$(CC) $^ $(LFLAGS) -o $@

example_hermite.o: example_hermite.cpp
$(CC) $^ $(CFLAGS) -c

example_hermite.out: example_hermite.o
$(CC) $^ $(LFLAGS) -o $@

clean:
rm -rf *~ *.out *.o *.so *.pyc *.mod
32 changes: 20 additions & 12 deletions include/hermite_multidimensional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,12 @@ inline T* hermite_multidimensional_cpp(const std::vector<T> &R, const std::vecto
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);


T val = 0;
memset(H,sizeof(val),sizeof(H));
H[0] = 1;

std::vector<int> nextPos(dim, 1);
std::vector<int> jumpFrom(dim, 1);
std::vector<double> factors(resolution+1, 0);
int jump = 0;
int k;
ullint nextCoordinate, fromCoordinate;
Expand Down Expand Up @@ -164,15 +163,18 @@ inline T* renorm_hermite_multidimensional_cpp(const std::vector<T> &R, const st
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);

T val = 0;
memset(H,sizeof(val),sizeof(H)); //std::cout<<H[0];
//std::cout<<H[1];
//std::cout<<H[2];

H[0] = 1;
std::vector<double> intsqrt(resolution+1, 0);
for (int ii = 0; ii<=resolution; ii++) {
intsqrt[ii] = std::sqrt((static_cast<double>(ii)));
}
std::vector<int> nextPos(dim, 1);
std::vector<int> jumpFrom(dim, 1);
std::vector<double> factors(resolution+1, 0);
int jump = 0;
int k;
ullint nextCoordinate, fromCoordinate;
Expand Down Expand Up @@ -216,15 +218,15 @@ inline T* interferometer_cpp(const std::vector<T> &R, const int &resolution) {
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);

T val = 0;
memset(H,sizeof(val),sizeof(H));
H[0] = 1;
std::vector<double> intsqrt(resolution+1, 0);
for (int ii = 0; ii<=resolution; ii++) {
intsqrt[ii] = std::sqrt((static_cast<double>(ii)));
}
std::vector<int> nextPos(dim, 1);
std::vector<int> jumpFrom(dim, 1);
std::vector<double> factors(resolution+1, 0);
int jump = 0;
int k;
ullint nextCoordinate, fromCoordinate;
Expand Down Expand Up @@ -285,7 +287,8 @@ inline T* squeezing_cpp(const std::vector<T> &R, const int &resolution) {
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);

T val = 0;
memset(H,sizeof(val),sizeof(H));
H[0] = std::sqrt(-R[1]);
std::vector<double> intsqrt(resolution+1, 0);
for (int ii = 0; ii<=resolution; ii++) {
Expand Down Expand Up @@ -340,15 +343,15 @@ inline T* displacement_cpp(const std::vector<T> &y, const int &resolution) {
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);

T val = 0;
memset(H,sizeof(val),sizeof(H));
H[0] = std::exp(0.5*y[0]*y[1]);
std::vector<double> intsqrt(resolution+1, 0);
for (int ii = 0; ii<=resolution; ii++) {
intsqrt[ii] = std::sqrt((static_cast<double>(ii)));
}
std::vector<int> nextPos(dim, 1);
std::vector<int> jumpFrom(dim, 1);
std::vector<double> factors(resolution+1, 0);
int jump = 0;
int k;
ullint nextCoordinate, fromCoordinate;
Expand Down Expand Up @@ -399,6 +402,13 @@ inline T* two_mode_squeezing_cpp(const std::vector<T> &R, const int &resolution)
ullint Hdim = pow(resolution, dim);
T *H;
H = (T*) malloc(sizeof(T)*Hdim);
T val = 0;
memset(H,sizeof(val),sizeof(H));
//memset(H, 0x00, sizeof(H));
for (ullint jj = 0; jj < Hdim; jj++){
H[jj] = 0.0;
std::cout << H[jj];
}

H[0] = -R[2];
std::vector<double> intsqrt(resolution+1, 0);
Expand All @@ -407,8 +417,6 @@ inline T* two_mode_squeezing_cpp(const std::vector<T> &R, const int &resolution)
}
std::vector<int> nextPos(dim, 1);
std::vector<int> jumpFrom(dim, 1);
std::vector<int> ek(dim, 0);
std::vector<double> factors(resolution+1, 0);
int jump = 0;
int k;
ullint nextCoordinate, fromCoordinate;
Expand Down

0 comments on commit c66f3c1

Please sign in to comment.