ECOdyagnostics/operations.py
def cross(self, x, y):
        """
        Performs a cross product for two 3d vector fields.

        x and y are vector fields as a type 'list' or 'np.ndarray" of scalar fields. Matching dimensions are required.

        :param a:
        :param b:
        :return:
        """

        dims = len(x) if len(x) == len(y) else False
        if dims == False:
            raise Exception("Vectors dimensions do not match: x: %s != y:%s" % (len(x), len(y)))

        if dims != 3:
            raise Exception("Operation is only implemented for 3D vectors, but dimensions are: %s" % dims)

        c = [0] * 3
        c[0] = x[1] * y[2] - x[2] * y[1]
        c[1] = x[2] * y[0] - x[0] * y[2]
        c[2] = x[0] * y[1] - x[1] * y[0]

        if type(x) == np.ndarray and type(y) == np.ndarray:
            c = np.ndarray(c)
        return c

        Performs a cross product for two 3d vector fields.

        x and y are vector fields as a type 'list' or 'np.ndarray" of scalar fields. Matching dimensions are required.

        :param a:
        :param b:
        :return:
        
Performs a cross product for two 3d vector fields.
x and y are vector fields as a type 'list' or 'np.ndarray" of scalar fields. Matching dimensions are required.
Performs a cross product for two 3d vector fields . x and y are vector fields as a type ' list ' or ' np . ndarray " of scalar fields . Matching dimensions are required .
def cross(self, x, y):
        dims = len(x) if len(x) == len(y) else False
        if dims == False:
            raise Exception("Vectors dimensions do not match: x: %s != y:%s" % (len(x), len(y)))
        if dims != 3:
            raise Exception("Operation is only implemented for 3D vectors, but dimensions are: %s" % dims)
        c = [0] * 3
        c[0] = x[1] * y[2] - x[2] * y[1]
        c[1] = x[2] * y[0] - x[0] * y[2]
        c[2] = x[0] * y[1] - x[1] * y[0]
        if type(x) == np.ndarray and type(y) == np.ndarray:
            c = np.ndarray(c)
        return c
def cross ( self , x , y ) : dims = len ( x ) if len ( x ) == len ( y ) else False if dims == False : raise Exception ( "Vectors dimensions do not match: x: %s != y:%s" % ( len ( x ) , len ( y ) ) ) if dims != 3 : raise Exception ( "Operation is only implemented for 3D vectors, but dimensions are: %s" % dims ) c = [ 0 ] * 3 c [ 0 ] = x [ 1 ] * y [ 2 ] - x [ 2 ] * y [ 1 ] c [ 1 ] = x [ 2 ] * y [ 0 ] - x [ 0 ] * y [ 2 ] c [ 2 ] = x [ 0 ] * y [ 1 ] - x [ 1 ] * y [ 0 ] if type ( x ) == np . ndarray and type ( y ) == np . ndarray : c = np . ndarray ( c ) return c
Performs a cross product for two 3d vector fields.
Performs a cross product for two 3d vector fields .
"""
        Performs a cross product for two 3d vector fields.

        x and y are vector fields as a type 'list' or 'np.ndarray" of scalar fields. Matching dimensions are required.

        :param a:
        :param b:
        :return:
        """
None
self
x
y
a
None
b
None