============================================================================= Back-end Utils ============================================================================= Combine separated Complex Matrix to one Complex Matrix # Examples ```rust use peroxide::fuga::*; use peroxide::complex::matrix::*; use peroxide::traits::fp::FPMatrix; let x1 = cmatrix(vec![C64::new(1f64, 1f64)], 1, 1, Row); let
(
m1: ComplexMatrix,
m2: ComplexMatrix,
m3: ComplexMatrix,
m4: ComplexMatrix,
)
| 2398 | /// assert_eq!(y, y_exp); |
| 2399 | /// ``` |
| 2400 | pub fn complex_combine( |
| 2401 | m1: ComplexMatrix, |
| 2402 | m2: ComplexMatrix, |
| 2403 | m3: ComplexMatrix, |
| 2404 | m4: ComplexMatrix, |
| 2405 | ) -> ComplexMatrix { |
| 2406 | let l_r = m1.row; |
| 2407 | let l_c = m1.col; |
| 2408 | let c_l = m2.col; |
| 2409 | let r_l = m3.row; |
| 2410 | |
| 2411 | let r = l_r + r_l; |
| 2412 | let c = l_c + c_l; |
| 2413 | |
| 2414 | let mut m = cmatrix(vec![Complex::zero(); r * c], r, c, m1.shape); |
| 2415 | |
| 2416 | for idx_row in 0..r { |
| 2417 | for idx_col in 0..c { |
| 2418 | match (idx_row, idx_col) { |
| 2419 | (i, j) if (i < l_r) && (j < l_c) => { |
| 2420 | m[(i, j)] = m1[(i, j)]; |
| 2421 | } |
| 2422 | (i, j) if (i < l_r) && (j >= l_c) => { |
| 2423 | m[(i, j)] = m2[(i, j - l_c)]; |
| 2424 | } |
| 2425 | (i, j) if (i >= l_r) && (j < l_c) => { |
| 2426 | m[(i, j)] = m3[(i - l_r, j)]; |
| 2427 | } |
| 2428 | (i, j) if (i >= l_r) && (j >= l_c) => { |
| 2429 | m[(i, j)] = m4[(i - l_r, j - l_c)]; |
| 2430 | } |
| 2431 | _ => (), |
| 2432 | } |
| 2433 | } |
| 2434 | } |
| 2435 | m |
| 2436 | } |
| 2437 | |
| 2438 | /// Inverse of Lower matrix |
| 2439 | /// |
no test coverage detected