Beispiel #1
0
    def integrate(self, *args):
        '''Integrate the product of all arguments

           **Arguments:**

           data1, data2, ...
                All arguments must be arrays with the same size as the number
                of grid points. The arrays contain the functions, evaluated
                at the grid points, that must be multiplied and integrated.

        '''
        args = [arg.ravel() for arg in args if arg is not None]
        args.append(self.weights)
        return dot_multi(*args)
Beispiel #2
0
    def integrate(self, *args):
        '''Integrate the product of all arguments

           **Arguments:**

           data1, data2, ...
                All arguments must be arrays with the same size as the number
                of grid points. The arrays contain the functions, evaluated
                at the grid points, that must be multiplied and integrated.

        '''
        args = [arg.ravel() for arg in args if arg is not None]
        args.append(self.weights)
        return dot_multi(*args)
Beispiel #3
0
    def integrate(self, *args, **kwargs):
        '''Integrate the product of all arguments

           **Arguments:**

           data1, data2, ...
                All arguments must be arrays with the same size as the number
                of grid points. The arrays contain the functions, evaluated
                at the grid points, that must be multiplied and integrated.

           **Optional arguments:**

           center=None
                When given, multipole moments are computed with respect to
                this center instead of a plain integral.

           lmax=0
                The maximum angular momentum to consider when computing multipole
                moments

           mtype=1
                The type of multipole moments: 1=``cartesian``, 2=``pure``,
                3=``radial``, 4=``surface``.

           segments=None
                This argument can be used to divide the grid in segments. When
                given, it must be an array with the number of grid points in
                each consecutive segment. The integration is then carried out
                over each segment separately and an array of results is
                returned. The sum over all elements gives back the total
                integral.
        '''
        args, multipole_args, segments = parse_args_integrate(*args, **kwargs)
        args.append(self.weights)

        if multipole_args is None:
            # regular integration
            return dot_multi(*args, segments=segments)
        else:
            # computation of multipole expansion of the integrand
            center, lmax, mtype = multipole_args
            return dot_multi_moments(args, self.points, center, lmax, mtype,
                                     segments)
Beispiel #4
0
    def integrate(self, *args, **kwargs):
        '''Integrate the product of all arguments

           **Arguments:**

           data1, data2, ...
                All arguments must be arrays with the same size as the number
                of grid points. The arrays contain the functions, evaluated
                at the grid points, that must be multiplied and integrated.

           **Optional arguments:**

           center=None
                When given, multipole moments are computed with respect to
                this center instead of a plain integral.

           lmax=0
                The maximum angular momentum to consider when computing multipole
                moments

           mtype=1
                The type of multipole moments: 1=``cartesian``, 2=``pure``,
                3=``radial``, 4=``surface``.

           segments=None
                This argument can be used to divide the grid in segments. When
                given, it must be an array with the number of grid points in
                each consecutive segment. The integration is then carried out
                over each segment separately and an array of results is
                returned. The sum over all elements gives back the total
                integral.
        '''
        args, multipole_args, segments = parse_args_integrate(*args, **kwargs)
        args.append(self.weights)

        if multipole_args is None:
            # regular integration
            return dot_multi(*args, segments=segments)
        else:
            # computation of multipole expansion of the integrand
            center, lmax, mtype = multipole_args
            return dot_multi_moments(args, self.points, center, lmax, mtype, segments)