Skip to content

Commit

Permalink
windows
Browse files Browse the repository at this point in the history
  • Loading branch information
hongyx11 committed Dec 31, 2020
1 parent 33a0c0e commit 4504142
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions recipes/cnpy/all/test_package/example1.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#include <cstdlib>
#include<vector>
#include<complex>

#include"cnpy.h"

int main() {
const int Nx = 128;
const int Ny = 64;
const int Nz = 32;

std::vector<std::complex<double>> data(Nx*Ny*Nz);
for(int i = 0;i < Nx*Ny*Nz;i++) data[i] = std::complex<double>(rand(),rand());
const size_t Nx = 16;
const size_t Ny = 16;
const size_t Nz = 16;

std::vector<double> data(Nx*Ny*Nz);
for(int i = 0;i < Nx*Ny*Nz;i++) data[i] = rand();
cnpy::npy_save("arr1.npy",&data[0],{Nz,Ny,Nx},"w");
cnpy::NpyArray arr = cnpy::npy_load("arr1.npy");
std::complex<double>* loaded_data = arr.data<std::complex<double>>();

return EXIT_SUCCESS;
}

0 comments on commit 4504142

Please sign in to comment.