Calculating the flops for triangular system

712 Views Asked by At

My lecture notes state that for a lower triangular system, $\left(a_{i j}=0\right.$ if $\left.j>i\right) n^{2}$ flops are required to solve it, through the process below. $$ \begin{aligned} x_{1} &:=b_{1} / a_{11} \\ x_{2} &:=\left(b_{2}-a_{21} x_{1}\right) / a_{22} \\ x_{3} &:=\left(b_{3}-a_{31} x_{1}-a_{32} x_{2}\right) / a_{33} \\ &: \\ x_{n} &:=\left(b_{n}-a_{n 1} x_{1}-a_{n 2} x_{2}-\cdots-a_{n, n-1} x_{n-1}\right) / a_{n n} \end{aligned} $$ My question is, how is this $O(n^2)$ flops? for $x_1$, there is just one flop, a division. For $x_2$, there is a multiplication, subtraction, and a division. So that is $3$ flops. For $x_3$, there is a multiplication, multiplication, subtraction, subtraction, and a division. That is $5$ flops. So shouldn't we do $1 + 3 + 5 + \dots$?

In general, how are flops determined? My instinct is to use a formula that has the "least" amount of operations to solve, but this notion to me seems unclear.

1

There are 1 best solutions below

0
On BEST ANSWER

Hint: $$\begin{aligned} 1 &= 1^2 & 1 + 3 = 4 &= 2^2 & 1 + 3 + 5 = 9 &= 3^2 \end{aligned}$$