Skip to content

Commit

Permalink
Merge pull request #1946 from stan-dev/bugfix/missing-file
Browse files Browse the repository at this point in the history
Bugfix/develop after #1895
  • Loading branch information
rok-cesnovar authored Jun 22, 2020
2 parents 2a7a857 + f0c0585 commit de6e454
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 48 deletions.
8 changes: 4 additions & 4 deletions test/unit/math/opencl/matrix_cl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <stan/math/opencl/copy.hpp>
#include <stan/math/opencl/zeros.hpp>
#include <stan/math/opencl/sub_block.hpp>
#include <test/unit/math/prim/fun/expect_matrix_eq.hpp>
#include <test/unit/util.hpp>
#include <gtest/gtest.h>
#include <algorithm>
#include <vector>
Expand Down Expand Up @@ -35,18 +35,18 @@ TEST(MathMatrixCL, matrix_cl_value) {
col_major << 1, 2, 3, 4, 5, 6, 7, 8, 9;
stan::math::matrix_cl<double> cl_from_col_major(col_major);
Eigen::MatrixXd res = stan::math::from_matrix_cl(cl_from_col_major);
expect_matrix_eq(col_major, res);
EXPECT_MATRIX_EQ(col_major, res);

Eigen::Map<Eigen::MatrixXd> map(col_major.data(), 3, 3);
stan::math::matrix_cl<double> cl_from_map(map);
res = stan::math::from_matrix_cl(cl_from_map);
expect_matrix_eq(col_major, res);
EXPECT_MATRIX_EQ(col_major, res);

Eigen::Matrix<double, -1, -1, Eigen::RowMajor> row_major(3, 3);
row_major << 1, 2, 3, 4, 5, 6, 7, 8, 9;
stan::math::matrix_cl<double> cl_from_row_major(row_major);
res = stan::math::from_matrix_cl(cl_from_row_major);
expect_matrix_eq(row_major, res);
EXPECT_MATRIX_EQ(row_major, res);
}

TEST(MathMatrixCL, assignment) {
Expand Down
88 changes: 44 additions & 44 deletions test/unit/math/prim/meta/ref_type_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stan/math/prim/meta.hpp>
#include <test/unit/math/prim/fun/expect_matrix_eq.hpp>
#include <test/unit/util.hpp>
#include <gtest/gtest.h>

TEST(MathMetaPrim, ref_type_non_eigen) {
Expand All @@ -18,14 +18,14 @@ TEST(MathMetaPrim, ref_type_non_eigen) {
ref_type_t<const std::vector<double>> c_ref1 = c;
ref_type_t<const std::vector<double>&> c_ref2 = c;

expect_std_vector_eq(a_ref1, a);
expect_std_vector_eq(a_ref2, a);
expect_std_vector_eq(a_ref3, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref1, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref2, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref3, a);
EXPECT_EQ(b_ref1, b);
EXPECT_EQ(b_ref2, b);
EXPECT_EQ(b_ref3, b);
expect_std_vector_eq(c_ref1, c);
expect_std_vector_eq(c_ref2, c);
EXPECT_STD_VECTOR_FLOAT_EQ(c_ref1, c);
EXPECT_STD_VECTOR_FLOAT_EQ(c_ref2, c);
EXPECT_TRUE(std::is_lvalue_reference<ref_type_t<double>>::value);
EXPECT_TRUE(std::is_lvalue_reference<ref_type_t<double&>>::value);
EXPECT_FALSE(std::is_reference<ref_type_t<double&&>>::value);
Expand Down Expand Up @@ -57,17 +57,17 @@ TEST(MathMetaPrim, ref_type_eigen_directly_accessible) {
ref_type_t<Eigen::Ref<Eigen::MatrixXd>&> c_ref2 = c;
ref_type_t<Eigen::Ref<Eigen::MatrixXd>&&> c_ref3 = std::move(c2);

expect_matrix_eq(a_ref1, a);
expect_matrix_eq(a_ref2, a);
expect_matrix_eq(a_ref3, a);
EXPECT_MATRIX_EQ(a_ref1, a);
EXPECT_MATRIX_EQ(a_ref2, a);
EXPECT_MATRIX_EQ(a_ref3, a);

expect_matrix_eq(b_ref1, b);
expect_matrix_eq(b_ref2, b);
expect_matrix_eq(b_ref3, b);
EXPECT_MATRIX_EQ(b_ref1, b);
EXPECT_MATRIX_EQ(b_ref2, b);
EXPECT_MATRIX_EQ(b_ref3, b);

expect_matrix_eq(c_ref1, c);
expect_matrix_eq(c_ref2, c);
expect_matrix_eq(c_ref3, c);
EXPECT_MATRIX_EQ(c_ref1, c);
EXPECT_MATRIX_EQ(c_ref2, c);
EXPECT_MATRIX_EQ(c_ref3, c);
EXPECT_TRUE((std::is_same<decltype(a), ref_type_t<decltype(a)&&>>::value));
EXPECT_TRUE((std::is_same<decltype(b), ref_type_t<decltype(b)&&>>::value));
EXPECT_TRUE((std::is_same<decltype(c), ref_type_t<decltype(c)&&>>::value));
Expand All @@ -87,9 +87,9 @@ TEST(MathMetaPrim, ref_type_eigen_expression) {
ref_type_t<decltype(a)&&> a_ref3 = m * 3;

Eigen::MatrixXd a_eval = a;
expect_matrix_eq(a_ref1, a_eval);
expect_matrix_eq(a_ref2, a_eval);
expect_matrix_eq(a_ref3, a_eval);
EXPECT_MATRIX_EQ(a_ref1, a_eval);
EXPECT_MATRIX_EQ(a_ref2, a_eval);
EXPECT_MATRIX_EQ(a_ref3, a_eval);

EXPECT_TRUE((
std::is_same<plain_type_t<decltype(a)>, ref_type_t<decltype(a)>>::value));
Expand All @@ -115,14 +115,14 @@ TEST(MathMetaPrim, ref_type_for_opencl_for_opencl_non_eigen) {
ref_type_for_opencl_t<const std::vector<double>> c_ref1 = c;
ref_type_for_opencl_t<const std::vector<double>&> c_ref2 = c;

expect_std_vector_eq(a_ref1, a);
expect_std_vector_eq(a_ref2, a);
expect_std_vector_eq(a_ref3, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref1, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref2, a);
EXPECT_STD_VECTOR_FLOAT_EQ(a_ref3, a);
EXPECT_EQ(b_ref1, b);
EXPECT_EQ(b_ref2, b);
EXPECT_EQ(b_ref3, b);
expect_std_vector_eq(c_ref1, c);
expect_std_vector_eq(c_ref2, c);
EXPECT_STD_VECTOR_FLOAT_EQ(c_ref1, c);
EXPECT_STD_VECTOR_FLOAT_EQ(c_ref2, c);
EXPECT_TRUE(std::is_lvalue_reference<ref_type_for_opencl_t<double>>::value);
EXPECT_TRUE(std::is_lvalue_reference<ref_type_for_opencl_t<double&>>::value);
EXPECT_FALSE(std::is_reference<ref_type_for_opencl_t<double&&>>::value);
Expand Down Expand Up @@ -155,17 +155,17 @@ TEST(MathMetaPrim, ref_type_for_opencl_eigen_contiguous) {
ref_type_for_opencl_t<ContiguousMap&> c_ref2 = c;
ref_type_for_opencl_t<ContiguousMap&&> c_ref3 = std::move(c2);

expect_matrix_eq(a_ref1, a);
expect_matrix_eq(a_ref2, a);
expect_matrix_eq(a_ref3, a);
EXPECT_MATRIX_EQ(a_ref1, a);
EXPECT_MATRIX_EQ(a_ref2, a);
EXPECT_MATRIX_EQ(a_ref3, a);

expect_matrix_eq(b_ref1, b);
expect_matrix_eq(b_ref2, b);
expect_matrix_eq(b_ref3, b);
EXPECT_MATRIX_EQ(b_ref1, b);
EXPECT_MATRIX_EQ(b_ref2, b);
EXPECT_MATRIX_EQ(b_ref3, b);

expect_matrix_eq(c_ref1, c);
expect_matrix_eq(c_ref2, c);
expect_matrix_eq(c_ref3, c);
EXPECT_MATRIX_EQ(c_ref1, c);
EXPECT_MATRIX_EQ(c_ref2, c);
EXPECT_MATRIX_EQ(c_ref3, c);
EXPECT_TRUE(
(std::is_same<decltype(a), ref_type_for_opencl_t<decltype(a)&&>>::value));
EXPECT_TRUE(
Expand Down Expand Up @@ -203,17 +203,17 @@ TEST(MathMetaPrim, ref_type_for_opencl_eigen_non_contiguous) {
ref_type_for_opencl_t<Eigen::Ref<Eigen::MatrixXd>&> c_ref2 = c;
ref_type_for_opencl_t<Eigen::Ref<Eigen::MatrixXd>&&> c_ref3 = std::move(c2);

expect_matrix_eq(a_ref1, a);
expect_matrix_eq(a_ref2, a);
expect_matrix_eq(a_ref3, a);
EXPECT_MATRIX_EQ(a_ref1, a);
EXPECT_MATRIX_EQ(a_ref2, a);
EXPECT_MATRIX_EQ(a_ref3, a);

expect_matrix_eq(b_ref1, b);
expect_matrix_eq(b_ref2, b);
expect_matrix_eq(b_ref3, b);
EXPECT_MATRIX_EQ(b_ref1, b);
EXPECT_MATRIX_EQ(b_ref2, b);
EXPECT_MATRIX_EQ(b_ref3, b);

expect_matrix_eq(c_ref1, c);
expect_matrix_eq(c_ref2, c);
expect_matrix_eq(c_ref3, c);
EXPECT_MATRIX_EQ(c_ref1, c);
EXPECT_MATRIX_EQ(c_ref2, c);
EXPECT_MATRIX_EQ(c_ref3, c);
EXPECT_TRUE((std::is_same<Eigen::MatrixXd,
ref_type_for_opencl_t<decltype(a)&&>>::value));
EXPECT_TRUE((std::is_same<Eigen::MatrixXd,
Expand All @@ -233,9 +233,9 @@ TEST(MathMetaPrim, ref_type_for_opencl_eigen_expression) {
ref_type_for_opencl_t<decltype(a)&&> a_ref3 = m * 3;

Eigen::MatrixXd a_eval = a;
expect_matrix_eq(a_ref1, a_eval);
expect_matrix_eq(a_ref2, a_eval);
expect_matrix_eq(a_ref3, a_eval);
EXPECT_MATRIX_EQ(a_ref1, a_eval);
EXPECT_MATRIX_EQ(a_ref2, a_eval);
EXPECT_MATRIX_EQ(a_ref3, a_eval);

EXPECT_TRUE((std::is_same<plain_type_t<decltype(a)>,
ref_type_for_opencl_t<decltype(a)>>::value));
Expand Down

0 comments on commit de6e454

Please sign in to comment.