У меня серьезные проблемы с тем, чтобы заставить Armadillo 5.000.1 работать с CodeBlocks 13.12 в Windows 8.1.
- В
project build options -> linker settings
я добавил библиотеки..\armadillo-5.000.1\examples\lib_win64\blas_win64_MT.lib
и..\armadillo-5.000.1\examples\lib_win64\lapack_win64_MT.lib
. - В
project build options->search directories
я добавил..\armadillo-5.000.1\include
и..\..\..\..\..\Program Files\mingw-w64\x86_64-4.9.2-posix-seh-rt_v4-rev2\mingw64\include
к компилятору и..\armadillo-5.000.1\examples\lib_win64
к компоновщику. - Я раскомментировал
#define ARMA_USE_LAPACK
и#define ARMA_USE_BLAS
вconfig.hpp
. - Я (я думаю) использую 64-битный компилятор mingw.
Когда я запускаю файл example1.cpp, я получаю следующую ошибку:
-------------- Build: Debug in CS156b (compiler: GNU GCC Compiler)---------------
g++.exe -L..\armadillo-5.000.1\examples\lib_win64 -o bin\Debug\CS156b.exe obj\Debug\armadillo-5.000.1\examples\example1.o obj\Debug\load_data3.o ..\armadillo-5.000.1\examples\lib_win64\lapack_win64_MT.lib ..\armadillo-5.000.1\examples\lib_win64\blas_win64_MT.lib
..\armadillo-5.000.1\examples\lib_win64\lapack_win64_MT.lib: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Кроме того, код, который написал мой товарищ по команде и который отлично работает на ее (Linux) компьютере
#include <iostream>
#include <fstream>
#include <ctime>
#define ARMA_64BIT_WORD
#include <armadillo>
/*
* Read in data from the um.zip file all.dta
* and store in a sparse vector. There are
* 458293 reviewers and 17770 reviews.
*/
int main()
{
using namespace std;
clock_t begin = clock();
vector<double> ratings;
arma::umat locations = arma::umat(2, 102416306);
// Open the file
string line;
ifstream myfile("um/all.dta");
int c = 0;
if (myfile.is_open())
{
while (getline(myfile, line))
{
//cout << line << endl;
if (c % 100 == 0)
cout << c<< endl;
int space1 = line.find(" ");
int space2 = line.find(" ", space1 + 1);
int space3 = line.find(" ", space2 + 1);
// Insert into our temporary data vectors
locations(0, c) = atoi(line.substr(0, space1).c_str());
locations(1, c) = atoi(line.substr(space1 + 1, space2).c_str());
ratings.push_back(atoi(line.substr(space3 + 1).c_str()));
// cout << user << " " << review << " " << rating << endl;
/*
boost::split(split_line, line, boost::is_any_of(" "));
// Convert data to ints
for (unsigned int i = 0; i < split_line.size(); ++i)
{
line_data.push_back(atoi(split_line[i].c_str()));
}
*/
c += 1;
}
}
// Create the sparse matrix
arma::sp_mat m = arma::sp_mat(locations, arma::vec(ratings));
// Serialize the sparse matrix object
//fstream ofs("sparse_matrix_eigen");
//boost::archive::text_oarchive ar(ofs);
// Write data
//ar & m;
clock_t end = clock();
double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
cout << elapsed_secs << endl;
cout << m;
}
дает мне ошибку:
error: SpMat::SpMat(): number of locations is different than number of values
terminate called after throwing an instance of 'std::logic_error'
what(): SpMat::SpMat(): number of locations is different than number of values
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Process returned 255 (0xFF) execution time : 5.181 s
Press any key to continue.
Кто-нибудь знает, что я делаю неправильно?