Line | |
---|
1 | function f = flops_solve(a,b,c)
|
---|
2 | % FLOPS_SOLVE Flops for matrix left division.
|
---|
3 | % FLOPS_SOLVE(a,b) returns the number of flops for a\b.
|
---|
4 | % FLOPS_SOLVE(n,m,c) returns the number of flops for ones(n,m)\ones(m,c).
|
---|
5 |
|
---|
6 | if nargin == 2
|
---|
7 | f = flops_solve(rows(a),cols(a),cols(b));
|
---|
8 | return;
|
---|
9 | end
|
---|
10 | if a == b
|
---|
11 | if a == 1
|
---|
12 | % scalar division
|
---|
13 | f = c*flops_div;
|
---|
14 | return;
|
---|
15 | end
|
---|
16 | f = flops_chol(a) + 2*flops_solve_tri(a,b,c);
|
---|
17 | elseif a > b
|
---|
18 | % this comes from Ax=b, x = (A'*A)\(A'*b)
|
---|
19 | f = flops_mul(b,a,b) + flops_mul(b,a,c) + flops_solve(b,b,c);
|
---|
20 | else
|
---|
21 | % this comes from Ax=b, x = A'*(A*A')\b
|
---|
22 | f = flops_mul(a,b,a) + flops_mul(b,a,c) + flops_solve(a,a,c);
|
---|
23 | end
|
---|
Note: See
TracBrowser
for help on using the repository browser.