> There is one more important case, which is aligning just the beginning
> of the array.

Indeed -- thanks! The following should take care of that case (it's  
all fluff around calling aligned_empty() with a dim_alignments tuple  
of all 1's, and the array_alignment parameter as required):

def aligned_start_empty(shape, dtype, alignment, order='C'):
   '''Return an array with the first element aligned to a byte that is
   evenly-divisible by the specified alignment.'''
   order = order.upper()
   if order not in ('C', 'F'):
     raise ValueError("Order must be 'C' or 'F'.")
   dim_alignments = [1 for dim in shape]
   if order == 'F':
     shape = shape[::-1]
     return aligned_empty(shape, dtype, dim_alignments, alignment).T
   else:
     return aligned_empty(shape, dtype, dim_alignments, alignment)

Zach
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to