<commit_before>package de.kleppmann.maniation.maths;

import java.text.DecimalFormat;


public class Quaternion {
    
    private double w, x, y, z, mag;
    private Quaternion inverse;
    
    private Quaternion(boolean nonsense) {}
    
    public Quaternion() {
        this.w = 1.0; this.x = 0.0; this.y = 0.0; this.z = 0.0;
        this.inverse = new Quaternion(true);
        inverse.w = 1.0; inverse.x = 0.0; inverse.y = 0.0; inverse.z = 0.0;
        inverse.inverse = this;
    }

    public Quaternion(double w, double x, double y, double z) {
        this.w = w;
        this.x = x;
        this.y = y;
        this.z = z;
        double m = w*w + x*x + y*y + z*z;
        this.inverse = new Quaternion(true);
        this.inverse.w = w/m;
        this.inverse.x = -x/m;
        this.inverse.y = -y/m;
        this.inverse.z = -z/m;
        this.inverse.inverse = this;
        this.mag = Math.sqrt(m);
    }
    
    public Quaternion(Vector3D v) {
        this.w = 0.0;
        this.x = v.getComponent(0);
        this.y = v.getComponent(1);
        this.z = v.getComponent(2);
        this.inverse = null;
    }

    public double getW() {
        return w;
    }

    public double getX() {
        return x;
    }

    public double getY() {<commit_msg>Fixed bug in inverse calculation<commit_after>package de.kleppmann.maniation.maths;

import java.text.DecimalFormat;


public class Quaternion {
    
    private double w, x, y, z, mag;
    private Quaternion inverse;
    
    private Quaternion(boolean nonsense) {}
    
    public Quaternion() {
        this.w = 1.0; this.x = 0.0; this.y = 0.0; this.z = 0.0;
        this.inverse = new Quaternion(true);
        inverse.w = 1.0; inverse.x = 0.0; inverse.y = 0.0; inverse.z = 0.0;
        inverse.inverse = this;
    }

    public Quaternion(double w, double x, double y, double z) {
        this.w = w;
        this.x = x;
        this.y = y;
        this.z = z;
        double m = w*w + x*x + y*y + z*z;
        this.mag = Math.sqrt(m);
        this.inverse = new Quaternion(true);
        this.inverse.w = w/m;
        this.inverse.x = -x/m;
        this.inverse.y = -y/m;
        this.inverse.z = -z/m;
        this.inverse.mag = 1.0/this.mag;
        this.inverse.inverse = this;
    }
    
    public Quaternion(Vector3D v) {
        this.w = 0.0;
        this.x = v.getComponent(0);
        this.y = v.getComponent(1);
        this.z = v.getComponent(2);
        this.inverse = null;
    }

    public double getW() {
        return w;
    }

    public double getX() {
        return x;
    }

    public double getY() {
{'fraction_non_alphanumeric': 0.13576923076923078, 'fraction_numerical': 0.01769230769230769, 'mean_word_length': 1.695336787564767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1680677', 'n_tokens_mistral': 981, 'n_tokens_neox': 932, 'n_words': 220}