-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
我的系统是ubuntu22, 安装了armadillo-12.4.1, 我在test_first增加的代码如下,
//
// Created by fss on 22-12-13.
//
#include <gtest/gtest.h>
#include <armadillo>
#include <glog/logging.h>
TEST(test_first, demo1) {
LOG(INFO) << "My first test!";
arma::fmat in_1(32, 32, arma::fill::ones);
ASSERT_EQ(in_1.n_cols, 32);
ASSERT_EQ(in_1.n_rows, 32);
ASSERT_EQ(in_1.size(), 32 * 32);
}
TEST(test_first, linear) {
arma::fmat A = "1,2,3;"
"4,5,6;"
"7,8,9;";
arma::fmat X = "1,1,1;"
"1,1,1;"
"1,1,1;";
arma::fmat bias = "1,1,1;"
"1,1,1;"
"1,1,1;";
arma::fmat output = A * X + bias;
//todo 在此处插入代码,完成output = AxX + bias的运算
// output = ?
const uint32_t cols = 3;
for (uint32_t c = 0; c < cols; ++c) {
float *col_ptr = output.colptr(c);
ASSERT_EQ(*(col_ptr + 0), 7);
ASSERT_EQ(*(col_ptr + 1), 16);
ASSERT_EQ(*(col_ptr + 2), 25);
}
LOG(INFO) << "\n" <<"Result Passed!";
}
报错是
/usr/bin/ld: CMakeFiles/test_kuiper_course.dir/test_first.cpp.o: in function `void arma::blas::gemv<float>(char const*, int const*, int const*, float const*, float const*, int const*, float const*, int const*, float const*, float*, int const*)':
test_first.cpp:(.text._ZN4arma4blas4gemvIfEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemvIfEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x57): undefined reference to `wrapper2_sgemv_'
/usr/bin/ld: CMakeFiles/test_kuiper_course.dir/test_first.cpp.o: in function `void arma::blas::gemm<float>(char const*, char const*, int const*, int const*, int const*, float const*, float const*, int const*, float const*, int const*, float const*, float*, int const*)':
test_first.cpp:(.text._ZN4arma4blas4gemmIfEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[_ZN4arma4blas4gemmIfEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_]+0x63): undefined reference to `wrapper2_sgemm_'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/test_kuiper_course.dir/build.make:113: test/test_kuiper_course] Error 1
make[1]: *** [CMakeFiles/Makefile2:126: test/CMakeFiles/test_kuiper_course.dir/all] Error 2
make: *** [Makefile:101: all] Error 2
Metadata
Metadata
Assignees
Labels
No labels