C / C ++ para programador Python [cerrado]
Tengo que cambiar de Python a C / C ++.
¿Conoces un "tutorial de referencia" rápido o algo así para tener una referencia sobre cómo comenzar? Por ejemplo, algo así como los tutoriales de Numpy y Scipy.
He leído mucha "documentación", por ejemplo
pero aún no me queda claro ni siquiera cómo comenzar a portar a C / C ++ algo como:
#!/usr/bin/env python
import time
import numpy as np
import tables as tb
"""Retrieve 3D positions form 1000 files and store them in one single HDF5 file.
"""
t = time.time()
# Empty array
sample = np.array([])
sample.shape = (0,3)
# Loop over the files
for i in range(0, 1000):
filename = "mill2sort-"+str(i)+"-extracted.h5"
print "Doing ", filename
# Open data file
h5f = tb.openFile(filename, 'r')
# Stack new data under previous data
sample = np.vstack((sample, h5f.root.data.read()))
h5f.close()
# Create the new file
h5 = tb.openFile("mill2sort-extracted-all", 'w')
# Save the array
h5.createArray(h5.root, 'data', sample, title='mill_2_sub_sample_all')
h5.flush()
h5.close()
print "Done in ", time.time()-t, " seconds."
en C o C ++. En este ejemplo, ni siquiera pude entender cómo pasar una matriz 3D a una función que encuentra sus dimensiones, algo así como
int getArrayDimensions(int* array, int *dimensions){
*dimensions = sizeof(*array)/sizeof(array[0]);
return 0;
}
Con la matriz siendo
int array[3][3][3] = ...
¡Gracias por cualquier sugerencia!:)