source: distools/pe_mtimes.m @ 10

Last change on this file since 10 was 10, checked in by bduin, 14 years ago
File size: 761 bytes
RevLine 
[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
9function c = pe_mtimes(a,b)
10
11siga = getsig(a);
12sigb = getsig(b);
13
14if 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;
20elseif isdataset(a)
21  J = diag([ones(1,siga(1))  -ones(1,siga(2))]);
22  c = a*J*b;
23elseif isdataset(b) % problem! make doubles
24  J = diag([ones(1,sigb(1))  -ones(1,sigb(2))]);
25  c = a*J*(+b);
26else % just doubles, no PE space
27  c = a*b;
28end
29 
30 
Note: See TracBrowser for help on using the repository browser.