% [Y,J] = rrr(X,f) Value of RRR linear function y = f(x) = W1.W2.x+w
%
% See rrrtrain.
%
% In:
%   X: NxD2 matrix, N D2-dim data points rowwise.
%   f: (struct) the reduced-rank linear function.
% Out:
%   Y: NxD1 matrix, N D1-dim outputs Y = f(X).
%   J: D1xD2 Jacobian matrix (assumes N=1 input only).

% Copyright (c) 2016 by Miguel A. Carreira-Perpinan

function [Y,J] = rrr(X,f)

Y = bsxfun(@plus,(X*f.W2')*f.W1',f.w');
if nargout>1 J = f.W1*f.W2; end

