ones

ones(dim)[source]

Creates an array with only entries equal to one.

Parameters:

dim (int or tuple) – Dimension of the array.

Raises:
  • ValueError – If the given dimension is not supported.

  • TypeError – If the given dimension has not the right type.

Returns:

y – An array of the given dimension with only entries equal to one.

Return type:

array