MCPcopy Create free account
hub / github.com/Axect/Peroxide / back_subs

Method back_subs

src/complex/matrix.rs:1875–1887  ·  view source on GitHub ↗

Backward Substitution for Upper Triangular

(&self, b: &[C64])

Source from the content-addressed store, hash-verified

1873impl LinearAlgebra<ComplexMatrix> for ComplexMatrix {
1874 /// Backward Substitution for Upper Triangular
1875 fn back_subs(&self, b: &[C64]) -> Vec<C64> {
1876 let n = self.col;
1877 let mut y = vec![Complex::zero(); n];
1878 y[n - 1] = b[n - 1] / self[(n - 1, n - 1)];
1879 for i in (0..n - 1).rev() {
1880 let mut s = Complex::zero();
1881 for j in i + 1..n {
1882 s += self[(i, j)] * y[j];
1883 }
1884 y[i] = 1f64 / self[(i, i)] * (b[i] - s);
1885 }
1886 y
1887 }
1888
1889 /// Forward substitution for Lower Triangular
1890 fn forward_subs(&self, b: &[C64]) -> Vec<C64> {

Callers 2

solveMethod · 0.45
solve_matMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected