-
大小: 14.05MB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2023-07-21
- 語言: Matlab
- 標(biāo)簽: DBN??matlab??深度學(xué)習(xí)??
資源簡介
文件解壓后,在Matlab基礎(chǔ)上,根據(jù)本人博文進行操作。注意修改默認(rèn)路徑。
代碼片段和文件信息
function?A?=?allcomb(varargin)
%?ALLCOMB?-?All?combinations
%????B?=?ALLCOMB(A1A2A3...AN)?returns?all?combinations?of?the?elements
%????in?A1?A2?...?and?AN.?B?is?P-by-N?matrix?is?which?P?is?the?product
%????of?the?number?of?elements?of?the?N?inputs.
%????Empty?inputs?yields?an?empty?matrix?B?of?size?0-by-N.?Note?that
%????previous?versions?(1.x)?simply?ignored?empty?inputs.
%
%????Example:
%???????allcomb([1?3?5][-3?8][0?1])?;
%?????????1??-3???0
%?????????1??-3???1
%?????????1???8???0
%?????????...
%?????????5??-3???1
%?????????5???8???0
%?????????5???8???1
%
%????ALLCOMB(A1..AN‘matlab‘)?causes?the?first?column?to?change?fastest.
%????This?is?more?consistent?with?matlab?indexing.?Example:
%????allcomb(1:23:45:6‘matlab‘)?%->
%??????1???3???5
%??????2???3???5
%??????1???4???5
%??????...
%??????2???4???6
%
%????This?functionality?is?also?known?as?the?cartesian?product.
%
%????See?also?NCHOOSEK?PERMS
%????and?COMBN?(Matlab?Central?FEX)
%?for?Matlab?R13+
%?version?2.1?(feb?2011)
%?(c)?Jos?van?der?Geest
%?email:?jos@jasen.nl
%?History
%?1.1?(feb?2006)?removed?minor?bug?when?entering?empty?cell?arrays;
%?????added?option?to?let?the?first?input?run?fastest?(suggestion?by?JD)
%?1.2?(jan?2010)?using?ii?as?an?index?on?the?left-hand?for?the?multiple
%?????output?by?NDGRID.?Thanks?to?Jan?Simon?for?showing?this?little?trick
%?2.0?(dec?2010).?Bruno?Luong?convinced?me?that?an?empty?input?should
%?return?an?empty?output.
%?2.1?(feb?2011).?A?cell?as?input?argument?caused?the?check?on?the?last
%??????argument?(specifying?the?order)?to?crash.
error(nargchk(1Infnargin))?;
%?check?for?empty?inputs
q?=?~cellfun(‘isempty‘varargin)?;
if?any(~q)
????warning(‘ALLCOMB:EmptyInput‘‘Empty?inputs?result?in?an?empty?output.‘)?;
????A?=?zeros(0nargin)?;
else
????
????ni?=?sum(q)?;
????
????argn?=?varargin{end}?;
????ischar(argn)
????if?ischar(argn)?&&?(strcmpi(argn‘matlab‘)?||?strcmpi(argn‘john‘))
????????%?based?on?a?suggestion?by?JD?on?the?FEX
????????ni?=?ni-1?;
????????ii?=?1:ni?;
????????q(end)?=?0?;
????else
????????%?enter?arguments?backwards?so?last?one?(AN)?is?changing?fastest
????????ii?=?ni:-1:1?;
????end
????
????if?ni==0
????????A?=?[]?;
????else
????????args?=?varargin(q)?;
????????if?~all(cellfun(‘isclass‘a(chǎn)rgs‘double‘))
????????????error(‘All?arguments?should?be?arrays?of?doubles‘)?;
????????end
????????if?ni==1
????????????A?=?args{1}(:)?;
????????else
????????????%?flip?using?ii?if?last?column?is?changing?fastest
????????????[A{ii}]?=?ndgrid(args{ii})?;
????????????%?concatenate
????????????A?=?reshape(cat(ni+1A{:})[]ni)?;
????????end
????end
end
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????232??2015-12-01?02:29??dbntrain.m
?????目錄???????????0??2019-01-02?20:50??__MACOSX\
?????文件?????????172??2015-12-01?02:29??__MACOSX\._dbntrain.m
?????文件?????????557??2015-12-01?02:29??dbnsetup.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._dbnsetup.m
?????文件?????????126??2015-12-01?02:29??sigmrnd.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._sigmrnd.m
?????文件????????2083??2015-12-01?02:29??randp.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._randp.m
?????文件????????1402??2019-01-01?19:54??rbmtrain.m
?????文件?????????172??2019-01-01?19:54??__MACOSX\._rbmtrain.m
?????文件??????????48??2015-12-01?02:29??sigm.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._sigm.m
?????文件????14735220??2015-12-01?02:29??mnist_uint8.mat
?????文件?????????172??2015-12-01?02:29??__MACOSX\._mnist_uint8.mat
?????文件?????????183??2015-12-01?02:29??whiten.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._whiten.m
?????文件????????1638??2015-12-01?02:29??nnbp.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._nnbp.m
?????文件?????????313??2015-12-01?02:29??im2patches.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._im2patches.m
?????文件??????????89??2015-12-01?02:29??rbmup.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._rbmup.m
?????文件?????????425??2015-12-01?02:29??dbnunfoldtonn.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._dbnunfoldtonn.m
?????文件?????????576??2015-12-01?02:29??flipudf.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._flipudf.m
?????文件????????1849??2015-12-01?02:29??nnff.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._nnff.m
?????文件??????????90??2015-12-01?02:29??rbmdown.m
?????文件?????????172??2015-12-01?02:29??__MACOSX\._rbmdown.m
............此處省略48個文件信息
評論
共有 條評論