source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/opt/yalmip/extras/@ncvar/mpower.m @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 465 bytes
Line 
1function y = mpower(x,d)
2%MPOWER (overloaded)
3
4% Author Johan Löfberg
5% $Id: mpower.m,v 1.2 2006/08/11 11:48:15 joloef Exp $
6
7%Sanity check
8if prod(size(d))>1 | ~((fix(d) == d)) | ~(d>=0)
9    error('The power must be scalar.');
10end
11if x.dim(1)~=x.dim(2)
12    error('Matrix must be square.')
13end
14   
15switch d
16    case 0
17            y = eye(x.dim(1),x.dim(2))^0;
18    case 1
19        y = x;
20    case 2
21        y = x * x;
22    otherwise
23        y = x*mpower(x,d-1);
24end
Note: See TracBrowser for help on using the repository browser.