RealSchurDecomposition#
-
class numpy::RealSchurDecomposition#
numpy C++ class.
Example#
#include <numpy/np_ndarray.h>
using namespace numpy;
// Use RealSchurDecomposition
RealSchurDecomposition obj;
// ... operations ...
Constructors#
Signature |
Location |
Example |
|---|---|---|
|
NP_LINALG.H:3425 |
Indexing / Selection#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
NP_LINALG.H:3476 |
|
|
Block2x2<T> |
NP_LINALG.H:3510 |
|
|
std::vector<std::complex<T>> |
NP_LINALG.H:3518 |
Linear Algebra#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
void |
NP_LINALG.H:3444 |
I/O#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
SchurDecomposition<std::complex<T>> |
NP_LINALG.H:3538 |
Type Checking#
Signature |
Return Type |
Location |
Example |
|---|---|---|---|
|
bool |
NP_LINALG.H:3503 |
Other Methods#
Code Examples#
The following examples are extracted from the test suite.
validate_decomposition (np_test_1_all.cpp:20183)
20173 class SchurValidator {
20174 public:
20175 struct ValidationResult {
20176 bool passed;
20177 double max_error;
20178 double avg_error;
20179 std::string error_message;
20180 };
20181
20182 // Validate A = Q * T * Q^H
20183 static ValidationResult validate_decomposition(const NDArray<T>& A,
20184 const SchurDecomposition<T>& schur) {
20185 ValidationResult result;
20186 result.passed = false;
20187 result.max_error = 0.0;
20188 result.avg_error = 0.0;
20189
20190 try {
20191 // Compute Q * T
20192 auto QT = matmul(schur.Q, schur.T_matrix);
validate_orthogonality (np_test_1_all.cpp:20236)
20226 }
20227 catch (const std::exception& e) {
20228 result.error_message = std::string("Validation failed with exception: ") + e.what();
20229 }
20230
20231 return result;
20232 }
20233
20234 // Validate that Q is orthogonal/unitary
20235 static ValidationResult validate_orthogonality(const NDArray<T>& Q) {
20236 ValidationResult result;
20237 result.passed = false;
20238 result.max_error = 0.0;
20239 result.avg_error = 0.0;
20240
20241 try {
20242 NDArray<T> QH = Q.transposeArray(); // Start with transpose
20243 if constexpr (utils::is_complex_v<T>) {
20244 QH = utils::conjugate_transpose(Q); // Override with conjugate transpose if complex
20245 }