This file is indexed.

/usr/share/sdpa/mex/SedumiToSDPA.m is in sdpam 7.3.9+dfsg-1build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
function SedumiToSDPA(filename,A,b,c,K, accuracy);
% SedumiToSDPA(filename,A,b,c,K);
%
% A converter from SeDuMi Input to SDPA sparse format
% (C) SDPA Project 2008
%
% filename : Filename for SDPA dat-s
% A,b,c,K  : SeDuMi Input 
% accuracy : printf format (e.g. %8.16e)    
% /* -------------------------------------------------------------
%
% This file is a component of SDPA
% Copyright (C) 2004-2013 SDPA Project
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
%
% ------------------------------------------------------------- */
    
    
if nargin < 6 || ~ischar(accuracy)
    accuracy = '%8.16e';
    fprintf('Accuracy is set as "%s"\n', accuracy);
end
if accuracy(1) ~= '%'
    error('accuracy must start with %% (e.g. %8.16e) \n');
end

bprint = sprintf('%s ', accuracy);
eleprint = sprintf('%%d %%d %%d %%d %s\n', accuracy);
    
% Note that primal-dual is reverse in SeDuMi
    c = -c;
    
    if isfield(K,'q') && ~isempty(K.q)
        error('Current Program cannot handle K.q');
    end

    if isfield(K,'r') && ~isempty(K.r)
        error('Current Program cannot handle K.r');
    end

    if size(b,2) ~= 1 
        b = b';
    end
    m = size(b,1);
    if size(c,2) ~= 1
        c = c';
    end
    n = size(c,1);
    if size(A,1) ~= m
        A = A';
    end
    
    fprintf('Size A[m=%d,n=%d], b[m=%d], c[n=%d] ::', ...
            size(A,1),size(A,2), m, n);
    fprintf('nnz(A) = %d, nnz(C) = %d\n', nnz(A), nnz(c));
    if size(A,1) ~= m | size(A,2) ~= n
        error('Inconsistent Size');
    end
    
    Kf = 0;
    if isfield(K,'f') && ~isempty(K.f)
        Kf = K.f;
    end
    Kl = 0;
    if isfield(K,'l') && ~isempty(K.l)
        Kl = K.l;
    end
    Ks = 0;
    if isfield(K,'s') && ~isempty(K.s)
        Ks = K.s;
        if size(Ks,2) ~= 1
            Ks = Ks';
        end
    else
        error('Cannot convert empty K.s problem');
    end
    
    fprintf('K.f = %d, K.l = %d, sum(K.s .* K.s) = %d, #K.s = %d, max(K.s) = %d\n', Kf, Kl, ...
            sum(Ks.*Ks), length(K.s), max(K.s));
    Ktotal = Kf + Kl + sum(Ks.*Ks);
    if  Ktotal ~= n
        error('Inconsistent Size K and n\n');
    end
        
    if Kf ~= 0
        fprintf(['Free Variables are divided into positive and ' ...
                 'negative part of LP cone\n']);
        Af = A(:,1:Kf);
        Al = A(:,Kf+1:Kf+Kl);
        As = A(:,Kf+Kl+1:Kf+Kl+sum(Ks.*Ks));
        Anew = [Af, -Af, Al, As];
        
        cf = c(1:Kf,1);
        cl = c(Kf+1:Kf+Kl,1);
        cs = c(Kf+Kl+1:Kf+Kl+sum(Ks.*Ks),1);
        cnew = [cf; -cf; cl; cs];
        
        Knew.f = 0;
        Knew.l = 2*Kf + Kl;
        Knew.s = K.s;
        
        A = Anew;
        c = cnew;
        K = Knew;
    end
    
    Kf = 0;
    Kl = 0;
    if isfield(K,'l') && ~isempty(K.l)
        Kl = K.l;
    end
    Ks = 0;
    if isfield(K,'s') && ~isempty(K.s)
        Ks = full(K.s);
        if size(Ks,2) ~= 1
            Ks = Ks';
        end
    end
    K.l = Kl;
    K.s = Ks;
    
    Ktotal = Kf + Kl + sum(Ks.*Ks);
    if  Ktotal ~=  size(A,2);
        error('Inconsistent Size K = %d and n = %d', Ktotal,size(A,2));
    end
    At = A';
    
    USE_MEX = 1;
    if USE_MEX
        if ~issparse(A)
            A = sparse(A);
        end
        if issparse(b)
            b = full(b);
        end
        if ~issparse(c)
            c = sparse(c);
        end
        fprintf('Writing data to %s\n', filename); 
        mexWriteSedumiToSDPA(filename, At,b,c,K, accuracy);
    else
        fid = fopen(filename,'w');
        fprintf('Writing data to %s\n', filename); 
        fprintf(fid, '%d\n',m);
        if Kl == 0
            isKl = 0;
            fprintf(fid, '%d\n',size(Ks,1));
        else
            isKl = 1;
            fprintf(fid, '%d\n',1+size(Ks,1));
            fprintf(fid, '-%d ', Kl);
        end
        fprintf(fid, '%d ', Ks);
        fprintf(fid, '\n');
        fprintf(fid, bprint , full(b));
        fprintf(fid, '\n');
        
        %  c
        
        if Kl ~= 0
            cl = c(1:Kl);
            [i,j,v] = find(cl);
            if isempty(i) ~=1
                kdummy = 0 * ones(size(i,1),1);
                ldummy = 1 * ones(size(i,1),1);
                ge = [kdummy, ldummy, i, i, v]';
                fprintf(fid, eleprint ,ge);
            end
        end
        index = Kl;
        for l=1:size(Ks,1)
            cs = c(index+1:index+Ks(l)*Ks(l));
            CS = reshape(cs,Ks(l),Ks(l));
            [i,j,v] = find(tril(CS));
            if isempty(i) ~=1
                kdummy = 0 * ones(size(i,1),1);
                ldummy = (l+isKl) * ones(size(i,1),1);
                ge = [kdummy, ldummy, i, j, v]';
                fprintf(fid, eleprint ,ge);
            end
            index = index + Ks(l) * Ks(l);
        end
        
        % A
        for k=1:m
            ak = At(:,k)';
            if Kl ~= 0
                akl = ak(1:Kl)';
                [i,j,v] = find(akl);
                if isempty(i) ~=1
                    kdummy = k * ones(size(i,1),1);
                    ldummy = 1 * ones(size(i,1),1);
                    ge = [kdummy, ldummy, i, i, v]';
                    fprintf(fid, eleprint, ge);
                end
            end
            index = Kl;
            for l=1:size(Ks,1)
                aks = ak(index+1:index+Ks(l)*Ks(l));
                AKS = reshape(aks,Ks(l),Ks(l));
                [i,j,v] = find(tril(AKS));
                if isempty(i) ~=1
                    kdummy = k * ones(size(i,1),1);
                    ldummy = (l+isKl) * ones(size(i,1),1);
                    ge = [kdummy, ldummy, i, j, v]';
                    fprintf(fid, eleprint, ge);
                end
                index = index + Ks(l) * Ks(l);
            end
        end
    end

    fprintf('Sucessfully converted\n');
    
end