<commit_before>class Vec3

    # create getter and setter for data
    attr_accessor :x,:y,:z

    # initialize class with vector
    def initialize(x=0, y=0, z=0)
        @x = x
        @y = y
        @z = z
    end

    def to_s()
        return "(#{@x},#{@y},#{@z})"
    end

    def clone()
        return Vec3.new(@x, @y, @z)
    end

    def coerce(lhs)
        [self, lhs]
    end

    def +(rhs)
        c = self.clone()
        c.x = c.x + rhs.x
        c.y = c.y + rhs.y
        c.z = c.z + rhs.z
        return c
    end

    def length()
        return self.lengthSqr ** 0.5
    end

    def lengthSqr()
        return (@x * @x) + (@y * @y)  + (@z * @z)
    end

    def *(rhs)
        c = self.clone()
        c.x = c.x * rhs
        c.y = c.y * rhs
        c.z = c.z * rhs
        return c
    end

    def -@
        return Vec3.new(-@x, -@y, -@z)
    end

    def -(rhs)
        return self.+(-rhs)
    end

    def ==(rhs)
        dx = @x - rhs.x
        if dx != 0 then return dx end
        dy = @y - rhs.y
        if dy != 0 then return dy end
        dz = @z - rhs.z
        if dz != 0 then return dz end
        return 0
    end
end
<commit_msg>Bug Fix to operator definitions<commit_after>class Vec3

    # create getter and setter for data
    attr_accessor :x,:y,:z

    # initialize class with vector
    def initialize(x=0, y=0, z=0)
        @x = x
        @y = y
        @z = z
    end

    def to_s()
        return "(#{@x},#{@y},#{@z})"
    end

    def clone()
        return Vec3.new(@x, @y, @z)
    end

    def coerce(lhs)
        [self, lhs]
    end

    def +(rhs)
        c = self.clone()
        c.x = c.x + rhs.x
        c.y = c.y + rhs.y
        c.z = c.z + rhs.z
        return c
    end

    def length()
        return self.lengthSqr ** 0.5
    end

    def lengthSqr()
        return (@x * @x) + (@y * @y)  + (@z * @z)
    end

    def *(rhs)
        c = self.clone()
        c.x = c.x * rhs
        c.y = c.y * rhs
        c.z = c.z * rhs
        return c
    end

    def -@
        return Vec3.new(-@x, -@y, -@z)
    end

    def -(rhs)
        return self.+(-rhs)
    end

    def <=>(rhs)
        dx = @x - rhs.x
        if dx != 0 then return dx end
        dy = @y - rhs.y
        if dy != 0 then return dy end
        dz = @z - rhs.z
        if dz != 0 then return dz end
        return 0
    end
end

{'fraction_non_alphanumeric': 0.14237144071398214, 'fraction_numerical': 0.010199745006374841, 'mean_word_length': 1.1897674418604651, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3336448', 'n_tokens_mistral': 934, 'n_tokens_neox': 904, 'n_words': 278}