kerncraft/kernel.py
def _calculate_relative_offset(self, name, access_dimensions):
        """
        Return the offset from the iteration center in number of elements.

        The order of indices used in access is preserved.
        """
        # TODO to be replaced with compile_global_offsets
        offset = 0
        base_dims = self.variables[name][1]

        for dim, offset_info in enumerate(access_dimensions):
            offset_type, idx_name, dim_offset = offset_info
            assert offset_type == 'rel', 'Only relative access to arrays is supported at the moment'

            if offset_type == 'rel':
                offset += self.subs_consts(
                    dim_offset*reduce(operator.mul, base_dims[dim+1:], sympy.Integer(1)))
            else:
                # should not happen
                pass

        return offset
def _calculate_relative_offset(self, name, access_dimensions):
        """
        Return the offset from the iteration center in number of elements.

        The order of indices used in access is preserved.
        """
        # TODO to be replaced with compile_global_offsets
        offset = 0
        base_dims = self.variables[name][1]

        for dim, offset_info in enumerate(access_dimensions):
            offset_type, idx_name, dim_offset = offset_info
            assert offset_type == 'rel', 'Only relative access to arrays is supported at the moment'

            if offset_type == 'rel':
                offset += self.subs_consts(
                    dim_offset*reduce(operator.mul, base_dims[dim+1:], sympy.Integer(1)))
            else:
                # should not happen
                pass

        return offset
def _calculate_relative_offset ( self , name , access_dimensions ) : # TODO to be replaced with compile_global_offsets offset = 0 base_dims = self . variables [ name ] [ 1 ] for dim , offset_info in enumerate ( access_dimensions ) : offset_type , idx_name , dim_offset = offset_info assert offset_type == 'rel' , 'Only relative access to arrays is supported at the moment' if offset_type == 'rel' : offset += self . subs_consts ( dim_offset * reduce ( operator . mul , base_dims [ dim + 1 : ] , sympy . Integer ( 1 ) ) ) else : # should not happen pass return offset
Return the offset from the iteration center in number of elements.

        The order of indices used in access is preserved.
Return the offset from the iteration center in number of elements .