This file is indexed.

/usr/lib/python2.7/dist-packages/arrayfire/bcast.py is in python-arrayfire 3.3.20160624-2.

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
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################

"""
Function to perform broadcasting operations.
"""

class _bcast(object):
    _flag = False
    def get(self):
        return _bcast._flag

    def set(self, flag):
        _bcast._flag = flag

    def toggle(self):
        _bcast._flag ^= True

_bcast_var = _bcast()

def broadcast(func, *args):
    """
    Function to perform broadcast operations.

    This function can be used directly or as an annotation in the following manner.

    Example
    -------

    Using broadcast as an annotation

    >>> import arrayfire as af
    >>> @af.broadcast
    ... def add(a, b):
    ...     return a + b
    ...
    >>> a = af.randu(2,3)
    >>> b = af.randu(2,1) # b is a different size
    >>> # Trying to add arrays of different sizes raises an exceptions
    >>> c = add(a, b) # This call does not raise an exception because of the annotation
    >>> af.display(a)
    [2 3 1 1]
        0.4107     0.9518     0.4198
        0.8224     0.1794     0.0081

    >>> af.display(b)
    [2 1 1 1]
        0.7269
        0.7104

    >>> af.display(c)
    [2 3 1 1]
        1.1377     1.6787     1.1467
        1.5328     0.8898     0.7185

    Using broadcast as function

    >>> import arrayfire as af
    >>> add = lambda a,b: a + b
    >>> a = af.randu(2,3)
    >>> b = af.randu(2,1) # b is a different size
    >>> # Trying to add arrays of different sizes raises an exceptions
    >>> c = af.broadcast(add, a, b) # This call does not raise an exception
    >>> af.display(a)
    [2 3 1 1]
        0.4107     0.9518     0.4198
        0.8224     0.1794     0.0081

    >>> af.display(b)
    [2 1 1 1]
        0.7269
        0.7104

    >>> af.display(c)
    [2 3 1 1]
        1.1377     1.6787     1.1467
        1.5328     0.8898     0.7185

    """

    def wrapper(*func_args):
        _bcast_var.toggle()
        res = func(*func_args)
        _bcast_var.toggle()
        return res

    if len(args) == 0:
        return wrapper
    else:
        return wrapper(*args)