annotate util/SMALL_learn.m @ 203:f3b6ddd2f04f luisf_dev

checks if the variable SMALL_path exists, and exits otherwise.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 20 Mar 2012 15:52:22 +0000
parents 751fa3bddd30
children a986ee86651e
rev   line source
idamnjanovic@8 1 function DL = SMALL_learn(Problem,DL)
luis@199 2 %% SMALL Dictionary Learning
luis@199 3 %
luis@199 4 % Function gets as input Problem and Dictionary Learning (DL) structures
ivan@121 5 % In Problem structure field b with the training set needs to be defined
luis@199 6 % In DL fields with name of the toolbox and solver, and parameters file
ivan@121 7 % for particular dictionary learning technique needs to be present.
ivan@121 8 %
ivan@121 9 % Outputs are Learned dictionary and time spent as a part of DL structure
ivan@121 10
idamnjanovic@24 11 %
idamnjanovic@24 12 % Centre for Digital Music, Queen Mary, University of London.
idamnjanovic@24 13 % This file copyright 2009 Ivan Damnjanovic.
idamnjanovic@24 14 %
idamnjanovic@24 15 % This program is free software; you can redistribute it and/or
idamnjanovic@24 16 % modify it under the terms of the GNU General Public License as
idamnjanovic@24 17 % published by the Free Software Foundation; either version 2 of the
idamnjanovic@24 18 % License, or (at your option) any later version. See the file
idamnjanovic@24 19 % COPYING included with this distribution for more information.
idamnjanovic@8 20 %%
luis@199 21
daniele@195 22 global SMALL_path
luis@199 23
luis@203 24 if (isempty(SMALL_path))
luis@203 25 error('SMALL_learn:varChk', '\nSMALL_path variable is not set... Please run SMALLboxInit and try again.\n\nExiting now...\n');
luis@203 26 end
luis@203 27
ivan@152 28 if (DL.profile)
luis@199 29 fprintf('\nStarting Dictionary Learning %s... \n', DL.name);
ivan@152 30 end
luis@199 31
luis@199 32 start=cputime;
luis@199 33 tStart=tic;
luis@199 34
luis@199 35 % toolboxes configuration file
luis@199 36 run(fullfile(SMALL_path, 'config/SMALL_learn_config.m'));
luis@199 37
idamnjanovic@8 38 %%
idamnjanovic@8 39 % Dictionary Learning time
idamnjanovic@36 40 tElapsed=toc(tStart);
ivan@152 41 DL.time = cputime - start;
ivan@152 42 if (DL.profile)
luis@199 43 fprintf('\n%s finished task in %2f seconds (cpu time). \n', DL.name, DL.time);
luis@199 44 fprintf('\n%s finished task in %2f seconds (tic-toc time). \n', DL.name, tElapsed);
ivan@152 45 end
idamnjanovic@36 46 DL.time=tElapsed;
luis@199 47 % If dictionary is given as a sparse matrix change it to full
idamnjanovic@8 48
luis@199 49 DL.D = full(D);
luis@199 50
idamnjanovic@8 51 end
luis@199 52