Create a grid of 3d positions

I want to create a function which return a 3d grid of 3d positions separated by intervals on each axis

*return type (list grid or array grid)

type t_grid = (float * float * float) list list list


type t_grid = (float * float * float) array array array

*here the signature :

create_grid width_x height_y depth_z inter_axis_x inter_axis_y inter_axis_z

create_grid : int -> int -> int -> int -> int -> int -> t_grid

I don't really know how to handle this in an optimized way;


It seems you are going to use this for numerical calculations. If your arrays have fixed size, better to use "array" than "list", because arrays are not resizeable. Lists have the overhead of nested linked structure. Beware that arrays cannot be larger than 2 million floats or so. Use "Bigarray" for larger arrays.

In fact, look into the documentation for the "Bigarray" module. It supports multidimensional arrays directly! This is surely much more efficient than a nested array of arrays. Look here:

Need Your Help

Django Sessions not Working

python django session cookies web

I have built an application that shows users their storage usage and quotas on a system. Since there are many users, sifting through their storage allocations can be tedious so I want to give admin...

Kubernetes pods N:M scheduling how-to


Batch computations, Monte Carlo, using Docker image, multiple jobs running on Google cloud and managed by Kubernetes. No Replication Controllers, just multiple pods with NoRestart policy delivering