2021-06-05 11:14:02 +05:30
# Module kmath-jafama
2021-06-14 21:51:06 +07:00
Integration with [Jafama ](https://github.com/jeffhain/jafama ).
2021-06-05 11:14:02 +05:30
2021-06-14 21:51:06 +07:00
- [jafama-double ](src/main/kotlin/space/kscience/kmath/jafama/ ) : Double ExtendedField implementations based on Jafama
2021-06-05 11:14:02 +05:30
2021-06-14 21:51:06 +07:00
## Artifact:
2021-06-05 11:14:02 +05:30
2022-07-24 12:01:02 +03:00
The Maven coordinates of this project are `space.kscience:kmath-jafama:0.3.1-dev-1` .
2021-06-14 21:51:06 +07:00
2022-04-01 02:23:34 +07:00
**Gradle Groovy:**
```groovy
2021-06-14 21:51:06 +07:00
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
2022-07-24 12:01:02 +03:00
implementation 'space.kscience:kmath-jafama:0.3.1-dev-1'
2021-06-14 21:51:06 +07:00
}
```
**Gradle Kotlin DSL:**
2021-06-05 11:14:02 +05:30
```kotlin
2021-06-14 21:51:06 +07:00
repositories {
maven("https://repo.kotlin.link")
mavenCentral()
}
dependencies {
2022-07-24 12:01:02 +03:00
implementation("space.kscience:kmath-jafama:0.3.1-dev-1")
2021-06-14 21:51:06 +07:00
}
```
2021-06-05 11:14:02 +05:30
2021-06-14 21:51:06 +07:00
## Example usage
2021-06-05 11:14:02 +05:30
2021-06-14 21:51:06 +07:00
All the `DoubleField` uses can be replaced with `JafamaDoubleField` or `StrictJafamaDoubleField` .
2021-06-05 11:14:02 +05:30
2021-06-14 21:51:06 +07:00
```kotlin
import space.kscience.kmath.jafama.*
import space.kscience.kmath.operations.*
fun main() {
val a = 2.0
val b = StrictJafamaDoubleField { exp(a) }
println(JafamaDoubleField { b + a })
println(StrictJafamaDoubleField { ln(b) })
2021-06-05 11:14:02 +05:30
}
```
2021-06-08 19:28:34 +05:30
2021-06-14 21:51:06 +07:00
## Performance
2021-06-15 13:18:40 +07:00
According to KMath benchmarks on GraalVM, Jafama functions are slower than JDK math; however, there are indications that on Hotspot Jafama is a bit faster.
2021-06-14 21:51:06 +07:00
2021-05-07 19:59:21 +07:00
> **Can't find appropriate benchmark data. Try generating readme files after running benchmarks**.