1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-04-27 21:23:18 +00:00

Add matio

This commit is contained in:
Carles Fernandez 2017-11-17 21:54:02 +01:00
parent 00e37a83a6
commit d4aa35316d
3 changed files with 8 additions and 3 deletions

View File

@ -1490,6 +1490,7 @@ if(NOT MATIO_FOUND)
endif(CMAKE_VERSION VERSION_LESS 3.2) endif(CMAKE_VERSION VERSION_LESS 3.2)
set(MATIO_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ) set(MATIO_LIBRARIES ${CMAKE_CURRENT_BINARY_DIR}/matio/lib/${CMAKE_FIND_LIBRARY_PREFIXES}matio${CMAKE_STATIC_LIBRARY_SUFFIX} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} )
set(MATIO_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/matio/include ) set(MATIO_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/matio/include )
set(MATIO_LOCAL true)
endif(HDF5_FOUND) endif(HDF5_FOUND)
endif(ZLIB_FOUND) endif(ZLIB_FOUND)
endif(NOT MATIO_FOUND) endif(NOT MATIO_FOUND)

View File

@ -47,7 +47,7 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time
libboost-serialization-dev libboost-program-options-dev libboost-test-dev \ libboost-serialization-dev libboost-program-options-dev libboost-test-dev \
liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev \ liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev \
libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev \ libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev \
python-mako python-six python-mako python-six libmatio-dev
~~~~~~ ~~~~~~
Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line
@ -495,6 +495,7 @@ $ sudo port install gnutls
$ sudo port install google-glog +gflags $ sudo port install google-glog +gflags
$ sudo port install py27-mako $ sudo port install py27-mako
$ sudo port install py27-six $ sudo port install py27-six
$ sudo port install matio
~~~~~~ ~~~~~~
You also might need to activate a Python installation. The list of installed versions can be retrieved with: You also might need to activate a Python installation. The list of installed versions can be retrieved with:
@ -533,6 +534,7 @@ $ brew install cmake hdf5 arpack superlu
$ brew install armadillo $ brew install armadillo
$ brew install glog gflags gnutls $ brew install glog gflags gnutls
$ brew install gnuradio $ brew install gnuradio
$ brew install libmatio
$ pip install mako $ pip install mako
$ pip install six $ pip install six
~~~~~~ ~~~~~~

View File

@ -66,6 +66,7 @@ TEST(MatioTest, WriteAndReadDoubles)
matvar_read = Mat_VarRead(matfp_read, "x"); matvar_read = Mat_VarRead(matfp_read, "x");
double *x_read = reinterpret_cast<double*>(matvar_read->data); double *x_read = reinterpret_cast<double*>(matvar_read->data);
Mat_Close(matfp_read); Mat_Close(matfp_read);
Mat_VarFree(matvar_read);
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
{ {
EXPECT_DOUBLE_EQ(x[i], x_read[i]); EXPECT_DOUBLE_EQ(x[i], x_read[i]);
@ -84,7 +85,7 @@ TEST(MatioTest, WriteAndReadGrComplex)
ASSERT_FALSE(reinterpret_cast<long*>(matfp) == NULL) << "Error creating .mat file"; ASSERT_FALSE(reinterpret_cast<long*>(matfp) == NULL) << "Error creating .mat file";
std::vector<gr_complex> x_v = { {1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}}; std::vector<gr_complex> x_v = { {1, 10}, {2, 9}, {3, 8}, {4, 7}, {5, 6}, {6, -5}, {7, -4}, {8, 3}, {9, 2}, {10, 1}};
const int size = x_v.size(); const unsigned int size = x_v.size();
float x_real[size]; float x_real[size];
float x_imag[size]; float x_imag[size];
unsigned int i = 0; unsigned int i = 0;
@ -126,8 +127,9 @@ TEST(MatioTest, WriteAndReadGrComplex)
} }
Mat_Close(matfp_read); Mat_Close(matfp_read);
Mat_VarFree(matvar_read);
for(int i = 0; i < size; i++) for(unsigned int i = 0; i < size; i++)
{ {
EXPECT_FLOAT_EQ(x_v[i].real(), x_v_read[i].real()); EXPECT_FLOAT_EQ(x_v[i].real(), x_v_read[i].real());
EXPECT_FLOAT_EQ(x_v[i].imag(), x_v_read[i].imag()); EXPECT_FLOAT_EQ(x_v[i].imag(), x_v_read[i].imag());