From 590910ac2dcb0028046442ad0b740328eaecd356 Mon Sep 17 00:00:00 2001 From: therealansh Date: Sat, 5 Jun 2021 11:14:02 +0530 Subject: [PATCH] add: example and Readme --- README.md | 6 +++++ examples/build.gradle.kts | 2 ++ .../kscience/kmath/jafama/KMathaJafamaDemo.kt | 17 +++++++++++++ kmath-jafama/README.md | 24 +++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 examples/src/main/kotlin/space/kscience/kmath/jafama/KMathaJafamaDemo.kt create mode 100644 kmath-jafama/README.md diff --git a/README.md b/README.md index 7c6f7ea2b..90ab524e2 100644 --- a/README.md +++ b/README.md @@ -200,6 +200,12 @@ One can still use generic algebras though. > **Maturity**: PROTOTYPE
+* ### [kmath-jafama](kmath-jafama) +> +> +> **Maturity**: PROTOTYPE +
+ * ### [kmath-jupyter](kmath-jupyter) > > diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts index 568bde153..406b8f470 100644 --- a/examples/build.gradle.kts +++ b/examples/build.gradle.kts @@ -44,6 +44,8 @@ dependencies { implementation("org.slf4j:slf4j-simple:1.7.30") // plotting implementation("space.kscience:plotlykt-server:0.4.0") + //jafama + implementation(project(":kmath-jafama")) } kotlin.sourceSets.all { diff --git a/examples/src/main/kotlin/space/kscience/kmath/jafama/KMathaJafamaDemo.kt b/examples/src/main/kotlin/space/kscience/kmath/jafama/KMathaJafamaDemo.kt new file mode 100644 index 000000000..879aab08f --- /dev/null +++ b/examples/src/main/kotlin/space/kscience/kmath/jafama/KMathaJafamaDemo.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2018-2021 KMath contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package space.kscience.kmath.jafama + +import net.jafama.FastMath + + +fun main(){ + val a = JafamaDoubleField.number(2.0) + val b = StrictJafamaDoubleField.power(FastMath.E,a) + + println(JafamaDoubleField.add(b,a)) + println(StrictJafamaDoubleField.ln(b)) +} diff --git a/kmath-jafama/README.md b/kmath-jafama/README.md new file mode 100644 index 000000000..fab777bf4 --- /dev/null +++ b/kmath-jafama/README.md @@ -0,0 +1,24 @@ +# Module kmath-jafama + +Jafama based implementation of DoubleField of kmath-operations. + +- JafamaDoubleField : DoubleField implementation using FastMath +- StrictJafamaDoubleField - DoubleField implementation using StrictFastMath + +## Examples + +Different Operations on DoubleField + +```kotlin +package space.kscience.kmath.jafama + +import net.jafama.FastMath + + +fun main(){ + val a = JafamaDoubleField.number(2.0) + val b = StrictJafamaDoubleField.power(FastMath.E,a) + println(JafamaDoubleField.add(b,a)) + println(StrictJafamaDoubleField.ln(b)) +} +```