Line | |
---|
1 | function f = flops_normpdfln(x, m, S, V)
|
---|
2 | % FLOPS_NORMPDFLN Flops for normpdfln.
|
---|
3 | % Arguments are same as normpdf.
|
---|
4 |
|
---|
5 | f = 0;
|
---|
6 | if nargin == 1
|
---|
7 | [d,n] = size(x);
|
---|
8 | elseif isempty(m)
|
---|
9 | [d,n] = size(x);
|
---|
10 | else
|
---|
11 | s = max(size(x),size(m));
|
---|
12 | d = s(1);
|
---|
13 | n = s(2);
|
---|
14 | f = f + d*n;
|
---|
15 | end
|
---|
16 | if nargin < 3
|
---|
17 | f = f + d*n + (d-1)*n + 2*n;
|
---|
18 | return
|
---|
19 | end
|
---|
20 | have_inv = 0;
|
---|
21 | if nargin == 3
|
---|
22 | if d == 1
|
---|
23 | f = f + (3+flops_div)*n + cols(S) + (1+flops_log)*cols(S);
|
---|
24 | return;
|
---|
25 | end
|
---|
26 | else
|
---|
27 | if ischar(V)
|
---|
28 | if strcmp(V,'inv')
|
---|
29 | have_inv = 1;
|
---|
30 | end
|
---|
31 | elseif ischar(S)
|
---|
32 | if strcmp(S,'inv')
|
---|
33 | f = f + flops_chol(d);
|
---|
34 | have_inv = 1;
|
---|
35 | end
|
---|
36 | else
|
---|
37 | f = f + flops_chol(d);
|
---|
38 | end
|
---|
39 | end
|
---|
40 | if have_inv
|
---|
41 | % count flops for log(prod) instead of sum(log)
|
---|
42 | f = f + flops_mul(d,d,n) + d-1 + flops_log;
|
---|
43 | else
|
---|
44 | f = f + flops_solve_tri(d,d,n) + d-1 + flops_log;
|
---|
45 | end
|
---|
46 | f = f + 1 + d*n + (d-1)*n + 2*n;
|
---|
Note: See
TracBrowser
for help on using the repository browser.