cr.sparse.vec_unit

cr.sparse.vec_unit(n, i)[source]

Returns a unit vector in i-th dimension for the standard coordinate system

Parameters
  • n (int) – Length of the vector.

  • i (int) – Index/dimension of the unit vector.

Returns

A line vector of length n with all zeros except a one at position i.

Return type

jax.numpy.ndarray