Blender  V3.3
svd.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2015 Blender Foundation. All rights reserved. */
3 
8 #ifndef __EIGEN3_SVD_C_API_CC__
9 #define __EIGEN3_SVD_C_API_CC__
10 
11 /* Eigen gives annoying huge amount of warnings here, silence them! */
12 #if defined(__GNUC__) && !defined(__clang__)
13 # pragma GCC diagnostic ignored "-Wlogical-op"
14 #endif
15 
16 #ifdef __EIGEN3_SVD_C_API_CC__ /* quiet warning */
17 #endif
18 
19 #include <Eigen/Core>
20 #include <Eigen/Dense>
21 #include <Eigen/SVD>
22 
23 #include "svd.h"
24 
25 using Eigen::JacobiSVD;
26 
27 using Eigen::NoQRPreconditioner;
28 
29 using Eigen::ComputeThinU;
30 using Eigen::ComputeThinV;
31 
32 using Eigen::Map;
33 using Eigen::MatrixXf;
34 using Eigen::VectorXf;
35 
36 using Eigen::Matrix4f;
37 
38 void EIG_svd_square_matrix(const int size, const float *matrix, float *r_U, float *r_S, float *r_V)
39 {
40  /* Since our matrix is squared, we can use thinU/V. */
41  unsigned int flags = (r_U ? ComputeThinU : 0) | (r_V ? ComputeThinV : 0);
42 
43  /* Blender and Eigen matrices are both column-major. */
44  JacobiSVD<MatrixXf, NoQRPreconditioner> svd(Map<MatrixXf>((float *)matrix, size, size), flags);
45 
46  if (r_U) {
47  Map<MatrixXf>(r_U, size, size) = svd.matrixU();
48  }
49 
50  if (r_S) {
51  Map<VectorXf>(r_S, size) = svd.singularValues();
52  }
53 
54  if (r_V) {
55  Map<MatrixXf>(r_V, size, size) = svd.matrixV();
56  }
57 }
58 
59 #endif /* __EIGEN3_SVD_C_API_CC__ */
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Map
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
void EIG_svd_square_matrix(const int size, const float *matrix, float *r_U, float *r_S, float *r_V)
Definition: svd.cc:38