length_make.m
来自「student teacher and proferssor llove thi」· M 代码 · 共 56 行
M
56 行
function [modlist,funlist,fun_info]=length_make(typestrlist)% fun_info is a 1x2 cell. fun_info{1}=>1 result is pointer, 0=>not% fun_info{2}=>typestr ('r' or 'c' usually)declare_globalsfunname='length';modlist='';funlist='';r=[char(10)];%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%modlist=[modlist,... ' interface ',funname,'f',r];if ~iscell(typestrlist) typestrlist={typestrlist};endfor i=1:length(typestrlist) typestr=typestrlist{i}; for m=1:length(typestr) temp=any(strcmp(typestr(m),{'d','m'})); if temp,typestr(m)='c';end temp=any(strcmp(typestr(m),{'e','n'})); if temp,typestr(m)='r';end temp=any(strcmp(typestr(m),{'f','o'})); if temp,typestr(m)='i';end temp=any(strcmp(typestr(m),{'g','p'})); if temp,typestr(m)='l';end end [modlist,funlist,len,typestr2]=makeheader('length',2,typestr,modlist,funlist,r); funlist=[funlist,' integer :: out',r]; fun_info{2}='u'; wantsizes=1; funlist=makesize1(wantsizes,funlist,len,r); %Here we can insert any global vars or preliminary options %%%%%% funlist=makesize2(wantsizes,funlist,len,r,typestr); %Here we can insert type dependant things %%%%%%%%%%%%%%%%%%%%%%% %And now the kernel %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% kernel=['']; kernel=[kernel,' if (in_1_m.eq.0) then',r]; kernel=[kernel,' out=0',r]; kernel=[kernel,' elseif (in_1_n.eq.0) then',r]; kernel=[kernel,' out=0',r]; kernel=[kernel,' else',r]; kernel=[kernel,' out=max(in_1_m,in_1_n)',r]; kernel=[kernel,' endif',r]; funlist=[funlist,kernel]; %End of the function %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% funlist=[funlist,' end function ',funname,'f_',typestr2,r]; if strcmp(typestr,typestrlist{length(typestrlist)}) else funlist=[funlist,r]; endend%And end the module %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%modlist=[modlist... ' end interface ',funname,'f',char(10)];fun_info{1}=0;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?