aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/CPP/Utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/CPP/Utils.h')
-rw-r--r--tests/validation/CPP/Utils.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/validation/CPP/Utils.h b/tests/validation/CPP/Utils.h
index 91d1afe1d7..e9a0f09847 100644
--- a/tests/validation/CPP/Utils.h
+++ b/tests/validation/CPP/Utils.h
@@ -100,6 +100,32 @@ void apply_2d_spatial_filter(Coordinates coord, const SimpleTensor<T> &src, Simp
}
RawTensor transpose(const RawTensor &src, int chunk_width = 1);
+
+/** Fill matrix random.
+ *
+ * @param[in,out] matrix Matrix
+ * @param[in] cols Columns (width) of matrix
+ * @param[in] rows Rows (height) of matrix
+ */
+template <std::size_t SIZE>
+inline void fill_warp_matrix(std::array<float, SIZE> &matrix, int cols, int rows)
+{
+ std::mt19937 gen(library.get()->seed());
+ std::uniform_real_distribution<float> dist(-1, 1);
+
+ for(int v = 0, r = 0; r < rows; ++r)
+ {
+ for(int c = 0; c < cols; ++c, ++v)
+ {
+ matrix[v] = dist(gen);
+ }
+ }
+ if(SIZE == 9)
+ {
+ matrix[(cols * rows) - 1] = 1;
+ }
+}
+
} // namespace validation
} // namespace test
} // namespace arm_compute