1 | function varargout=SVDMax(varargin) |
---|
2 | %========================================================== |
---|
3 | %reduce number of singular values until correctors in range |
---|
4 | |
---|
5 | SYS=varargin(1); SYS=SYS{1}; |
---|
6 | BPM=varargin(2); BPM=BPM{1}; |
---|
7 | BL= varargin(3); BL = BL{1}; |
---|
8 | COR=varargin(4); COR=COR{1}; |
---|
9 | RSP=varargin(5); RSP=RSP{1}; |
---|
10 | |
---|
11 | plane=SYS.plane; |
---|
12 | lim_flag=0; |
---|
13 | %lim_flag=CurLim(COR(plane).fit, COR(plane).act, COR(plane).ifit, COR(plane).lim, COR(plane).name); |
---|
14 | if lim_flag==1 |
---|
15 | while lim_flag==1; |
---|
16 | disp('Warning: Correctors out of range - reduce number of eigenvectors'); |
---|
17 | RSP(plane).nsvd=RSP(plane).nsvd-1; |
---|
18 | if RSP(plane).nsvd==0 |
---|
19 | error('Number of singular values reduced to zero'); |
---|
20 | end |
---|
21 | [BPM,BL,COR]=BackSubSystem(plane,SYS,BPM,BL,COR,RSP); |
---|
22 | %lim_flag=CurLim(COR(plane).ifit, COR(plane).act,COR(plane).fit,COR(plane).lim,COR(plane).name); |
---|
23 | lim_flag=checklimits(COR(plane).AOFamily, COR(plane).ifit, COR(plane).act(COR(plane).ifit), COR(plane).fit); |
---|
24 | end |
---|
25 | end |
---|
26 | %disp(['Max number of singular values for correctors in range: ', num2str(RSP(plane).nsvd)]); |
---|
27 | |
---|
28 | varargout{1}=RSP(SYS.plane).nsvd; |
---|