menpo.math.as_matrix(vectorizables, length=None, return_template=False, verbose=False)[source]

Create a matrix from a list/generator of Vectorizable objects. All the objects in the list must be the same size when vectorized.

Consider using a generator if the matrix you are creating is large and passing the length of the generator explicitly.

  • vectorizables (list or generator if Vectorizable objects) – A list or generator of objects that supports the vectorizable interface

  • length (int, optional) – Length of the vectorizable list. Useful if you are passing a generator with a known length.

  • verbose (bool, optional) – If True, will print the progress of building the matrix.

  • return_template (bool, optional) – If True, will return the first element of the list/generator, which was used as the template. Useful if you need to map back from the matrix to a list of vectorizable objects.


  • M ((length, n_features) ndarray) – Every row is an element of the list.

  • template (Vectorizable, optional) – If return_template == True, will return the template used to build the matrix M.


ValueErrorvectorizables terminates in fewer than length iterations