static */
| 632 | } |
| 633 | |
| 634 | /* static */ std::unique_ptr<Array2D<float>> ReferenceUtil::MapArray2D( |
| 635 | const Array2D<float>& matrix, |
| 636 | const std::function<float(float)>& map_function) { |
| 637 | int64 rows = matrix.height(); |
| 638 | int64 cols = matrix.width(); |
| 639 | auto result = absl::make_unique<Array2D<float>>(rows, cols); |
| 640 | for (int64 i = 0; i < rows; ++i) { |
| 641 | for (int64 j = 0; j < cols; ++j) { |
| 642 | (*result)(i, j) = map_function(matrix(i, j)); |
| 643 | } |
| 644 | } |
| 645 | return result; |
| 646 | } |
| 647 | |
| 648 | /* static */ std::unique_ptr<Array2D<float>> ReferenceUtil::MapArray2D( |
| 649 | const Array2D<float>& lhs, const Array2D<float>& rhs, |