### Install BoltzTraP2 from source Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/README.md For users installing from source, first install dependencies, then run the setup script. ```bash python setup.py install ``` -------------------------------- ### Get help with setup.py commands Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/README.md Provides detailed help for various setup.py commands, useful for advanced installation control. ```bash python setup.py --help ``` ```bash python setup.py --help-commands ``` ```bash python setup.py install --help ``` -------------------------------- ### Install and Build Documentation Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/README.md Commands to install documentation dependencies and start a live-reloading Sphinx server. ```shell $ pip install -e ".[docs]" $ sphinx-autobuild docs docs/_build ``` -------------------------------- ### Install Development Tools Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/Contributing.md Install necessary development tools for code formatting and analysis. This example shows installation using dnf. ```console # dnf install clang-tools-extra ``` -------------------------------- ### Install and Install Pre-commit Hooks Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/Contributing.md Install the pre-commit package and its hooks to ensure code quality before committing. This is recommended for local development. ```console pip install pre-commit ``` ```console pre-commit install ``` -------------------------------- ### Define Build Targets and Installation Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/lapack/CMakeLists.txt Creates static and shared library targets, links dependencies, and sets up installation rules. ```cmake add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS}) add_library(eigen_lapack SHARED ${EigenLapack_SRCS}) target_link_libraries(eigen_lapack eigen_blas) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(eigen_lapack_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) target_link_libraries(eigen_lapack ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() add_dependencies(lapack eigen_lapack eigen_lapack_static) install(TARGETS eigen_lapack eigen_lapack_static RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ``` -------------------------------- ### Build and Run Fortran Example with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/example/fortran_api/README.md Build the Fortran example using CMake. This involves configuring the build environment and then compiling the project. ```console cmake -B ./build cmake --build ./build ./build/example_f ``` -------------------------------- ### Matrix Type Examples Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Examples of various matrix configurations using compile-time and dynamic dimensions. ```cpp Matrix // Dynamic number of columns (heap allocation) Matrix // Dynamic number of rows (heap allocation) Matrix // Fully dynamic, row major (heap allocation) Matrix // Fully fixed (usually allocated on stack) ``` -------------------------------- ### Install spglib with testing extras Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/python/README.rst Install the spglib Python package from source, including the necessary extras for testing. ```console pip install .[test] ``` -------------------------------- ### Build and Install spglib on Unix-like Systems Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/install.md Steps to build and install spglib in a '_build' directory. Ensure you are in the extracted source code directory. ```bash % tar xvfz spglib-2.0.0.tar.gz % cd spglib-2.0.0 % mkdir _build % cd _build % cmake .. % cmake --build . % cmake --install . ``` -------------------------------- ### Configure and Install Spglib Build Files Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/CMakeLists.txt Handles the copying of helper files, generation of pkg-config files, and installation of CMake export configuration files. ```cmake configure_file(cmake/PackageCompsHelper.cmake PackageCompsHelper.cmake COPYONLY) if (SPGLIB_INSTALL) # pkg-config files configure_file(cmake/spglib.pc.in spglib.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/spglib.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ) # cmake export files write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/SpglibConfigVersion.cmake VERSION ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion) configure_package_config_file( cmake/SpglibConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/SpglibConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Spglib) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/SpglibConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/SpglibConfig.cmake cmake/PackageCompsHelper.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Spglib ) export_components(LIB_TYPE ${Spglib_LIB_TYPE}) endif () ``` -------------------------------- ### Install Spglib from source using pip Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/python-interface.md Install Spglib from the source code using pip. This is the primary method for production. ```console $ pip install . ``` -------------------------------- ### Install Signature File Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/CMakeLists.txt Installs the signature file for the Eigen3 matrix library to the include directory. ```cmake install( FILES signature_of_eigen3_matrix_library DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel ) ``` -------------------------------- ### VSCode C/C++ Include Path Configuration Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/README.md Example `c_cpp_properties.json` configuration for VSCode to correctly highlight Spglib and Googletest symbols. Ensure the paths to Googletest include directories are accurate for your build setup. ```json { "configurations": [ { "includePath": [ "${workspaceFolder}/**", "${workspaceFolder}/cmake-build-release-gcc/_deps/googletest-src/googletest/include", "${workspaceFolder}/cmake-build-release-llvm/_deps/googletest-src/googletest/include" ], "name": "Linux" } ], "version": "5" } ``` -------------------------------- ### Install spglib under Parent Directory (Unix-like) Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/install.md Alternative installation method to install spglib under the parent directory. This requires specifying CMAKE_INSTALL_PREFIX. ```bash % mkdir _build % cd _build % cmake -DCMAKE_INSTALL_PREFIX=.. .. % cmake --build . % cmake --install . --prefix .. ``` -------------------------------- ### Initialize Fixed Size Matrices Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/PreprocessorDirectives.dox Example of fixed-size matrix initialization behavior. ```cpp Vector2d v(2,1); ``` -------------------------------- ### Build Spglib C Example with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/example/c_api/README.md Commands to build a Spglib C example project using CMake. This involves configuring the build environment and then building the project. ```console cmake -B ./build cmake --build ./build ./build/example_c ``` -------------------------------- ### Install Eigen Configuration Files (CMake) Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/CMakeLists.txt This snippet installs the necessary CMake configuration files for Eigen, including UseEigen3.cmake, Eigen3Config.cmake, and Eigen3ConfigVersion.cmake, to the specified installation directory. ```cmake install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake ${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} ) ``` -------------------------------- ### Install Spglib Target Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/src/CMakeLists.txt Configures the installation of the Spglib target, including headers. This is part of the build process to make the library available for use. ```cmake if (SPGLIB_INSTALL) # Normal installation target to system. When using scikit-build this is installed again in python path install(TARGETS Spglib_symspg EXPORT SpglibTargets FILE_SET HEADERS ) endif () ``` -------------------------------- ### Build and Install spglib on Windows/Cygwin Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/install.md Recommended CMake commands for building and installing spglib on Windows or Cygwin. This method uses specific flags for Windows compatibility. ```bash % cmake -DCMAKE_INSTALL_PREFIX="$(shell cygpath -w "${BUILD_DIR}")" .. % cmake --build . --config Release % cmake --install . --config Release ``` -------------------------------- ### Compile Spglib C Example Manually Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/example/c_api/README.md Command to manually compile a C example file using Spglib. Ensure to replace '[include directory]' and '[library directory]' with the correct paths, which can be obtained using pkg-config. ```console gcc example.c -I[include directory] -L[library directory] -lsymspg -lm ``` -------------------------------- ### Install BoltzTraP2 using pip Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/README.md The recommended way to install BoltzTraP2 and its dependencies is by using pip. ```bash pip install BoltzTraP2 ``` -------------------------------- ### Configure Qt4 for Sparse Examples Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/special_examples/CMakeLists.txt Conditionally includes Qt4 dependencies and defines build commands for the Tutorial_sparse_example executable. ```cmake if(NOT EIGEN_TEST_NOQT) find_package(Qt4) if(QT4_FOUND) include(${QT_USE_FILE}) endif() endif(NOT EIGEN_TEST_NOQT) if(QT4_FOUND) add_executable(Tutorial_sparse_example Tutorial_sparse_example.cpp Tutorial_sparse_example_details.cpp) target_link_libraries(Tutorial_sparse_example ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) add_custom_command( TARGET Tutorial_sparse_example POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/../html/ COMMAND Tutorial_sparse_example ARGS ${CMAKE_CURRENT_BINARY_DIR}/../html/Tutorial_sparse_example.jpeg ) add_dependencies(all_examples Tutorial_sparse_example) endif(QT4_FOUND) ``` -------------------------------- ### Install Spglib using pip Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/python-interface.md Use this command to install the Spglib package via pip. ```console $ pip install spglib ``` -------------------------------- ### Initialize a Direct Solver Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/SparseLinearSystems.dox Example of declaring a direct solver instance with specific matrix and ordering types. ```cpp DirectSolverClassName, OrderingMethod > solver; ``` -------------------------------- ### Install BoltzTraP2 in development mode Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/README.md Installs BoltzTraP2 using symbolic links to the source directory, enabling immediate testing of code changes. ```bash python setup.py develop ``` -------------------------------- ### Run Spglib Python example Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/example/python_api/README.md Execute the Python script using the console command. ```console $ python example.py ``` -------------------------------- ### Construct Map variables Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialMapClass.dox Examples of initializing Map objects with pointers and dimensions. ```cpp Map mf(pf,rows,columns); ``` ```cpp Map mi(pi); ``` -------------------------------- ### Compile Fortran Example Manually Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/example/fortran_api/README.md Manually compile a Fortran example using gfortran. Ensure you replace `[include directory]` and `[library directory]` with the correct paths obtained from `pkg-config --cflags --libs spglib_f08`. ```console gfortran example.F90 -I[include directory] -L[library directory] -lsymspg ``` -------------------------------- ### Matrix-free Conjugate Gradient Example Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/MatrixfreeSolverExample.dox This example demonstrates how to wrap an Eigen::SparseMatrix for use with matrix-free iterative solvers. Ensure your wrapper class implements rows(), cols(), and operator*. ```cpp #include #include #include #include // A simple matrix-free wrapper for Eigen::SparseMatrix // In a real-world scenario, this would wrap a custom matrix-free operator. template class MatrixFreeWrapper { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; public: MatrixFreeWrapper(const MatrixType& matrix) : m_matrix(matrix) {} Index rows() const { return m_matrix.rows(); } Index cols() const { return m_matrix.cols(); } // The actual matrix-vector product is implemented in a specialization // of Eigen::internal::generic_product_impl. // This method is just a placeholder to satisfy the interface. template EIGEN_STRONG_INLINE Eigen::Product, Rhs, Eigen::AliasFreeProduct> operator*(const Eigen::MatrixBase& x) const { return Eigen::Product, Rhs, Eigen::AliasFreeProduct>(*this, x); } private: const MatrixType& m_matrix; }; // Specialization of Eigen::internal::traits for MatrixFreeWrapper namespace Eigen { namespace internal { template struct traits> : traits { typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Index Index; typedef void StorageKind; typedef void CoeffBasedStorageKind; // This is crucial for matrix-free operations static const bool IsRowMajor = false; }; // Specialization of Eigen::internal::generic_product_impl for MatrixFreeWrapper // This is where the actual matrix-vector product is defined. template struct generic_product_impl, Eigen::AliasFreeProduct> { typedef typename traits::Scalar Scalar; typedef typename MatrixFree::Index Index; typedef Eigen::Matrix Result; static EIGEN_INLINE void leftExpr(const MatrixFree& xpr, const Eigen::MatrixBase& rhs, Result& res) { // In a real matrix-free scenario, this would perform the operator* operation // without explicitly forming the matrix. Here, we use the underlying sparse matrix. res = xpr.m_matrix * rhs; } }; } } int main() { // Create a sparse matrix int n = 5; Eigen::SparseMatrix mat(n, n); mat.reserve(Eigen::VectorXi::Constant(n, 3)); for (int i = 0; i < n; ++i) { mat.insert(i, i) = 2.0; if (i > 0) { mat.insert(i, i - 1) = -1.0; mat.insert(i - 1, i) = -1.0; } } mat.makeCompressed(); // Create a matrix-free wrapper MatrixFreeWrapper> matrix_free_mat(mat); // Create a vector Eigen::VectorXd vec(n); vec << 1.0, 2.0, 3.0, 4.0, 5.0; // Use the matrix-free wrapper with an iterative solver Eigen::ConjugateGradient cg; // Note: The solver needs to be configured to work with matrix-free types. // This typically involves setting the matrix-free object directly or via a specific method. // For demonstration, we'll just compute the product. Eigen::VectorXd result = matrix_free_mat * vec; std::cout << "Matrix-free product result:\n" << result << std::endl; // Example of using it with CG (requires solver setup for matrix-free) // cg.compute(matrix_free_mat); // This would typically be how you'd set it up // Eigen::VectorXd solution = cg.solve(vec); // std::cout << "Solution (if solver was fully configured):\n" << solution << std::endl; return 0; } ``` -------------------------------- ### Initialize Covariance Matrices Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/FunctionsTakingEigenTypes.dox Example usage of a covariance function with concrete MatrixXf types. ```cpp MatrixXf x = MatrixXf::Random(100,3); MatrixXf y = MatrixXf::Random(100,3); MatrixXf C; cov(x, y, C); ``` -------------------------------- ### Install Spglib from source with OpenMP support Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/python-interface.md Install Spglib from source using pip, enabling OpenMP support via cmake configuration settings. ```console $ pip install . --config-settings=cmake.define.SPGLIB_USE_OMP=ON ``` -------------------------------- ### MatLab-style indexing output Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/CustomizingEigen_NullaryExpr.dox Example output showing matrix indexing results. ```text 1 2 4 5 ``` -------------------------------- ### Example Usage of Error Handling Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/api.md Demonstrates how to retrieve and print the current error message. ```c SpglibError error; error = spg_get_error_code(); printf("%s\n", spg_get_error_message(error)); ``` -------------------------------- ### Configure PkgConfig File Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/CMakeLists.txt Configures the eigen3.pc file for pkg-config if EIGEN_BUILD_PKGCONFIG is enabled. Installs the generated file. ```cmake if(EIGEN_BUILD_PKGCONFIG) configure_file(eigen3.pc.in eigen3.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} ) endif() ``` -------------------------------- ### Naive Library Implementation Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/InsideEigenExample.dox An example of inefficient code generation that introduces unnecessary temporaries. ```cpp VectorXf tmp = v + w; VectorXf u = tmp; ``` ```cpp for(int i = 0; i < size; i++) tmp[i] = v[i] + w[i]; for(int i = 0; i < size; i++) u[i] = tmp[i]; ``` -------------------------------- ### Defining a MatrixBase extension file Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/CustomizingEigen_Plugins.dox Example of a custom header file containing method declarations to be injected into MatrixBase. ```cpp inline Scalar at(uint i, uint j) const { return this->operator()(i,j); } inline Scalar& at(uint i, uint j) { return this->operator()(i,j); } inline Scalar at(uint i) const { return this->operator[](i); } inline Scalar& at(uint i) { return this->operator[](i); } inline RealScalar squaredLength() const { return squaredNorm(); } inline RealScalar length() const { return norm(); } inline RealScalar invLength(void) const { return fast_inv_sqrt(squaredNorm()); } template inline Scalar squaredDistanceTo(const MatrixBase& other) const { return (derived() - other.derived()).squaredNorm(); } template inline RealScalar distanceTo(const MatrixBase& other) const { return internal::sqrt(derived().squaredDistanceTo(other)); } inline void scaleTo(RealScalar l) { RealScalar vl = norm(); if (vl>1e-9) derived() *= (l/vl); } inline Transpose transposed() {return this->transpose();} inline const Transpose transposed() const {return this->transpose();} inline uint minComponentId(void) const { int i; this->minCoeff(&i); return i; } inline uint maxComponentId(void) const { int i; this->maxCoeff(&i); return i; } template void makeFloor(const MatrixBase& other) { derived() = derived().cwiseMin(other.derived()); } template void makeCeil(const MatrixBase& other) { derived() = derived().cwiseMax(other.derived()); } const CwiseBinaryOp, const Derived, const ConstantReturnType> operator+(const Scalar& scalar) const { return CwiseBinaryOp, const Derived, const ConstantReturnType>(derived(), Constant(rows(),cols(),scalar)); } friend const CwiseBinaryOp, const ConstantReturnType, Derived> operator+(const Scalar& scalar, const MatrixBase& mat) { return CwiseBinaryOp, const ConstantReturnType, Derived>(Constant(rows(),cols(),scalar), mat.derived()); } ``` -------------------------------- ### Dynamic Matrix Initialization Example Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialAdvancedInitialization.dox Demonstrates using expression templates to perform matrix addition with a constant-filled temporary matrix. ```cpp MatrixXf m(3,3); m << 1, 2, 3, 4, 5, 6, 7, 8, 9; std::cout << m + MatrixXf::Constant(3,3,1.2) << std::endl; ``` -------------------------------- ### Install spglib using Conda Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/python/README.rst Install the spglib Python package from the conda-forge channel. This is an alternative installation method. ```console conda install -c conda-forge spglib ``` -------------------------------- ### Compare initialization methods Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialAdvancedInitialization.dox Contrast static methods, comma-initializers, and setXxx utility functions for constructing complex matrices. ```cpp \include Tutorial_AdvancedInitialization_ThreeWays.cpp ``` -------------------------------- ### Install spglib using pip Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/python/README.rst Use this command to install the spglib Python package via pip. Ensure numpy is installed beforehand. ```console pip install spglib ``` -------------------------------- ### Download and Setup LAPACK Reference Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/lapack/CMakeLists.txt Downloads the LAPACK reference implementation if unit tests are enabled and the reference directory is missing. ```cmake option(EIGEN_ENABLE_LAPACK_TESTS OFF "Enable the Lapack unit tests") if(EIGEN_ENABLE_LAPACK_TESTS) get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) if(NOT EXISTS ${eigen_full_path_to_reference_lapack}) # Download lapack and install sources and testing at the right place message(STATUS "Download lapack_addons_3.4.1.tgz...") file(DOWNLOAD "http://downloads.tuxfamily.org/eigen/lapack_addons_3.4.1.tgz" "${CMAKE_CURRENT_SOURCE_DIR}/lapack_addons_3.4.1.tgz" INACTIVITY_TIMEOUT 15 TIMEOUT 240 STATUS download_status EXPECTED_MD5 5758ce55afcf79da98de8b9de1615ad5 SHOW_PROGRESS) message(STATUS ${download_status}) list(GET download_status 0 download_status_num) set(download_status_num 0) if(download_status_num EQUAL 0) message(STATUS "Setup lapack reference and lapack unit tests") execute_process(COMMAND tar xzf "lapack_addons_3.4.1.tgz" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) else() message(STATUS "Download of lapack_addons_3.4.1.tgz failed, LAPACK unit tests won't be enabled") set(EIGEN_ENABLE_LAPACK_TESTS false) endif() endif() get_filename_component(eigen_full_path_to_reference_lapack "./reference/" ABSOLUTE) if(EXISTS ${eigen_full_path_to_reference_lapack}) set(EigenLapack_funcfilenames ssyev.f dsyev.f csyev.f zsyev.f spotrf.f dpotrf.f cpotrf.f zpotrf.f spotrs.f dpotrs.f cpotrs.f zpotrs.f sgetrf.f dgetrf.f cgetrf.f zgetrf.f sgetrs.f dgetrs.f cgetrs.f zgetrs.f) FILE(GLOB ReferenceLapack_SRCS0 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "reference/*.f") foreach(filename1 IN LISTS ReferenceLapack_SRCS0) string(REPLACE "reference/" "" filename ${filename1}) list(FIND EigenLapack_SRCS ${filename} id1) list(FIND EigenLapack_funcfilenames ${filename} id2) if((id1 EQUAL -1) AND (id2 EQUAL -1)) set(ReferenceLapack_SRCS ${ReferenceLapack_SRCS} reference/${filename}) endif() endforeach() endif() endif(EIGEN_ENABLE_LAPACK_TESTS) ``` -------------------------------- ### Install Lapack on MacPorts Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/UsingBlasLapackBackends.dox On macOS, to use the Accelerate framework's LAPACK, you need to install the lapacke library via MacPorts. This command installs the necessary library. ```bash sudo port install lapack ``` -------------------------------- ### Makefile Build Instructions Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/CMakeLists.txt Prints helpful commands for users building with a Makefile generator, including installation, documentation, testing, and uninstallation. ```cmake string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) if(cmake_generator_tolower MATCHES "makefile") message(STATUS "Some things you can do now:") message(STATUS "--------------+--------------------------------------------------------------") message(STATUS "Command | Description") message(STATUS "--------------+--------------------------------------------------------------") message(STATUS "make install | Install Eigen. Headers will be installed to:") message(STATUS " | /") message(STATUS " | Using the following values:") message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") message(STATUS " | Change the install location of Eigen headers using:") message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") message(STATUS " | Or:") message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX") message(STATUS "make check | Build and run the unit-tests. Read this page:") message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)") message(STATUS "make uninstall| Removes files installed by make install") message(STATUS "--------------+--------------------------------------------------------------") else() message(STATUS "To build/run the unit tests, read this page:") message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests") endif() ``` -------------------------------- ### Install Eigen Header Directory Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/unsupported/Eigen/CMakeLists.txt Installs all header files (`*.h`) from the `src` directory to a specified destination. This command is used to install a directory of headers, matching files based on a pattern. ```cmake install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") ``` -------------------------------- ### Build and Execute Unsupported Examples with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/unsupported/doc/examples/CMakeLists.txt Iterates over all .cpp files in the directory to create, link, and execute test binaries. ```cmake FILE(GLOB examples_SRCS "*.cpp") ADD_CUSTOM_TARGET(unsupported_examples) INCLUDE_DIRECTORIES(../../../unsupported ../../../unsupported/test) FOREACH(example_src ${examples_SRCS}) GET_FILENAME_COMPONENT(example ${example_src} NAME_WE) ADD_EXECUTABLE(example_${example} ${example_src}) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(example_${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() ADD_CUSTOM_COMMAND( TARGET example_${example} POST_BUILD COMMAND example_${example} ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out ) ADD_DEPENDENCIES(unsupported_examples example_${example}) ENDFOREACH(example_src) ``` -------------------------------- ### Predefined Dynamic-Size Matrices Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Demonstrates the creation and initialization of dynamic-size matrices with specified dimensions. Includes methods for setting zero, ones, constant, and random values. ```cpp typedef {MatrixXf|ArrayXXf} Dynamic2D; Dynamic2D x; x = Dynamic2D::Zero(rows, cols); x = Dynamic2D::Ones(rows, cols); x = Dynamic2D::Constant(rows, cols, value); x = Dynamic2D::Random(rows, cols); N/A x.setZero(rows, cols); x.setOnes(rows, cols); x.setConstant(rows, cols, value); x.setRandom(rows, cols); N/A ``` -------------------------------- ### Install Spglib Python Library Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/README.md Commands to install the Spglib Python package via pip or conda. ```console $ pip install spglib ``` ```console $ conda install -c conda-forge spglib ``` -------------------------------- ### Full K-point Mesh Example Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/python-interface.md Comprehensive example demonstrating how to calculate irreducible k-points for both Gamma-centered and shifted meshes. ```python import numpy as np import spglib lattice = np.array([[0.0, 0.5, 0.5], [0.5, 0.0, 0.5], [0.5, 0.5, 0.0]]) * 5.4 positions = [[0.875, 0.875, 0.875], [0.125, 0.125, 0.125]] numbers= [1,] * 2 cell = (lattice, positions, numbers) print(spglib.get_spacegroup(cell, symprec=1e-5)) mesh = [8, 8, 8] # # Gamma centre mesh # mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=[0, 0, 0]) # All k-points and mapping to ir-grid points for i, (ir_gp_id, gp) in enumerate(zip(mapping, grid)): print("%3d ->%3d %s" % (i, ir_gp_id, gp.astype(float) / mesh)) # Irreducible k-points print("Number of ir-kpoints: %d" % len(np.unique(mapping))) print(grid[np.unique(mapping)] / np.array(mesh, dtype=float)) # # With shift # mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=[1, 1, 1]) # All k-points and mapping to ir-grid points for i, (ir_gp_id, gp) in enumerate(zip(mapping, grid)): print("%3d ->%3d %s" % (i, ir_gp_id, (gp + [0.5, 0.5, 0.5]) / mesh)) # Irreducible k-points print("Number of ir-kpoints: %d" % len(np.unique(mapping))) print((grid[np.unique(mapping)] + [0.5, 0.5, 0.5]) / mesh) ``` -------------------------------- ### Vector and Matrix Initialization Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Demonstrates various methods for initializing vectors and matrices, including identity matrices and unit vectors. ```APIDOC ## Vector and Matrix Initialization ### Description Provides examples for creating identity matrices and unit vectors. ### Method Static methods and member functions are used for initialization. ### Endpoints N/A (Code examples) ### Parameters N/A ### Request Body N/A ### Request Example ```cpp // Unit vectors Vector3f::UnitX() // Returns a unit vector along the X-axis (1, 0, 0) Vector3f::UnitY() // Returns a unit vector along the Y-axis (0, 1, 0) Vector3f::UnitZ() // Returns a unit vector along the Z-axis (0, 0, 1) Vector4f::Unit(i) // Returns a unit vector for a specified dimension i // Setting unit vectors x.setUnit(i); // Sets a vector to a unit vector along dimension i // Identity matrices x = Dynamic2D::Identity(rows, cols); // Creates an identity matrix of specified dimensions x.setIdentity(rows, cols); // Sets a matrix to an identity matrix // Unit vectors for VectorXf VectorXf::Unit(size, i) // Creates a unit vector of specified size and dimension i // Example: VectorXf::Unit(4, 1) == Vector4f(0, 1, 0, 0) == Vector4f::UnitY() // Setting unit vectors for VectorXf x.setUnit(size, i); // Sets a vector to a unit vector // Note: It is allowed to call any of the set* functions to a dynamic-sized vector or matrix without passing new sizes. // Example: MatrixXi M(3,3); M.setIdentity(); // Sets M to a 3x3 identity matrix ``` ### Response N/A (Code examples) ``` -------------------------------- ### Sync Documentation Build Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/README.md Command to copy compiled HTML files from the build directory to the repository root. ```shell rsync -avh _build/html/ / ``` -------------------------------- ### Set Eigen Installation Paths Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/CMakeLists.txt Defines CMake variables for Eigen's include directory and root installation directory. ```cmake set ( EIGEN_DEFINITIONS "") set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) ``` -------------------------------- ### Configure Build Options Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/test/CMakeLists.txt Sets up build options for coverage, sanitizers, and language-specific interfaces. ```cmake include(CMakeDependentOption) include(FeatureSummary) option(SPGLIB_TEST_COVERAGE "Spglib: Test with coverage" OFF) set(SPGLIB_USE_SANITIZER "" CACHE STRING "Spglib: Sanitizer used in compilation") option(SPGLIB_WITH_Fortran "Spglib: Build Fortran interface" OFF) option(SPGLIB_WITH_Python "Spglib: Build Python interface" OFF) add_feature_info(Coverage SPGLIB_TEST_COVERAGE "Compile with test coverage") mark_as_advanced( SPGLIB_TEST_COVERAGE SPGLIB_USE_SANITIZER ) ``` -------------------------------- ### Filter and Install Eigen Directory Files Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/Eigen/CMakeLists.txt Uses regex to exclude specific directories and file types before installing the remaining files to the destination. ```cmake include(RegexUtils) test_escape_string_as_regex() file(GLOB Eigen_directory_files "*") escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") foreach(f ${Eigen_directory_files}) if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") list(APPEND Eigen_directory_files_to_install ${f}) endif() endforeach(f ${Eigen_directory_files}) install(FILES ${Eigen_directory_files_to_install} DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel ) install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") ``` -------------------------------- ### Compile and execute C++ examples with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/examples/CMakeLists.txt Iterates over .cpp files to build executables and generate output files via post-build commands. ```cmake file(GLOB examples_SRCS "*.cpp") foreach(example_src ${examples_SRCS}) get_filename_component(example ${example_src} NAME_WE) add_executable(${example} ${example_src}) if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) target_link_libraries(${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) endif() add_custom_command( TARGET ${example} POST_BUILD COMMAND ${example} ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out ) add_dependencies(all_examples ${example}) endforeach(example_src) ``` -------------------------------- ### Install Eigen Headers Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/unsupported/Eigen/CMakeLists.txt Installs the files listed in the `Eigen_HEADERS` variable to a specific destination directory. This ensures that the Eigen headers are available for use by other projects. ```cmake install(FILES ${Eigen_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel ) ``` -------------------------------- ### Predefined Fixed-Size Matrices and Vectors Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Shows how to create and initialize fixed-size matrices and vectors with common values like zero, ones, constants, random numbers, or linearly spaced values. ```cpp typedef {Matrix3f|Array33f} FixedXD; FixedXD x; x = FixedXD::Zero(); x = FixedXD::Ones(); x = FixedXD::Constant(value); x = FixedXD::Random(); x = FixedXD::LinSpaced(size, low, high); x.setZero(); x.setOnes(); x.setConstant(value); x.setRandom(); x.setLinSpaced(size, low, high); ``` -------------------------------- ### Initialize Sparse Matrices Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/SparseQuickReference.dox Construct sparse matrices with specified dimensions and storage order. ```cpp SparseMatrix sm1(1000,1000); SparseMatrix,RowMajor> sm2; ``` -------------------------------- ### Specify Eigen Installation Path with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TopicCMakeGuide.dox When Eigen is not in a default location, set CMAKE_PREFIX_PATH to point to your custom installation directory. This command is passed during the CMake configuration step. ```sh cmake path-to-example-directory -DCMAKE_PREFIX_PATH=$HOME/mypackages ``` -------------------------------- ### Initialize Matrices with Constructors Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialMatrixClass.dox Various ways to construct matrices, including default, size-based, and coefficient-initialized constructors. ```cpp Matrix3f a; MatrixXf b; ``` ```cpp MatrixXf a(10,15); VectorXf b(30); ``` ```cpp Matrix3f a(3,3); ``` ```cpp Vector2d a(5.0, 6.0); Vector3d b(5.0, 6.0, 7.0); Vector4d c(5.0, 6.0, 7.0, 8.0); ``` -------------------------------- ### Identity and Basis Vectors Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Shows how to create identity matrices and set basis vectors for both fixed-size and dynamic-size objects. ```cpp x = FixedXD::Identity(); x.setIdentity(); ``` -------------------------------- ### Basic Matrix and Array Constructors Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Demonstrates the creation of 1D and 2D matrix and array objects with and without initial values. ```APIDOC ## Basic Matrix and Array Constructors ### Description Constructors for 1D and 2D objects, including fixed-size and dynamic-size options. Coefficients are uninitialized by default. ### 1D Objects (Vectors and Arrays) ```cpp Vector4d v4; // Default constructor Vector2f v1(x, y); // Constructor with initial values Array3i v2(x, y, z); // Constructor with initial values Vector4d v3(x, y, z, w); // Constructor with initial values VectorXf v5; // Empty dynamic-size vector ArrayXf v6(size); // Dynamic-size vector with specified size ``` ### 2D Objects (Matrices) ```cpp Matrix4f m1; // Default constructor for fixed-size matrix MatrixXf m5; // Empty dynamic-size matrix MatrixXf m6(nb_rows, nb_columns); // Dynamic-size matrix with specified dimensions ``` ``` -------------------------------- ### Rotated lattice output Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/definition.md Example output for a rotated lattice. ```text [[3.95200346 1.12397269 0. ] [1.12397269 3.95200346 0. ] [0. 0. 8.57154746]] ``` -------------------------------- ### Advanced indexing output Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/CustomizingEigen_NullaryExpr.dox Output from the advanced indexing example. ```text 2 5 8 ``` -------------------------------- ### Register Custom DFT Loaders Source: https://context7.com/sousaw/boltztrap2/llms.txt Demonstrates how to import necessary libraries for custom DFT loaders. The actual registration logic would follow. ```python import os import numpy as np import BoltzTraP2.dft as BTP ``` -------------------------------- ### Converting between transformation types Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialGeometry.dox Examples of assigning different transformation representations to each other. ```cpp Rotation2Df r; r = Matrix2f(..); // assumes a pure rotation matrix AngleAxisf aa; aa = Quaternionf(..); AngleAxisf aa; aa = Matrix3f(..); // assumes a pure rotation matrix Matrix2f m; m = Rotation2Df(..); Matrix3f m; m = Quaternionf(..); Matrix3f m; m = Scaling(..); Affine3f m; m = AngleAxis3f(..); Affine3f m; m = Scaling(..); Affine3f m; m = Translation3f(..); Affine3f m; m = Matrix3f(..); ``` -------------------------------- ### Configure and Add Dependencies Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/src/CMakeLists.txt Configures a header file and sets up dependencies for the build. Used for managing generated files and build order. ```cmake configure_file(version.h.in version.h) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_BINARY_DIR}/.git_commit ) add_dependencies(Spglib_symspg Spglib_GitHash) ``` -------------------------------- ### Compute Solve Error Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialLinearAlgebra.dox Example demonstrating the computation of solve errors. ```cpp \include TutorialLinAlgExComputeSolveError.cpp ``` ```text \verbinclude TutorialLinAlgExComputeSolveError.out ``` -------------------------------- ### Configure Spglib with CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/cmake/README.md Use this command at the configuration stage to initialize the build directory with specific options. ```console $ cmake . -B build ${CMAKE_OPTIONS} ``` -------------------------------- ### Basic Lazy Evaluation Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TopicLazyEvaluation.dox Example of default lazy evaluation in Eigen. ```cpp matrix1 = matrix2 + matrix3; ``` -------------------------------- ### Example usage of makeCirculant Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/CustomizingEigen_NullaryExpr.dox Demonstrates the usage of the makeCirculant function with a vector. ```cpp int main() { VectorXd vec(4); vec << 1, 2, 4, 8; cout << makeCirculant(vec) << endl; return 0; } ``` -------------------------------- ### Comma Initializer for Vectors and Matrices Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Shows how to initialize vectors and matrices using the comma initializer syntax. This is a convenient way to set elements directly. ```cpp Vector3f v1; v1 << x, y, z; ArrayXf v2(4); v2 << 1, 2, 3, 4; ``` ```cpp Matrix3f m1; m1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; ``` -------------------------------- ### Define lattice basis vectors Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/docs/definition.md Example of defining a non-primitive lattice structure. ```python lattice = [[7.17851431, 0, 0], # a [0, 3.99943947, 0], # b [0, 0, 8.57154746]] # c ``` ```python lattice = [[5.0759761474456697, 5.0759761474456697, 0], [-2.8280307701821314, 2.8280307701821314, 0], [0, 0, 8.57154746]] ``` -------------------------------- ### Sparse Matrix Initialization Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/SparseQuickReference.dox Methods for constructing, resizing, and populating sparse matrices. ```APIDOC ## SparseMatrix Initialization ### Description Methods to initialize, resize, and insert data into a SparseMatrix. ### Methods - **Constructor**: `SparseMatrix(rows, cols)` or `SparseMatrix()` - **Resize/Reserve**: `resize(m, n)` and `reserve(nnz)` - **Insertion**: `insert(i, j) = v` (new elements) or `coeffRef(i, j)` (update existing) - **Batch Insertion**: `setFromTriplets(begin, end)` - **Clear**: `setZero()` ### Request Example ```cpp SparseMatrix sm1(1000, 1000); sm1.insert(i, j) = v_ij; ``` ``` -------------------------------- ### Link Spglib via Native CMake Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/cmake/README.md Example CMakeLists.txt demonstrating how to find and link the Spglib C library to a project target. ```cmake project(foo) find_package(Spglib REQUIRED) add_library(foo_library) target_link_libraries(foo_library PRIVATE Spglib::symspg) ``` -------------------------------- ### Reduction Operations Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Examples of reduction operations like minCoeff, colwise, and rowwise. ```cpp 5 3 1 mat = 2 7 8 9 4 6 ``` ```cpp mat.minCoeff(); ``` ```cpp 1 ``` ```cpp mat.colwise().minCoeff(); ``` ```cpp 2 3 1 ``` ```cpp mat.rowwise().minCoeff(); ``` ```cpp 1 2 4 ``` -------------------------------- ### Matrix and Array Variable Declaration Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/QuickReference.dox Example of declaring matrix and array variables. ```cpp Array44f a1, a2; Matrix4f m1, m2; ``` -------------------------------- ### Define Convenience Typedefs Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialMatrixClass.dox Examples of common convenience typedefs for matrices and vectors. ```cpp typedef Matrix Matrix4f; ``` ```cpp typedef Matrix Vector3f; ``` ```cpp typedef Matrix RowVector2i; ``` -------------------------------- ### Row and column operations example Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialBlockOperations.dox Demonstrates accessing individual rows and columns using .row() and .col(), and shows that these expressions can be used in arithmetic operations. ```cpp #include #include int main() { Eigen::MatrixXf m(4, 4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; std::cout << "Whole matrix:\n" << m << std::endl; std::cout << "First row: " << m.row(0) << std::endl; std::cout << "Third column: " << m.col(2) << std::endl; std::cout << "First row + Third column: " << m.row(0) + m.col(2).transpose() << std::endl; return 0; } ``` -------------------------------- ### Build and Run Ruby Wrapper Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/spglib-2.6.0/ruby/README.md Commands to compile the extension and execute the symmetry analysis script with appropriate library paths. ```bash % ruby extconf.rb --with-getspg-include=../build/include --with-getspg-lib=../build/lib % make % export LD_LIBRARY_PATH=../build/lib % export RUBYLIB=. % ruby symPoscar.rb ../python/test/data/hexagonal/POSCAR-168 ``` -------------------------------- ### Print matrix blocks using .block() Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialBlockOperations.dox This example demonstrates using both dynamic-size and fixed-size .block() methods to access and print sub-sections of a matrix. ```cpp #include #include int main() { Eigen::MatrixXf m(4, 4); m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16; std::cout << "Block in the middle:\n" << m.block(1, 1, 2, 2) << std::endl; std::cout << "Block in the middle (fixed size):\n" << m.block<2, 2>(1, 1) << std::endl; return 0; } ``` -------------------------------- ### Extract vector segment Source: https://gitlab.com/sousaw/boltztrap2/-/blob/public/external/eigen-eigen-3215c06819b9/doc/TutorialBlockOperations.dox Extracts n elements starting at position i in a vector. ```cpp vector.segment(i,n); ``` ```cpp vector.segment(i); ```