| 42 | // Returns the result of a transpose operation on the input matrix. |
| 43 | template <typename T> |
| 44 | static std::unique_ptr<Array2D<T>> TransposeArray2D( |
| 45 | const Array2D<T>& operand) { |
| 46 | auto result = |
| 47 | absl::make_unique<Array2D<T>>(operand.width(), operand.height()); |
| 48 | for (int64 w = 0; w < operand.width(); ++w) { |
| 49 | for (int64 h = 0; h < operand.height(); ++h) { |
| 50 | (*result)(w, h) = operand(h, w); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | return result; |
| 55 | } |
| 56 | |
| 57 | // Returns the result of a matrix multiply `lhs x rhs`. |
| 58 | template <typename T> |