Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/* SPDX-FileCopyrightText: 2015 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#ifndef __EIGEN3_EIGENVALUES_C_API_CC__
|
|
#define __EIGEN3_EIGENVALUES_C_API_CC__
|
|
|
|
/* Eigen gives annoying huge amount of warnings here, silence them! */
|
|
#if defined(__GNUC__) && !defined(__clang__)
|
|
# pragma GCC diagnostic ignored "-Wlogical-op"
|
|
#endif
|
|
|
|
#include <Eigen/Core>
|
|
#include <Eigen/Eigenvalues>
|
|
|
|
#include "eigenvalues.h"
|
|
|
|
using Eigen::SelfAdjointEigenSolver;
|
|
|
|
using Eigen::Map;
|
|
using Eigen::MatrixXf;
|
|
using Eigen::VectorXf;
|
|
|
|
using Eigen::Success;
|
|
|
|
bool EIG_self_adjoint_eigen_solve(const int size,
|
|
const float *matrix,
|
|
float *r_eigen_values,
|
|
float *r_eigen_vectors)
|
|
{
|
|
SelfAdjointEigenSolver<MatrixXf> eigen_solver;
|
|
|
|
/* Blender and Eigen matrices are both column-major. */
|
|
eigen_solver.compute(Map<MatrixXf>((float *)matrix, size, size));
|
|
|
|
if (eigen_solver.info() != Success) {
|
|
return false;
|
|
}
|
|
|
|
if (r_eigen_values) {
|
|
Map<VectorXf>(r_eigen_values, size) = eigen_solver.eigenvalues().transpose();
|
|
}
|
|
|
|
if (r_eigen_vectors) {
|
|
Map<MatrixXf>(r_eigen_vectors, size, size) = eigen_solver.eigenvectors();
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
#endif /* __EIGEN3_EIGENVALUES_C_API_CC__ */
|