RealSchurDecomposition ====================== .. cpp:class:: numpy::RealSchurDecomposition numpy C++ class. Example ------- .. code-block:: cpp #include using namespace numpy; // Use RealSchurDecomposition RealSchurDecomposition obj; // ... operations ... Constructors ------------ .. list-table:: :widths: 55 25 20 :header-rows: 1 * - Signature - Location - Example * - ``RealSchurDecomposition(size_tn)`` - NP_LINALG.H:3425 - Indexing / Selection -------------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void extract_eigenvalues()`` - void - NP_LINALG.H:3476 - * - ``Block2x2 get_2x2_block(size_ti)`` - Block2x2 - NP_LINALG.H:3510 - * - ``std::vector> get_block_eigenvalues(size_ti)`` - std::vector> - NP_LINALG.H:3518 - Linear Algebra -------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void detect_2x2_blocks()`` - void - NP_LINALG.H:3444 - I/O --- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``SchurDecomposition> to_complex_schur()`` - SchurDecomposition> - NP_LINALG.H:3538 - Type Checking ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``bool is_2x2_block(size_ti)`` - bool - NP_LINALG.H:3503 - Other Methods ------------- .. list-table:: :widths: 40 20 15 25 :header-rows: 1 * - Signature - Return Type - Location - Example * - ``void standardize_blocks()`` - void - NP_LINALG.H:3530 - * - ``T validate_decomposition(const NDArray&original_matrix)`` - T - NP_LINALG.H:3573 - :ref:`View ` * - ``T validate_orthogonality()`` - T - NP_LINALG.H:3593 - :ref:`View ` Code Examples ------------- The following examples are extracted from the test suite. .. _example-realschurdecomposition-validate_decomposition-0: .. dropdown:: validate_decomposition (np_test_1_all.cpp:20183) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 20173 :emphasize-lines: 11 class SchurValidator { public: struct ValidationResult { bool passed; double max_error; double avg_error; std::string error_message; }; // Validate A = Q * T * Q^H static ValidationResult validate_decomposition(const NDArray& A, const SchurDecomposition& schur) { ValidationResult result; result.passed = false; result.max_error = 0.0; result.avg_error = 0.0; try { // Compute Q * T auto QT = matmul(schur.Q, schur.T_matrix); .. _example-realschurdecomposition-validate_orthogonality-1: .. dropdown:: validate_orthogonality (np_test_1_all.cpp:20236) :class-title: example-dropdown .. code-block:: cpp :linenos: :lineno-start: 20226 :emphasize-lines: 11 } catch (const std::exception& e) { result.error_message = std::string("Validation failed with exception: ") + e.what(); } return result; } // Validate that Q is orthogonal/unitary static ValidationResult validate_orthogonality(const NDArray& Q) { ValidationResult result; result.passed = false; result.max_error = 0.0; result.avg_error = 0.0; try { NDArray QH = Q.transposeArray(); // Start with transpose if constexpr (utils::is_complex_v) { QH = utils::conjugate_transpose(Q); // Override with conjugate transpose if complex }