| 2153 | } |
| 2154 | |
| 2155 | fn solve_mat(&self, m: &ComplexMatrix, sk: SolveKind) -> ComplexMatrix { |
| 2156 | match sk { |
| 2157 | SolveKind::LU => { |
| 2158 | let lu = self.lu(); |
| 2159 | let (p, q, l, u) = lu.extract(); |
| 2160 | let mut x = cmatrix( |
| 2161 | vec![Complex::zero(); self.col * m.col], |
| 2162 | self.col, |
| 2163 | m.col, |
| 2164 | Shape::Col, |
| 2165 | ); |
| 2166 | for i in 0..m.col { |
| 2167 | let mut v = m.col(i).clone(); |
| 2168 | for (r, &s) in p.iter().enumerate() { |
| 2169 | v.swap(r, s); |
| 2170 | } |
| 2171 | let z = l.forward_subs(&v); |
| 2172 | let mut y = u.back_subs(&z); |
| 2173 | for (r, &s) in q.iter().enumerate() { |
| 2174 | y.swap(r, s); |
| 2175 | } |
| 2176 | unsafe { |
| 2177 | let mut c = x.col_mut(i); |
| 2178 | copy_vec_ptr(&mut c, &y); |
| 2179 | } |
| 2180 | } |
| 2181 | x |
| 2182 | } |
| 2183 | SolveKind::WAZ => { |
| 2184 | unimplemented!() |
| 2185 | } |
| 2186 | } |
| 2187 | } |
| 2188 | |
| 2189 | fn is_symmetric(&self) -> bool { |
| 2190 | if self.row != self.col { |