>> type create function z=create(i) z=ones(3)*i; >> create91) ??? create91) | Error: Missing operator, comma, or semicolon. >> create(1) ans = 1 1 1 1 1 1 1 1 1 >> create(2) ans = 2 2 2 2 2 2 2 2 2 >> i=1:2*p i = ddense object: 1-by-2p >> z=mm('create',i) z = ddense object: 3-by-6p >> z(:,:) ans = 1 1 1 2 2 2 1 1 1 2 2 2 1 1 1 2 2 2 >> z z = ddense object: 3-by-6p >> z z = ddense object: 3-by-6p >> z(:,[3 4])=z(:,[4 3]) z = ddense object: 3-by-6p >> ppgcone(3); z(:,:) ans = 1 1 2 1 2 2 1 1 2 1 2 2 1 1 2 1 2 2 >> >> >> >> z=mm('randn',3) z = ddense object: 6p-by-3 >> z(:,:) ans = -0.4326 0.2877 1.1892 -1.6656 -1.1465 -0.0376 0.1253 1.1909 0.3273 -0.4326 0.2877 1.1892 -1.6656 -1.1465 -0.0376 0.1253 1.1909 0.3273 >> z=mm('create',i') z = ddense object: 3-by-6p >> i' ans = ddense object: 2-by-1p >> i=matlab2pp(1:2,1) i = ddense object: 1p-by-2 >> i=matlab2pp(1:2,1) i = ddense object: 1p-by-2 >> z=mm('create',i) ??? [Rank 0]: Error creating fifo Error in ==> /share/matlabp/matlab/ppclient.mexglx Error in ==> /share/matlabp/matlab/mm.m On line 133 ==> [ecode,estr,realout{1:2*numresult}]=ppclient('ppengine',fname,numresult,realin{1:y}); >> z=mm('create',i') z = ddense object: 6p-by-3 >> z z = ddense object: 6p-by-3 >> ppgcone(1); ppgcone(2); z=mm('randn',3) z = ddense object: 6p-by-3 >> ppgcone(4); ppgcone(5); [p,l,u]=mm('lu',z) p = ddense object: 6p-by-3 l = ddense object: 6p-by-3 u = ddense object: 6p-by-3 >> ppgcone(6); ppgcone(8); p p = ddense object: 6p-by-3 >> ppgcone(11); p(:,:) ans = 1.0000 0 0 -0.2572 1.0000 0 0.2406 -0.2586 1.0000 1.0000 0 0 -0.2572 1.0000 0 0.2406 -0.2586 1.0000 >> l(:,;) ??? l(:,;) | Error: Expected a variable, function, or constant, found ";". >> l(:,:) ans = 0.7258 -0.1364 0.0593 0 2.1481 1.0820 0 0 0.3795 0.7258 -0.1364 0.0593 0 2.1481 1.0820 0 0 0.3795 >> u(:,:) ans = 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 >> [l,u,p]=mm('lu',z) l = ddense object: 6p-by-3 u = ddense object: 6p-by-3 p = ddense object: 6p-by-3 >> ppgcone(7); ppgcone(12); p(:,;) ??? p(:,;) | Error: Expected a variable, function, or constant, found ";". ppgcone(15); >> ppgcone(16); p(:,:) ans = 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 >> l(:,:) ans = 1.0000 0 0 -0.2572 1.0000 0 0.2406 -0.2586 1.0000 1.0000 0 0 -0.2572 1.0000 0 0.2406 -0.2586 1.0000 >> u(:,:) ans = 0.7258 -0.1364 0.0593 0 2.1481 1.0820 0 0 0.3795 0.7258 -0.1364 0.0593 0 2.1481 1.0820 0 0 0.3795 >> [piecesofpi ,functioneva]=mm('lu',z) piecesofpi = ddense object: 6p-by-3 functioneva = ddense object: 6p-by-3 >> [piecesofpi ,functioneva]=mm('lu',z) piecesofpi = ddense object: 6p-by-3 functioneva = ddense object: 6p-by-3 >> >> [piecesofpi ,functioneva]=mm('quad','4./(1+x.^2)',(i-1)/2,i/2) ??? [Rank 0]: Error creating fifo Error in ==> /share/matlabp/matlab/ppclient.mexglx Error in ==> /share/matlabp/matlab/mm.m On line 133 ==> [ecode,estr,realout{1:2*numresult}]=ppclient('ppengine',fname,numresult,realin{1:y}); >> i=1:2*p ??? Error using ==> : Function ':' not defined for variables of class 'ddense'. >> i=1:2*p ??? Error using ==> : Function ':' not defined for variables of class 'ddense'. >> i=1:2*p ??? Error using ==> : Function ':' not defined for variables of class 'ddense'. >> i=1:2*p ??? Error using ==> : Function ':' not defined for variables of class 'ddense'. >> i=1:2*p ??? Error using ==> : Function ':' not defined for variables of class 'ddense'. >> quit --i292BvN20276.1078798317/beowulf-1.lcs.mit.edu-- >> i=1:2*p i = ddense object: 1-by-2p >> [pieces_of_pi function_evals] =mm('quad','4./(1+x.^2)',(i-1)/2, i/2) pieces_of_pi = ddense object: 1-by-2p function_evals = ddense object: 1-by-2p >> pieces_of_pi(:,:) ans = 1.8546 1.2870 >> sum(ans) ans = 3.1416 >> function_evals function_evals = ddense object: 1-by-2p >> function_evals(:,:) ans = 13 13 >> [pieces_of_pi function_evals] =mm('quad','4./(1+x.^2)',(i-1)/2, i/2) pieces_of_pi = ddense object: 1-by-2p function_evals = ddense object: 1-by-2p >> ppgcone(1); ppgcone(3); z=pieces_of_pi z = ddense object: 1-by-2p >> ppgcone(4); ppgcone(5); z z = ddense object: 1-by-2p >> ppgcone(8); z(:) ans = 1.8546 1.2870 >> z=z(:,[2 1]) z = ddense object: 1-by-2p >> z(:,:) ans = 1.2870 1.8546 >> z(:) ans = 1.2870 1.8546 >> help persistent PERSISTENT Define persistent variable. PERSISTENT X Y Z defines X, Y, and Z as variables that are local to the function in which they are declared yet their values are retained in memory between calls to the function. Persistent variables are similar to global variables because MATLAB creates permanent storage for both. They differ from global variables in that persistent variables are known only to the function in which they are declared. This prevents persistent variables from being changed by other functions or from the MATLAB command line. Persistent variables are cleared when the M-file is cleared from memory or when the M-file is changed. To keep an M-file in memory until MATLAB quits, use MLOCK. If the persistent variable does not exist the first time you issue the PERSISTENT statement, it will be initialized to the empty matrix. It is an error to declare a variable persistent if a variable with the same name exists in the current workspace. See also GLOBAL, CLEAR, MLOCK, MUNLOCK, MISLOCKED. >> x=[] x = [] >> isempty(x) ans = 1 >> type counter function z=counter persistent x if isempty(x) x=1; else x=x+1; end z=x; >> z=mm('counter') z = ddense object: 2p-by-1 >> z(:,:) ans = 1 1 >> z=mm('counter') z = ddense object: 2p-by-1 >> ppgcone(6); ppgcone(7); z(:,:) ans = 2 2 >> ppgcone(9); ppgcone(10); z=mm('counter'); z(:,:) ans = 3 3 >> ppgcone(13); ppgcone(14); z=mm('counter'); z(:,:) ans = 4 4 >> z=mm('counter'); z(:,:) ans = 5 5 >> z=mm('counter'); z(:,:) ans = 6 6 >> type counter function z=counter persistent x if isempty(x) x=1; else x=x+1; end z=x; >> x x = [] >> counter ans = 1 >> counter ans = 2 >> z=mm('counter'); z(:,:) ans = 7 7 >> counter ans = 3 >> surf, mesh, ppspy ??? Error using ==> surf Not enough input arguments. >> >> >> >> >> quit --i292Bu120271.1078798316/beowulf-1.lcs.mit.edu--