<commit_before>//
//  CATransform3D+float3x3.swift
//  Pods
//
//  Created by <NAME> on 2/21/16.
//
//

import simd

extension Vector3Type {
    static let one = Vector3Type(.one)
    static let zero = Vector3Type(0)
    static let lastIndex = Vector3Type().endIndex - 1
    static let indexSlice = 0...Vector3Type.lastIndex
    static let indexArray = Array(Vector3Type.indexSlice)
}

extension ScalarType {
    static let one = ScalarType(1)
}

extension Matrix4x3Type {
    static let zeroColumnBeforeLast: Matrix4x3Type =  {
        let identity = Matrix3x3Type(diagonal: .one)
        var columns = Vector3Type.indexArray.map {identity[$0]}
        columns.insert(.zero, at: Vector3Type.lastIndex)
        return .init(columns)
    }()
}

extension Matrix3x4Type {
    static let zeroRowBeforeLast: Matrix3x4Type = Matrix4x3Type.zeroColumnBeforeLast.transpose

    func insertColumnBeforeLast() -> Matrix4x4Type {
        return self * .zeroColumnBeforeLast
    }
}

extension Matrix3x3Type {
    func insertRowBeforeLast() -> Matrix3x4Type {
        return .zeroRowBeforeLast * self
    }
<commit_msg>add ASCII comments to visualize matrices<commit_after>//
//  CATransform3D+float3x3.swift
//  Pods
//
//  Created by <NAME> on 2/21/16.
//
//

import simd

extension Vector3Type {
    static let one = Vector3Type(.one)
    static let zero = Vector3Type(0)
    static let lastIndex = Vector3Type().endIndex - 1
    static let indexSlice = 0...Vector3Type.lastIndex
    static let indexArray = Array(Vector3Type.indexSlice)
}

extension ScalarType {
    static let one = ScalarType(1)
}

extension Matrix4x3Type {
    /**~~~
    1 0 0 0
    0 1 0 0
    0 0 0 1
     */
    static let zeroColumnBeforeLast: Matrix4x3Type =  {
        let identity = Matrix3x3Type(diagonal: .one)
        var columns = Vector3Type.indexArray.map {identity[$0]}
        columns.insert(.zero, at: Vector3Type.lastIndex)
        return .init(columns)
    }()
}

extension Matrix3x4Type {
    /**~~~
     1 0 0
     0 1 0
     0 0 0
     0 0 1
     */
    static let zeroRowBeforeLast: Matrix3x4Type = Matrix4x3Type.zeroColumnBeforeLast.transpose

    func insertColumnBeforeLast() -> Matrix4x4Type {
        return self * .zeroColumnBeforeLast
    }
}

extension Matrix3x3Type {
    func insertRowBeforeLast() -> Matrix3x4Type {
        return .zeroRowBeforeLast * self
    }

    /**~~~
     m11 m12 m13          m11/m33 m12/m33 0 m13/m33
     m21 m22 m23    =>    m21/m33 m22/m33 0 m23/m33
     m31 m32 m33             0       0    1    0
                          m31/m33 m32/m33 0    1
     */
{'fraction_non_alphanumeric': 0.09534883720930233, 'fraction_numerical': 0.06201550387596899, 'mean_word_length': 2.450534759358289, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4096932', 'n_tokens_mistral': 926, 'n_tokens_neox': 849, 'n_words': 212}