<commit_before>@file:Suppress("nothing_to_inline")

package org.jetbrains.bio.viktor

import org.jetbrains.bio.viktor.NativeSpeedups.unsafeNegateInPlace
import org.jetbrains.bio.viktor.NativeSpeedups.unsafePlusScalarAssign
import org.jetbrains.bio.viktor.NativeSpeedups.unsafeScalarDivAssign

/**
 * Operator overloads for [Double] and [F64Array].
 *
 * @since 0.2.2
 */

private inline fun Double.minusInPlace(other: F64Array) {
    if (other is F64LargeDenseArray) {
        unsafeNegateInPlace(other.data, other.offset, other.size)
        unsafePlusScalarAssign(other.data, other.offset, other.size, this)
    } else {
        for (pos in 0 until other.size) {
            other.unsafeSet(pos, this - other.unsafeGet(pos))
        }
    }
}

operator fun Double.minus(other: F64Array): F64Array {
    val v = other.copy()
    minusInPlace(v.flatten())
    return v
}

inline operator fun Double.plus(other: F64Array) = other + this

inline operator fun Double.times(other: F64Array) = other * this

private inline fun Double.divInPlace(other: F64Array) {
    if (other is F64LargeDenseArray) {
        unsafeScalarDivAssign(other.data, other.offset, other.size, this)
    } else {
        for (pos in 0 until other.size) {
            other.unsafeSet(pos, this / other.unsafeGet(pos))
        }
    }
}

operator fun Double.div(other: F64Array): F64Array {
    val v = other.copy()
    divInPlace(v.flatten())
    return v
}<commit_msg>Rewritten DoubleExtensions through transform<commit_after>@file:Suppress("nothing_to_inline")

package org.jetbrains.bio.viktor

/**
 * Operator overloads for [Double] and [F64Array].
 *
 * @since 0.2.2
 */

inline operator fun Double.minus(other: F64Array): F64Array = other.transform { this - it }

inline operator fun Double.plus(other: F64Array) = other + this

inline operator fun Double.times(other: F64Array) = other * this

inline operator fun Double.div(other: F64Array): F64Array = other.transform { this / it }
{'fraction_non_alphanumeric': 0.11218765935747067, 'fraction_numerical': 0.022437531871494134, 'mean_word_length': 3.739130434782609, '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': '5627346', 'n_tokens_mistral': 663, 'n_tokens_neox': 624, 'n_words': 148}