如何在C ++中使用特征库导入矩阵市场文件 [英] How to import matrix market files with eigen library in c++

查看:65
本文介绍了如何在C ++中使用特征库导入矩阵市场文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是C ++的新手,并且习惯于MATLAB.不幸的是,我的矩阵大小对于MATLAB来说太大了,所以我想在C ++中尝试一下.我发现本征库3.3.7可以进行矩阵处理.为此,我需要将矩阵市场文件导入Visual Studio2019.我了解C ++的一些基础知识,并尝试使用loadMarket导入文件.尝试编译后,在MarketIO.h文件中收到30个错误.

I'm new to C++ and used to MATLAB. Unfortunatly my matrix size got too big for MATLAB, so I want to try it in C++. I've found the eigen library 3.3.7 to do matrix manipulations. For this I need to import my matrix market files into Visual Studio 2019. I know some basics in C++ and tried to import my files with loadMarket. After trying to compile it I get like 30 errors in the MarketIO.h file.

这是我正在使用的文件. https://eigen.tuxfamily.org/dox/unsupported/MarketIO_8h_source.html

This is the file I'm using. https://eigen.tuxfamily.org/dox/unsupported/MarketIO_8h_source.html

#include <Eigen/Sparse>
#include <unsupported/Eigen/src/SparseExtra/MarketIO.h>

int main(){
    typedef Eigen::SparseMatrix<float, Eigen::RowMajor>SMatrixXf;
    SMatrixXf A;
    Eigen::loadMarket(A, "B.mtx");
}

推荐答案

您绝不能直接包含来自 unsupported/Eigen/src/...(或来自 Eigen/src/... ).只需包含相应的父标头即可:

You must never directly include files from unsupported/Eigen/src/... (or from Eigen/src/...). Just include the corresponding parent header instead:

#include <unsupported/Eigen/SparseExtra>

这篇关于如何在C ++中使用特征库导入矩阵市场文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆