Rev | Line | |
---|
[10] | 1 | %PE_MTIMES Pseudo-Euclidean matrix product
|
---|
| 2 | %
|
---|
| 3 | % C = PE_MTIMES(A,B)
|
---|
| 4 | %
|
---|
| 5 | % A and/or B should be datasets. Their PE signature SIG is retrieved,
|
---|
| 6 | % C = A*J*B, where J is a diagonal matrix with 1's, followed by -1's.
|
---|
| 7 | % J = diag ([ONES(SIG(1),1); -ONES(SIG(2),1)])
|
---|
| 8 |
|
---|
| 9 | function c = pe_mtimes(a,b)
|
---|
| 10 |
|
---|
| 11 | siga = getsig(a);
|
---|
| 12 | sigb = getsig(b);
|
---|
| 13 |
|
---|
| 14 | if isdataset(a) & isdataset(b)
|
---|
| 15 | if any(siga~=sigb)
|
---|
| 16 | error('PE signatures should be equal')
|
---|
| 17 | end
|
---|
| 18 | J = diag([ones(1,siga(1)) -ones(1,siga(2))]);
|
---|
| 19 | c = a*J*b;
|
---|
| 20 | elseif isdataset(a)
|
---|
| 21 | J = diag([ones(1,siga(1)) -ones(1,siga(2))]);
|
---|
| 22 | c = a*J*b;
|
---|
| 23 | elseif isdataset(b) % problem! make doubles
|
---|
| 24 | J = diag([ones(1,sigb(1)) -ones(1,sigb(2))]);
|
---|
| 25 | c = a*J*(+b);
|
---|
| 26 | else % just doubles, no PE space
|
---|
| 27 | c = a*b;
|
---|
| 28 | end
|
---|
| 29 |
|
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.