Я пытался запустить следующую программу, используя библиотеку линейной алгебры броненосца. С разреженными матрицами мне нужно установить SUPERLU 4.3. Сначала я установил SUPERLU 5.2, но поскольку в документации armadillo говорится, что она работает только с версией 4.3, я установил SUPERLU 4.3.
//
// main.cpp
// SpMat_Test
//
// Created by Arash Fahim on 1/28/20.
// Copyright © 2020 Arash Fahim. All rights reserved.
//
#include <iostream>
#include <armadillo>
using namespace arma;
int main() {
// insert code here...
sp_mat A = sprandu(2000, 2000, 0.01);
vec B=ones<vec>(2000);
vec x = spsolve(A, B);
return 0;
}
Перед добавлением SUPERLU программа выполняет и генерирует
error: spsolve(): use of SuperLU must be enabled
libc++abi.dylib: terminating with uncaught exception of type std::logic_error: spsolve(): use of SuperLU must be enabled
Program ended with exit code: 9
Но после SUPERLU сообщение об ошибке изменилось на
$ g++ -g main.cpp -larmadillo
In file included from main.cpp:10:
In file included from /usr/local/include/armadillo:88:
/usr/local/include/armadillo_bits/include_superlu.hpp:95:12: error: '/supermatrix.h' file not found, did you mean 'supermatrix.h'?
#include ARMA_INCFILE_WRAP(ARMA_SLU_SUPERMATRIX_H)
^
/usr/local/include/armadillo_bits/compiler_setup.hpp:79:30: note: expanded from macro 'ARMA_INCFILE_WRAP'
#define ARMA_INCFILE_WRAP(x) <x>
^
In file included from main.cpp:10:
In file included from /usr/local/include/armadillo:88:
/usr/local/include/armadillo_bits/include_superlu.hpp:96:12: error: '/superlu_enum_consts.h' file not found, did you mean 'superlu_enum_consts.h'?
#include ARMA_INCFILE_WRAP(ARMA_SLU_SUPERLU_ENUM_CONSTS_H)
^
/usr/local/include/armadillo_bits/compiler_setup.hpp:79:30: note: expanded from macro 'ARMA_INCFILE_WRAP'
#define ARMA_INCFILE_WRAP(x) <x>
^
2 errors generated.
Я проверил, что оба файла '/superlu_enum_consts.h' и '/supermatrix.h' существуют в пути, который должен найти компилятор, я думаю. Я слишком большой, чтобы понять, что не так.