Skip to content

Instantly share code, notes, and snippets.

View enzo-santos's full-sized avatar
🦧

Enzo Santos enzo-santos

🦧
View GitHub Profile
@enzo-santos
enzo-santos / Statistics.kt
Created June 23, 2020 04:12
Kotlin snippets
import kotlin.math.*
/**
* Returns [num] evenly spaced samples, calculated over the interval [0, [max]].
*/
fun linspace(num: Int, max: Double): DoubleArray
= DoubleArray(num) { it * max / (num - 1.0) }
/**
* Returns a sequence of numbers starting from [start], incrementing by [stop] and stopping before [stop].