1function Opout=operatorappr(Op,T) 2%-*- texinfo -*- 3%@deftypefn {Function} operatorappr 4%@verbatim 5%OPERATORAPPR Best approximation by operator 6% Usage: c=operatorappr(Op,K); 7% 8% Opout=OPERATORAPPR(Opin,T) computes the an operator Opout of the 9% same type as Opin that best approximates the matrix T in the 10% Frobenious norm of the matrix (the Hilbert-Schmidt norm of the 11% operator). 12% 13% For some operator classes, the approximation is always exact, so that 14% operator(Opout,f) computes the exact same result as T'*f. 15% 16%@end verbatim 17%@strong{Url}: @url{http://ltfat.github.io/doc/operators/operatorappr.html} 18%@seealso{operatornew, operator, operatoreigs} 19%@end deftypefn 20 21% Copyright (C) 2005-2016 Peter L. Soendergaard <peter@sonderport.dk>. 22% This file is part of LTFAT version 2.3.1 23% 24% This program is free software: you can redistribute it and/or modify 25% it under the terms of the GNU General Public License as published by 26% the Free Software Foundation, either version 3 of the License, or 27% (at your option) any later version. 28% 29% This program is distributed in the hope that it will be useful, 30% but WITHOUT ANY WARRANTY; without even the implied warranty of 31% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32% GNU General Public License for more details. 33% 34% You should have received a copy of the GNU General Public License 35% along with this program. If not, see <http://www.gnu.org/licenses/>. 36 37if nargin<2 38 error('%s: Too few input parameters.',upper(mfilename)); 39end; 40 41if ~isstruct(Op) 42 error('%s: First argument must be a operator definition structure.',upper(mfilename)); 43end; 44 45switch(Op.type) 46 case 'framemul' 47 s=framemulappr(Op.Fa,Op.Fs,T); 48 Opout=operatornew('framemul',Op.Fa,Op.Fs,s); 49 case 'spread' 50 s=spreadfun(T); 51 Opout=operatornew('spread',s); 52end; 53 54 55 56