Kotlin

From Efficient Java Matrix Library
Jump to navigation Jump to search

EJML in Kotlin!

EJML works just fine when used in the Kotlin JVM environment. EJML also provides specialized Kotlin support in the form of Kotlin extensions. A complete list of extensions can be found on Github. This is still considered a preview feature. Suggestions and pull requests to improve the Kotlin support are most welcomed!

Kotlin

val c = H*P
val S = multTransB(c,H,null)
S += R
S_inv = S.invert()
multTransA(H,S_inv,d);
K = P*D


Java

mult(H,P,c);
multTransB(c,H,S);
addEquals(S,R);
if( !invert(S,S_inv) ) 
    throw new RuntimeException("Invert failed");
multTransA(H,S_inv,d);
mult(P,d,K);