vt::eye#

template<typename T = float>
Tensor<T, 2> vt::eye(size_t m, const Order order = Order::C)#

Generate a 2D identity matrix.

Template Parameters:

T – Data type of the tensor.

Parameters:
  • m – The number of rows and columns.

  • order – The order of the tensor.

Returns:

Tensor<T, 2>: The new tensor object.

template<typename T = float>
Tensor<T, 2> vt::eye(size_t m, size_t n, const Order order = Order::C)#

Generate a 2D array with ones on the diagonals and zeros elsewhere.

Template Parameters:

T – Data type of the tensor.

Parameters:
  • m – The number of rows.

  • n – The number of columns.

  • order – The order of the tensor.

Returns:

Tensor<T, 2>: The new tensor object.