swapAxes method

Layout swapAxes(
  1. int first,
  2. int second
)

Returns a layout with axis first and second swapped.

Implementation

Layout swapAxes(int first, int second) {
  final first_ = checkIndex(first, rank, 'first');
  final second_ = checkIndex(second, rank, 'second');
  final axes = IntegerRange(rank).toList();
  axes[first_] = second_;
  axes[second_] = first_;
  return transpose(axes: axes);
}