Last change
on this file since 110 was
94,
checked in by (none), 14 years ago
|
PPPP - ica serial implementation
|
File size:
423 bytes
|
Rev | Line | |
---|
[94] | 1 | % function [S] = cosFn(mat1,mat2), |
---|
| 2 | % Computes the cosine (normalized dot product) between training vectors in |
---|
| 3 | % columns of mat1 and test vectors in columns of mat2. Outputs a matrix of |
---|
| 4 | % cosines (similarity matrix). |
---|
| 5 | % |
---|
| 6 | % Written by Ian Fasel. |
---|
| 7 | |
---|
| 8 | function [S] = cosFn(mat1,mat2), |
---|
| 9 | |
---|
| 10 | denom = sum(mat1.^2,1)*sum(mat2'.^2,2); |
---|
| 11 | denom (find(denom==0)) = 0.00000000000000000000001; |
---|
| 12 | numer = mat1'*mat2; |
---|
| 13 | |
---|
| 14 | S = numer./denom; |
---|
Note: See
TracBrowser
for help on using the repository browser.