Typedefs | Functions | Variables
test_cnpy_eigen.cxx File Reference
#include "WireCellUtil/cnpy.h"
#include <Eigen/Core>

Go to the source code of this file.

Typedefs

typedef Eigen::Array< short, Eigen::Dynamic, Eigen::Dynamic > ArrayXXs
 

Functions

int main (int argc, char *argv[])
 

Variables

const int Nchanc = 480
 
const int Ntick = 2000
 

Typedef Documentation

typedef Eigen::Array<short, Eigen::Dynamic, Eigen::Dynamic> ArrayXXs

Definition at line 5 of file test_cnpy_eigen.cxx.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 11 of file test_cnpy_eigen.cxx.

12 {
13  std::string name = argv[0];
14  name += ".npz";
15 
16  //ArrayXXs a = ArrayXXs::Random(Nchanc,Ntick);
17  ArrayXXs a = ArrayXXs::Zero(Nchanc,Ntick);
18  a(0,1000) = 1000;
19  a(400,0) = 400;
20  const short* data = a.data();
21  cnpy::npz_save<short>(name.c_str(), "a", data, {Ntick, Nchanc}, "w");
22  /*
23  >>> import numpy
24  >>> f = numpy.load("eigentest.npz")
25  >>> a = f['a']
26  >>> print a.shape, a[0,400], a[1000,0]
27  (2000, 480) 400 1000
28  */
29  return 0;
30 }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
const int Ntick
basic_data data
Definition: format.h:764
Eigen::Array< short, Eigen::Dynamic, Eigen::Dynamic > ArrayXXs
const int Nchanc
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1124

Variable Documentation

const int Nchanc = 480

Definition at line 7 of file test_cnpy_eigen.cxx.

const int Ntick = 2000

Definition at line 9 of file test_cnpy_eigen.cxx.