## Diff of /inst/ultimateld.m[88c2a4] .. [677636]  Maximize  Restore

### Switch to unified view

a/inst/ultimateld.m b/inst/ultimateld.m
`...`
`...`
51
```## @end verbatim
```
51
```## @end verbatim
```
52
```##
```
52
```##
```
53
```## @seealso {bferguson, quotaad, quotapanning}
```
53
```## @seealso {bferguson, quotaad, quotapanning}
```
54
```## @end deftypefn
```
54
```## @end deftypefn
```
55
55
56
```function ultimate = ultimateld (S,quotas)
```
56
```function ultimate = ultimateld (S, quotas)
```
57
57
58
```[m,n] = size (S);           #triangle with m years (i=1,2,u,...u+1,u+2,....m) and n periods (k=0,1,2,...n-1)
```
58
```  [m,n] = size (S);           #triangle with m years (i=1,2,u,...u+1,u+2,....m) and n periods (k=0,1,2,...n-1)
```
59
```u = m - n;                                     #rows of the upper square
```
59
```  u = m - n;                                     #rows of the upper square
```
60
```S = fliplr(triu(fliplr(S),-u));                   #ensure S is triangular
```
60
```  S = fliplr(triu(fliplr(S),-u));                   #ensure S is triangular
```
61
61
62
```if (size(quotas) ~= [1,n])
```
62
```  if (size(quotas) ~= [1,n])
```
63
``` usage(strcat("quotas must be of size [1,",num2str(n),"]" ));
```
63
```    error(strcat("quotas must be of size [1,",num2str(n),"]" ));
```
64
```end
```
64
```  end
```
65
65
66
```#calculate the ultimate value
```
66
```  #calculate the ultimate value
```
67
67
68
```if (u==0)
```
68
```  if (u==0)
```
69
```ultimate = flipud(diag(fliplr(S))) ./ quotas';
```
69
```    ultimate = flipud(diag(fliplr(S))) ./ quotas';
```
70
```else
```
70
```  else
```
71
```ultimate = [(flipud(diag(fliplr(S),-u)) ./ quotas')', S(1:u,n)]';
```
71
```    ultimate = [(flipud(diag(fliplr(S),-u)) ./ quotas')', S(1:u,n)]';
```
72
```end
```
72
```  end
```
73
```ultimate = flipud(ultimate);
```
73
```  ultimate = flipud(ultimate);
```
74
74
75
```end
```
75
```end
```