This file is indexed.

/usr/lib/python2.7/dist-packages/ffc/uflacs/analysis/crsarray.py is in python-ffc 2016.2.0-1.

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
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2016 Martin Sandve Alnæs
#
# This file is part of UFLACS.
#
# UFLACS is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# UFLACS 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with UFLACS. If not, see <http://www.gnu.org/licenses/>

"""Compressed row storage 'matrix' (actually just a non-rectangular 2d array)."""

import numpy


class CRSArray(object):
    """An array of variable length dense arrays.

    Stored efficiently with simple compressed row storage.
    This CRS array variant doesn't have a sparsity pattern,
    as each row is simply a dense vector.

    Values are stored in one flat array 'data[]',
    and 'row_offsets[i]' contains the index to the first
    element on row i for 0<=i<=num_rows.
    There is no column index.
    """
    def __init__(self, row_capacity, element_capacity, dtype):
        itype = numpy.int16 if row_capacity < 2**15 else numpy.int32
        self.row_offsets = numpy.zeros(row_capacity + 1, dtype=itype)
        self.data = numpy.zeros(element_capacity, dtype=dtype)
        self.num_rows = 0

    def push_row(self, elements):
        a = self.row_offsets[self.num_rows]
        b = a + len(elements)
        self.data[a:b] = elements
        self.num_rows += 1
        self.row_offsets[self.num_rows] = b

    @property
    def num_elements(self):
        return self.row_offsets[self.num_rows]

    def __getitem__(self, row):
        if row < 0 or row >= self.num_rows:
            raise IndexError("Row number out of range!")
        a = self.row_offsets[row]
        b = self.row_offsets[row + 1]
        return self.data[a:b]

    def __len__(self):
        return self.num_rows

    def __str__(self):
        return "[%s]" % ('\n'.join(str(row) for row in self),)

    @classmethod
    def from_rows(cls, rows, num_rows, num_elements, dtype):
        "Construct a CRSArray from a list of row element lists."
        crs = CRSArray(num_rows, num_elements, dtype)
        for row in rows:
            crs.push_row(row)
        return crs