# matrixfunction

28 Feb 2009 (Updated )

summary

matrixfuncrn(hFunction,A,B)
```function Y = matrixfuncrn(hFunction,A,B)
% matrixfuncrn
%   Y = matrixfuncrn(hFunction,A,B)
%
%   Invokes hFunction on the columns of matrix A and the rows of matrix B.
%   hFunction is a function handle that accepts two vectors.
%   hFunction is invoked aCols*(2*bRows-aCols+1)/2 times.
%   Y is a cell matrix of size([aRows bCols]).
%
%   Example
%       A = [1 2 3; 4 5 6; 7 8 9]
%       Y = matrixfuncrn(@dot,A,A);         % Simple example, same as A'*A'
%       Y = [30]    [66]    [102]
%             []    [81]    [126]
%             []      []    [150]
%
%       matrixfun matrixfunrr matrixfunrc matrixfuncc matrixfuncr matrixfunt
%       matrixfunn matrixfunrrn matrixfunrcn matrixfunccn matrixfuncrn matrixfuntn
%       matrixfuni matrixfunir matrixfunic
%

%% Author Information
%   Smart Systems Integration Group
%	Cork Institute of Technology
%

%%
nA = size(A,2);                             % Matrix size
nB = size(B,1);                             % Matrix size
Y = cell([nA nB]);                          % Prefine loop variable
for i = 1:nA                              	% Loop through each column
for j = i:nB                            % Loop through each row
Y{i,j} = hFunction(A(:,i).',B(j,:));% Invoke function
end
end
end
```