microsoft/onnxruntime-extensions
Publicmirrored fromhttps://github.com/microsoft/onnxruntime-extensionsAvailable
test/static_test/test_math.cc
22lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | #include "gtest/gtest.h" |
| 5 | #include <dlib/matrix.h> |
| 6 | |
| 7 | using namespace dlib; |
| 8 | |
| 9 | TEST(math, matrix_op) { |
| 10 | matrix<float> M(3,3); |
| 11 | M = 54.2, 7.4, 12.1, |
| 12 | 1, 2, 3, |
| 13 | 5.9, 0.05, 1; |
| 14 | |
| 15 | matrix<float,3,1> y; |
| 16 | y = 3.5, |
| 17 | 1.2, |
| 18 | 7.8; |
| 19 | |
| 20 | matrix<float> x = inv(M)*y; |
| 21 | EXPECT_FLOAT_EQ(x(1, 0), -13.909741); |
| 22 | } |
| 23 | |