Koma is a scientific computing library written in Kotlin, designed to allow development of cross-platform numerical applications targeting Javascript, Java (JVM), and embedded (native) platforms.

Project goals:

To get started, try the quickstart instructions below for your desired platform. After that, take a look at the functionality overview for a quick intro on what Koma provides, or the linear algebra section to see some usage examples.

Quickstart (Java)

Koma is hosted on bintray. First add the koma repository to your repo list. If using gradle:

repositories { 
    maven { 
        url "http://dl.bintray.com/kyonifer/maven" 

Now add a dependency on the core artifact:

    compile group: "koma", name:"core", version:"0.11"
    // Optional, uses EJML's optimized routines for matrix operations
    compile group: "koma", name:"backend-matrix-ejml", version: "0.11"

And we're ready to go. Lets plot a random walk:

import koma.*
import koma.extensions.*

fun main(args: Array<String>)

    // Create some normal random noise
    var a = randn(100,2)
    var b = cumsum(a)

    // Second parameter is color
    plot(a, 'b', "First Run")
    plot(a+1, 'y', "First Run Offset")
    xlabel("Time (s)")
    title("White Noise")

    plot(b, 'g') // green
    xlabel("Velocity (lightweeks/minute)")
    title("Random Walk")


Quickstart (Javascript)

To use Koma from javascript you currently have to build from source. After doing so, you should have commonjs modules in the ./node_modules/ folder. You can then use koma directly from javascript:

koma = require('koma-core').koma

m = koma.randn(3,3)


m2 = koma.ones(3,4)


Quickstart (Native)

To produce a native executable including koma you currently have to build from source. This will produce an executable called build/konan/bin/linux/komaExample.kexe which includes the koma library as well as the toy example main function defined at examples/native/main.kt.

You can run the executable directly, without any js or java runtime dependency:


You can edit the binary by making modifications to examples/native/main.kt in the source tree. See the build from source section above for instructions on building shared or static libraries.