This file is indexed.

/usr/lib/python2.7/dist-packages/cvxopt/printing.py is in python-cvxopt 1.1.4-1.4.

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
# Copyright 2010-2011 L. Vandenberghe.
# Copyright 2004-2009 J. Dahl and L. Vandenberghe.
# 
# This file is part of CVXOPT version 1.1.4.
#
# CVXOPT 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 3 of the License, or
# (at your option) any later version.
#
# CVXOPT 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, see <http://www.gnu.org/licenses/>.

options = {'dformat' : '% .2e',
           'iformat' : '% i',
           'width' : 7,
           'height' : -1}

def matrix_str_default(X):

    from sys import maxsize
    from cvxopt.printing import options

    width, height = options['width'], options['height']
    iformat, dformat = options['iformat'], options['dformat']

    sgn = ['-','+']

    if   X.typecode == 'i': fmt = iformat
    else: fmt = dformat

    s = ""
    m, n   = X.size
    if width < 0: width = maxsize
    if height < 0: height = maxsize

    if width*height is 0: return ""
    if len(X) is 0: return ""

    rlist = range(0,min(m,height))
    clist = range(0,min(n,width))

    if X.typecode == 'z':
        twidth = max([ len(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                              (fmt % abs(X[i,j].imag)).lstrip() ) \
                          for i in rlist for j in clist ])
    else:
        twidth = max([ len(fmt % X[i,j]) for i in rlist for j in clist ])

    for i in rlist:
        s += '['

        for j in clist:

            if X.typecode == 'z':
                s += format(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' +\
                          (fmt % abs(X[i,j].imag)).lstrip(), '>%i' %twidth)
            else:
                s += format(fmt % X[i,j], '>%i' %twidth)

            s += ' '
        
        if width < n: s += '... ]\n'        
        else: s = s[:-1] + ']\n'
           
    if height < m: 
        s += "[" + min(n,width)*(center(':',twidth)+' ')

        if width < n: s += '   ]\n'
        else: s = s[:-1] + ']\n'

    return s

def matrix_repr_default(X):
    return "<%ix%i matrix, tc='%c'>" %(X.size[0],X.size[1],X.typecode)

def spmatrix_str_default(X):

    from sys import maxsize
    from cvxopt.printing import options

    width, height = options['width'], options['height']
    iformat, dformat = options['iformat'], options['dformat']

    sgn = ['-','+']

    if   X.typecode == 'i': fmt = iformat
    else: fmt = dformat

    s = ""
    m, n   = X.size
    if width < 0: width = maxsize
    if height < 0: height = maxsize

    if width*height is 0: return ""
 
    rlist = range(0,min(m,height))
    clist = range(0,min(n,width))

    Xr = X[:min(m,height),:min(n,width)]
    Idx = list(zip(*(Xr.I,Xr.J)))
    
    if len(Idx) > 0:
        if X.typecode == 'z':
            twidth = max([ len(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                                  (fmt % abs(X[i,j].imag)).lstrip() ) \
                              for i in rlist for j in clist ])
        else:
            twidth = max([ len(fmt % X[i,j]) for i in rlist for j in clist ])
    else:
        twidth = 1

    for i in rlist:
        s += '['

        for j in clist:

            if (i,j) in Idx:
                if X.typecode == 'z':
                    s +=  format(fmt % X[i,j].real + sgn[X[i,j].imag>0] + 'j' + \
                                 (fmt % abs(X[i,j].imag)).lstrip(), '>%i' %twidth)
                else:
                    s += format(fmt % X[i,j], '>%i' %twidth)
            else: 
                s += format(0, '^%i' %twidth)
                
            s += ' '
        
        if width < n: s += '... ]\n'        
        else: s = s[:-1] + "]\n"
           
    if height < m: 
        s += "[" + min(n,width)*(format(':', '^%i' %twidth)+' ')

        if width < n: s += '   ]\n'
        else: s = s[:-1] + ']\n'

    return s


def spmatrix_str_triplet(X):

    from cvxopt.printing import options

    iformat, dformat = options['iformat'], options['dformat']

    sgn = ['-','+']

    if   X.typecode == 'i': fmt = iformat
    else: fmt = dformat

    s = ""
    
    if len(X) > 0:
        if X.typecode == 'z':
            twidth = max([ len(fmt % Xk.real + sgn[Xk.imag>0] + 'j' + \
                                   (fmt % abs(Xk.imag)).lstrip() ) \
                               for Xk in X.V ])
        else:
            twidth = max([ len(fmt % Xk) for Xk in X.V ])

        imax = max([ len(str(i)) for i in X.I ])
        jmax = max([ len(str(j)) for j in X.J ])

    else:
        twidth = 0 

    for k in range(len(X)):
        s += "(" 
        s += format(X.I[k], '>%i' %imax)  + "," + \
            format(X.J[k], '>%i' %jmax) 
        s += ") "

        if X.typecode=='z':
            s +=  format(fmt % X.V[k].real + sgn[X.V[k].imag>0] + 'j' + \
                         (fmt % abs(X.V[k].imag)).lstrip(), '>%i' %twidth)
        else:
            s += format(fmt % X.V[k], '>%i' %twidth)
        s += "\n"
                
    return s

def spmatrix_repr_default(X):
    return "<%ix%i sparse matrix, tc='%c', nnz=%i>" \
        %(X.size[0],X.size[1],X.typecode,len(X.V))