%
% M = linearMapping( IN, OUT )
%
%
%Output parameters:
% M: The linear mapping matrix
%
%
%Input parameters:
% IN: input data, where # of row is # of data and # of col is # of input features
% 1 input1 1-4
% 2 input2 1-4
% ...
% 1024 inputn 1-4
% OUT: output data, where # of row is # of data and # of col is # of output labels
% 1 output1 1-16
% 2 output2 1-16
% ...
% 1024 outputn 1-16
%
%Example:
% datanum = 1024;
% outputnum = 16;
% inputnum = 4;
%
% inputdata = rand(datanum, inputnum); rand(1024,4)
% outputdata = rand(datanum, outputnum); rand(1024,16)
%
% M = linearMapping(inputdata, outputdata); 1024 x 4, 1024 x 16
%
%
%Version: 20130727
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Deep Neural Network: %
% %
% Copyright (C) 2013 Masayuki Tanaka. All rights reserved. %
% mtanaka@ctrl.titech.ac.jp %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function M = linearMapping( IN, OUT ) % IN 1000 x 8 OUT 1000 x 4
M = pinv(IN) * OUT; % 8 x 1000 * 1000 x 4 = 8 x 4
%OUT = IN * M;