简介
Eigen是一个开源的矩阵和向量的计算库。其主要提供了
- 密集矩阵定义和计算
- 稀疏矩阵定义及计算
- 几何意义
安装
Eigen其实并不用安装,应为其直接提供了C++的源码,而且是最有.h头文件,所有的声明和定义都在头文件内。
但这里说的安装,包括了源码拷贝到对应的系统位置,还有相关的一些设定。
Mac上简单安装
源码
如果你熟悉make操作或CMake,eigen并不需要安装,简单地下载并解压得到源码即可。实际上,在下载的Eigen子目录下的头文件是你唯一需要的,它们对所有的平台都是一致的,包括Windows,Linux,Mac……。然后你可以在你的c/C++代码中#include相关的头文件,然后编译运行。
mac 工具安装
在mac上可以使用Brew进行简单安装
$ brew info eigen
eigen: stable 3.3.7 (bottled), HEAD
C++ template library for linear algebra
https://eigen.tuxfamily.org/
Not installed
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/eigen.rb
==> Dependencies
Build: cmake ✘
==> Options
--HEAD
Install HEAD version
$
$ $ brew install eigen --verbose
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/eigen-3.3.7.high_sierra.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/79/79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827?__gda__=exp=1581844210~hmac=3a6b883979c10748ffa852494407055aaca620e8b30e0c97d7c7b8bd6851236d&response-content-disposition=attachment%3Bfilename%3D%22eigen-3.3.7.high_sierra.bottle.tar.gz%22&response-content-type=application%2Fgzip&requestInfo=U2FsdGVkX1-2mVVKrexc5neg1TrVW75s7zacghZ5TLvPZbLaz7dtUFwNXHsk8XEfLSru-n2zcqrHOlOeEegdJHNuwXt_XEfVbXexPTH51i_jVGnxk9JGEU5asLAv0floxQMpeumtk_R5vqAU-X55Aw&response-X-Checksum-Sha1=02b91fb73eecd067d7830bb7f394a02349893b8a&response-X-Checksum-Sha2=79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827
/usr/bin/curl -q --globoff --show-error --user-agent Homebrew/2.2.5\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 10.13.6\)\ curl/7.54.0 --fail --location --remote-time --continue-at 0 --output /Users/david/Library/Caches/Homebrew/downloads/6f2e7171c37395b3cceb4bc7a13d60781e8dc55a1f4936f8ed4500d585bcef8e--eigen-3.3.7.high_sierra.bottle.tar.gz.incomplete https://akamai.bintray.com/79/79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827\?__gda__=exp=1581844210\~hmac=3a6b883979c10748ffa852494407055aaca620e8b30e0c97d7c7b8bd6851236d\&response-content-disposition=attachment\%3Bfilename\%3D\%22eigen-3.3.7.high_sierra.bottle.tar.gz\%22\&response-content-type=application\%2Fgzip\&requestInfo=U2FsdGVkX1-2mVVKrexc5neg1TrVW75s7zacghZ5TLvPZbLaz7dtUFwNXHsk8XEfLSru-n2zcqrHOlOeEegdJHNuwXt_XEfVbXexPTH51i_jVGnxk9JGEU5asLAv0floxQMpeumtk_R5vqAU-X55Aw\&response-X-Checksum-Sha1=02b91fb73eecd067d7830bb7f394a02349893b8a\&response-X-Checksum-Sha2=79c52d57394cf485eb324effab69279e4f3beb63cbacfa600ae0a678d852a827
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1121k 100 1121k 0 0 31338 0 0:00:36 0:00:36 --:--:-- 22652
==> Verifying 6f2e7171c37395b3cceb4bc7a13d60781e8dc55a1f4936f8ed4500d585bcef8e--eigen-3.3.7.high_sierra.bottle.tar.gz checksum
==> Pouring eigen-3.3.7.high_sierra.bottle.tar.gz
tar xof /Users/david/Library/Caches/Homebrew/downloads/6f2e7171c37395b3cceb4bc7a13d60781e8dc55a1f4936f8ed4500d585bcef8e--eigen-3.3.7.high_sierra.bottle.tar.gz -C /var/folders/b3/gb4zt5zs0y58mk5sq84grj4m0000gn/T/d20200216-2146-1nkw3yi
cp -pR /var/folders/b3/gb4zt5zs0y58mk5sq84grj4m0000gn/T/d20200216-2146-1nkw3yi/eigen/. /usr/local/Cellar/eigen
chmod -Rf +w /var/folders/b3/gb4zt5zs0y58mk5sq84grj4m0000gn/T/d20200216-2146-1nkw3yi
==> Finishing up
ln -s ../Cellar/eigen/3.3.7/include/eigen3 eigen3
rm /usr/local/share/cmake
mkdir -p /usr/local/share/cmake/Help
mkdir -p /usr/local/share/cmake/Help/command
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/FIND_XXX.txt FIND_XXX.txt
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/FIND_XXX_ORDER.txt FIND_XXX_ORDER.txt
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/FIND_XXX_ROOT.txt FIND_XXX_ROOT.txt
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/LINK_OPTIONS_LINKER.txt LINK_OPTIONS_LINKER.txt
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/OPTIONS_SHELL.txt OPTIONS_SHELL.txt
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_compile_definitions.rst add_compile_definitions.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_compile_options.rst add_compile_options.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_custom_command.rst add_custom_command.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_custom_target.rst add_custom_target.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_definitions.rst add_definitions.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_dependencies.rst add_dependencies.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_executable.rst add_executable.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_library.rst add_library.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_link_options.rst add_link_options.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_subdirectory.rst add_subdirectory.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/add_test.rst add_test.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/aux_source_directory.rst aux_source_directory.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/break.rst break.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/build_command.rst build_command.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/build_name.rst build_name.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/cmake_host_system_information.rst cmake_host_system_information.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/cmake_minimum_required.rst cmake_minimum_required.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/cmake_parse_arguments.rst cmake_parse_arguments.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/cmake_policy.rst cmake_policy.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/configure_file.rst configure_file.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/continue.rst continue.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/create_test_sourcelist.rst create_test_sourcelist.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_build.rst ctest_build.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_configure.rst ctest_configure.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_coverage.rst ctest_coverage.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_empty_binary_directory.rst ctest_empty_binary_directory.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_memcheck.rst ctest_memcheck.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_read_custom_files.rst ctest_read_custom_files.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_run_script.rst ctest_run_script.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_sleep.rst ctest_sleep.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_start.rst ctest_start.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_submit.rst ctest_submit.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_test.rst ctest_test.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_update.rst ctest_update.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/ctest_upload.rst ctest_upload.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/define_property.rst define_property.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/else.rst else.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/elseif.rst elseif.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/enable_language.rst enable_language.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/enable_testing.rst enable_testing.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/endforeach.rst endforeach.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/endfunction.rst endfunction.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/endif.rst endif.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/endmacro.rst endmacro.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/endwhile.rst endwhile.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/exec_program.rst exec_program.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/execute_process.rst execute_process.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/export.rst export.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/export_library_dependencies.rst export_library_dependencies.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/file.rst file.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/find_file.rst find_file.rst
ln -s ../../../../Cellar/cmake/3.13.4/share/cmake/Help/command/find_library.rst find_l

本文介绍Eigen库的安装过程,包括在Mac上使用Brew工具的简单安装方法,以及如何通过下载源码并解压来使用该库。此外,还提供了一个简单的Eigen程序示例,用于验证安装是否成功。
最低0.47元/天 解锁文章
8334

被折叠的 条评论
为什么被折叠?



