scientifik -> kscience

This commit is contained in:
Alexander Nozik 2020-09-20 22:39:27 +03:00
parent da742d6c69
commit 28190f9800
176 changed files with 599 additions and 620 deletions

View File

@ -3,7 +3,7 @@
![Gradle build](https://github.com/mipt-npm/kmath/workflows/Gradle%20build/badge.svg)
Bintray: [ ![Download](https://api.bintray.com/packages/mipt-npm/scientifik/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/scientifik/kmath-core/_latestVersion)
Bintray: [ ![Download](https://api.bintray.com/packages/mipt-npm/kscience/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/kscience/kmath-core/_latestVersion)
Bintray-dev: [ ![Download](https://api.bintray.com/packages/mipt-npm/dev/kmath-core/images/download.svg) ](https://bintray.com/mipt-npm/dev/kmath-core/_latestVersion)
@ -80,12 +80,12 @@ Release artifacts are accessible from bintray with following configuration (see
```kotlin
repositories{
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/kscience")
}
dependencies{
api("scientifik:kmath-core:${kmathVersion}")
//api("scientifik:kmath-core-jvm:${kmathVersion}") for jvm-specific version
api("kscience.kmath:kmath-core:${kmathVersion}")
//api("kscience.kmath:kmath-core-jvm:${kmathVersion}") for jvm-specific version
}
```

View File

@ -5,7 +5,7 @@ operation, say `+`, one needs two objects of a type `T` and an algebra context,
say `Space<T>`. Next one needs to run the actual operation in the context:
```kotlin
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
val a: T = ...
val b: T = ...
@ -47,7 +47,7 @@ but it also holds reference to the `ComplexField` singleton, which allows perfor
numbers without explicit involving the context like:
```kotlin
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
// Using elements
val c1 = Complex(1.0, 1.0)
@ -82,7 +82,7 @@ operations in all performance-critical places. The performance of element operat
KMath submits both contexts and elements for builtin algebraic structures:
```kotlin
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField.i
@ -95,7 +95,7 @@ val c3 = ComplexField { c1 + c2 }
Also, `ComplexField` features special operations to mix complex and real numbers, for example:
```kotlin
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
val c1 = Complex(1.0, 2.0)
val c2 = ComplexField { c1 - 1.0 } // Returns: Complex(re=0.0, im=2.0)

View File

@ -10,7 +10,7 @@ plugins {
allOpen.annotation("org.openjdk.jmh.annotations.State")
repositories {
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev")
maven("https://dl.bintray.com/kotlin/kotlin-dev/")
mavenCentral()

View File

@ -0,0 +1,39 @@
package kscience.kmath.structures
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import java.nio.IntBuffer
@State(Scope.Benchmark)
class ArrayBenchmark {
@Benchmark
fun benchmarkArrayRead() {
var res = 0
for (i in 1.._root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size) res += _root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.array[_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size - i]
}
@Benchmark
fun benchmarkBufferRead() {
var res = 0
for (i in 1.._root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size) res += _root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.arrayBuffer.get(
_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size - i)
}
@Benchmark
fun nativeBufferRead() {
var res = 0
for (i in 1.._root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size) res += _root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.nativeBuffer.get(
_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size - i)
}
companion object {
const val size: Int = 1000
val array: IntArray = IntArray(_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size) { it }
val arrayBuffer: IntBuffer = IntBuffer.wrap(_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.array)
val nativeBuffer: IntBuffer = IntBuffer.allocate(_root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size).also {
for (i in 0 until _root_ide_package_.kscience.kmath.structures.ArrayBenchmark.Companion.size) it.put(i, i)
}
}
}

View File

@ -1,10 +1,10 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kscience.kmath.operations.Complex
import kscience.kmath.operations.complex
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.complex
@State(Scope.Benchmark)
class BufferBenchmark {

View File

@ -1,10 +1,10 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kscience.kmath.operations.RealField
import kscience.kmath.operations.invoke
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
@State(Scope.Benchmark)
class NDFieldBenchmark {

View File

@ -1,12 +1,12 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kscience.kmath.operations.RealField
import kscience.kmath.operations.invoke
import kscience.kmath.viktor.ViktorNDField
import org.jetbrains.bio.viktor.F64Array
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import scientifik.kmath.viktor.ViktorNDField
@State(Scope.Benchmark)
class ViktorBenchmark {

View File

@ -1,4 +1,4 @@
package scientifik.kmath.utils
package kscience.kmath.utils
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View File

@ -1,37 +0,0 @@
package scientifik.kmath.structures
import org.openjdk.jmh.annotations.Benchmark
import org.openjdk.jmh.annotations.Scope
import org.openjdk.jmh.annotations.State
import java.nio.IntBuffer
@State(Scope.Benchmark)
class ArrayBenchmark {
@Benchmark
fun benchmarkArrayRead() {
var res = 0
for (i in 1..size) res += array[size - i]
}
@Benchmark
fun benchmarkBufferRead() {
var res = 0
for (i in 1..size) res += arrayBuffer.get(size - i)
}
@Benchmark
fun nativeBufferRead() {
var res = 0
for (i in 1..size) res += nativeBuffer.get(size - i)
}
companion object {
const val size: Int = 1000
val array: IntArray = IntArray(size) { it }
val arrayBuffer: IntBuffer = IntBuffer.wrap(array)
val nativeBuffer: IntBuffer = IntBuffer.allocate(size).also {
for (i in 0 until size) it.put(i, i)
}
}
}

View File

@ -1,11 +1,11 @@
//package scientifik.kmath.ast
//package kscience.kmath.ast
//
//import scientifik.kmath.asm.compile
//import scientifik.kmath.expressions.Expression
//import scientifik.kmath.expressions.expressionInField
//import scientifik.kmath.expressions.invoke
//import scientifik.kmath.operations.Field
//import scientifik.kmath.operations.RealField
//import kscience.kmath.asm.compile
//import kscience.kmath.expressions.Expression
//import kscience.kmath.expressions.expressionInField
//import kscience.kmath.expressions.invoke
//import kscience.kmath.operations.Field
//import kscience.kmath.operations.RealField
//import kotlin.random.Random
//import kotlin.system.measureTimeMillis
//

View File

@ -1,12 +1,12 @@
package scientifik.kmath.commons.prob
package kscience.kmath.commons.prob
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import kscience.kmath.chains.BlockingRealChain
import kscience.kmath.prob.*
import org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler
import org.apache.commons.rng.simple.RandomSource
import scientifik.kmath.chains.BlockingRealChain
import scientifik.kmath.prob.*
import java.time.Duration
import java.time.Instant

View File

@ -1,11 +1,11 @@
package scientifik.kmath.commons.prob
package kscience.kmath.commons.prob
import kotlinx.coroutines.runBlocking
import scientifik.kmath.chains.Chain
import scientifik.kmath.chains.collectWithState
import scientifik.kmath.prob.Distribution
import scientifik.kmath.prob.RandomGenerator
import scientifik.kmath.prob.normal
import kscience.kmath.chains.Chain
import kscience.kmath.chains.collectWithState
import kscience.kmath.prob.Distribution
import kscience.kmath.prob.RandomGenerator
import kscience.kmath.prob.normal
data class AveragingChainState(var num: Int = 0, var value: Double = 0.0)

View File

@ -1,4 +1,4 @@
package scientifik.kmath.operations
package kscience.kmath.operations
fun main() {
val res = BigIntField {

View File

@ -1,8 +1,8 @@
package scientifik.kmath.operations
package kscience.kmath.operations
import scientifik.kmath.structures.NDElement
import scientifik.kmath.structures.NDField
import scientifik.kmath.structures.complex
import kscience.kmath.structures.NDElement
import kscience.kmath.structures.NDField
import kscience.kmath.structures.complex
fun main() {
val element = NDElement.complex(2, 2) { index: IntArray ->

View File

@ -1,9 +1,9 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.linear.transpose
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import scientifik.kmath.operations.invoke
import kscience.kmath.linear.transpose
import kscience.kmath.operations.Complex
import kscience.kmath.operations.ComplexField
import kscience.kmath.operations.invoke
import kotlin.system.measureTimeMillis
fun main() {

View File

@ -1,8 +1,8 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlinx.coroutines.GlobalScope
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import kscience.kmath.operations.RealField
import kscience.kmath.operations.invoke
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.system.measureTimeMillis

View File

@ -1,4 +1,4 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlin.system.measureTimeMillis

View File

@ -1,4 +1,4 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlin.system.measureTimeMillis

View File

@ -1,10 +1,10 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.dimensions.D2
import scientifik.kmath.dimensions.D3
import scientifik.kmath.dimensions.DMatrixContext
import scientifik.kmath.dimensions.Dimension
import scientifik.kmath.operations.RealField
import kscience.kmath.dimensions.D2
import kscience.kmath.dimensions.D3
import kscience.kmath.dimensions.DMatrixContext
import kscience.kmath.dimensions.Dimension
import kscience.kmath.operations.RealField
fun DMatrixContext<Double, RealField>.simple() {
val m1 = produce<D2, D3> { i, j -> (i + j).toDouble() }

View File

@ -8,32 +8,32 @@ This subproject implements the following features:
- Evaluating expressions by traversing MST.
> #### Artifact:
> This module is distributed in the artifact `scientifik:kmath-ast:0.1.4-dev-8`.
> This module is distributed in the artifact `kscience.kmath:kmath-ast:0.1.4-dev-8`.
>
> **Gradle:**
>
> ```gradle
> repositories {
> maven { url 'https://dl.bintray.com/mipt-npm/scientifik' }
> maven { url 'https://dl.bintray.com/mipt-npm/kscience' }
> maven { url 'https://dl.bintray.com/mipt-npm/dev' }
> maven { url https://dl.bintray.com/hotkeytlt/maven' }
> }
>
> dependencies {
> implementation 'scientifik:kmath-ast:0.1.4-dev-8'
> implementation 'kscience.kmath:kmath-ast:0.1.4-dev-8'
> }
> ```
> **Gradle Kotlin DSL:**
>
> ```kotlin
> repositories {
> maven("https://dl.bintray.com/mipt-npm/scientifik")
> maven("https://dl.bintray.com/mipt-npm/kscience")
> maven("https://dl.bintray.com/mipt-npm/dev")
> maven("https://dl.bintray.com/hotkeytlt/maven")
> }
>
> dependencies {
> implementation("scientifik:kmath-ast:0.1.4-dev-8")
> implementation("kscience.kmath:kmath-ast:0.1.4-dev-8")
> }
> ```
>
@ -52,12 +52,12 @@ RealField.mstInField { symbol("x") + 2 }.compile()
… leads to generation of bytecode, which can be decompiled to the following Java class:
```java
package scientifik.kmath.asm.generated;
package kscience.kmath.asm.generated;
import java.util.Map;
import scientifik.kmath.asm.internal.MapIntrinsics;
import scientifik.kmath.expressions.Expression;
import scientifik.kmath.operations.RealField;
import kscience.kmath.asm.internal.MapIntrinsics;
import kscience.kmath.expressions.Expression;
import kscience.kmath.operations.RealField;
public final class AsmCompiledExpression_1073786867_0 implements Expression<Double> {
private final RealField algebra;

View File

@ -1,8 +1,8 @@
package scientifik.kmath.ast
package kscience.kmath.ast
import scientifik.kmath.operations.Algebra
import scientifik.kmath.operations.NumericAlgebra
import scientifik.kmath.operations.RealField
import kscience.kmath.operations.Algebra
import kscience.kmath.operations.NumericAlgebra
import kscience.kmath.operations.RealField
/**
* A Mathematical Syntax Tree node for mathematical expressions.

View File

@ -1,6 +1,6 @@
package scientifik.kmath.ast
package kscience.kmath.ast
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
/**
* [Algebra] over [MST] nodes.

View File

@ -1,7 +1,7 @@
package scientifik.kmath.ast
package kscience.kmath.ast
import scientifik.kmath.expressions.*
import scientifik.kmath.operations.*
import kscience.kmath.expressions.*
import kscience.kmath.operations.*
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View File

@ -1,13 +1,13 @@
package scientifik.kmath.asm
package kscience.kmath.asm
import scientifik.kmath.asm.internal.AsmBuilder
import scientifik.kmath.asm.internal.MstType
import scientifik.kmath.asm.internal.buildAlgebraOperationCall
import scientifik.kmath.asm.internal.buildName
import scientifik.kmath.ast.MST
import scientifik.kmath.ast.MstExpression
import scientifik.kmath.expressions.Expression
import scientifik.kmath.operations.Algebra
import kscience.kmath.asm.internal.AsmBuilder
import kscience.kmath.asm.internal.MstType
import kscience.kmath.asm.internal.buildAlgebraOperationCall
import kscience.kmath.asm.internal.buildName
import kscience.kmath.ast.MST
import kscience.kmath.ast.MstExpression
import kscience.kmath.expressions.Expression
import kscience.kmath.operations.Algebra
import kotlin.reflect.KClass
/**

View File

@ -1,13 +1,13 @@
package scientifik.kmath.asm.internal
package kscience.kmath.asm.internal
import kscience.kmath.asm.internal.AsmBuilder.ClassLoader
import kscience.kmath.ast.MST
import kscience.kmath.expressions.Expression
import kscience.kmath.operations.Algebra
import kscience.kmath.operations.NumericAlgebra
import org.objectweb.asm.*
import org.objectweb.asm.Opcodes.*
import org.objectweb.asm.commons.InstructionAdapter
import scientifik.kmath.asm.internal.AsmBuilder.ClassLoader
import scientifik.kmath.ast.MST
import scientifik.kmath.expressions.Expression
import scientifik.kmath.operations.Algebra
import scientifik.kmath.operations.NumericAlgebra
import java.util.*
import java.util.stream.Collectors
import kotlin.reflect.KClass
@ -564,6 +564,6 @@ internal class AsmBuilder<T> internal constructor(
/**
* ASM type for MapIntrinsics.
*/
internal val MAP_INTRINSICS_TYPE: Type by lazy { Type.getObjectType("scientifik/kmath/asm/internal/MapIntrinsics") }
internal val MAP_INTRINSICS_TYPE: Type by lazy { Type.getObjectType("kscience/kmath/asm/internal/MapIntrinsics") }
}
}

View File

@ -1,6 +1,6 @@
package scientifik.kmath.asm.internal
package kscience.kmath.asm.internal
import scientifik.kmath.ast.MST
import kscience.kmath.ast.MST
/**
* Represents types known in [MST], numbers and general values.

View File

@ -1,14 +1,14 @@
package scientifik.kmath.asm.internal
package kscience.kmath.asm.internal
import kscience.kmath.ast.MST
import kscience.kmath.expressions.Expression
import kscience.kmath.operations.Algebra
import kscience.kmath.operations.FieldOperations
import kscience.kmath.operations.RingOperations
import kscience.kmath.operations.SpaceOperations
import org.objectweb.asm.*
import org.objectweb.asm.Opcodes.INVOKEVIRTUAL
import org.objectweb.asm.commons.InstructionAdapter
import scientifik.kmath.ast.MST
import scientifik.kmath.expressions.Expression
import scientifik.kmath.operations.Algebra
import scientifik.kmath.operations.FieldOperations
import scientifik.kmath.operations.RingOperations
import scientifik.kmath.operations.SpaceOperations
import java.lang.reflect.Method
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
@ -76,7 +76,7 @@ internal fun MethodVisitor.label(): Label = Label().also { visitLabel(it) }
* @author Iaroslav Postovalov
*/
internal tailrec fun buildName(mst: MST, collision: Int = 0): String {
val name = "scientifik.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision"
val name = "kscience.kmath.asm.generated.AsmCompiledExpression_${mst.hashCode()}_$collision"
try {
Class.forName(name)

View File

@ -1,6 +1,6 @@
@file:JvmName("MapIntrinsics")
package scientifik.kmath.asm.internal
package kscience.kmath.asm.internal
/**
* Gets value with given [key] or throws [IllegalStateException] whenever it is not present.

View File

@ -1,4 +1,4 @@
package scientifik.kmath.ast
package kscience.kmath.ast
import com.github.h0tk3y.betterParse.combinators.*
import com.github.h0tk3y.betterParse.grammar.Grammar
@ -10,10 +10,10 @@ import com.github.h0tk3y.betterParse.lexer.TokenMatch
import com.github.h0tk3y.betterParse.lexer.regexToken
import com.github.h0tk3y.betterParse.parser.ParseResult
import com.github.h0tk3y.betterParse.parser.Parser
import scientifik.kmath.operations.FieldOperations
import scientifik.kmath.operations.PowerOperations
import scientifik.kmath.operations.RingOperations
import scientifik.kmath.operations.SpaceOperations
import kscience.kmath.operations.FieldOperations
import kscience.kmath.operations.PowerOperations
import kscience.kmath.operations.RingOperations
import kscience.kmath.operations.SpaceOperations
/**
* TODO move to common after IR version is released

View File

@ -1,12 +1,12 @@
package scietifik.kmath.asm
import scientifik.kmath.asm.compile
import scientifik.kmath.ast.mstInField
import scientifik.kmath.ast.mstInRing
import scientifik.kmath.ast.mstInSpace
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.ByteRing
import scientifik.kmath.operations.RealField
import kscience.kmath.asm.compile
import kscience.kmath.ast.mstInField
import kscience.kmath.ast.mstInRing
import kscience.kmath.ast.mstInSpace
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.ByteRing
import kscience.kmath.operations.RealField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,10 +1,10 @@
package scietifik.kmath.asm
import scientifik.kmath.asm.compile
import scientifik.kmath.ast.mstInField
import scientifik.kmath.ast.mstInSpace
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.RealField
import kscience.kmath.asm.compile
import kscience.kmath.ast.mstInField
import kscience.kmath.ast.mstInSpace
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.RealField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,9 +1,9 @@
package scietifik.kmath.asm
import scientifik.kmath.asm.compile
import scientifik.kmath.ast.mstInField
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.RealField
import kscience.kmath.asm.compile
import kscience.kmath.ast.mstInField
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.RealField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,8 +1,8 @@
package scietifik.kmath.asm
import scientifik.kmath.ast.mstInRing
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.ByteRing
import kscience.kmath.ast.mstInRing
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.ByteRing
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

View File

@ -1,12 +1,12 @@
package scietifik.kmath.ast
import scientifik.kmath.asm.compile
import scientifik.kmath.asm.expression
import scientifik.kmath.ast.mstInField
import scientifik.kmath.ast.parseMath
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import kscience.kmath.asm.compile
import kscience.kmath.asm.expression
import kscience.kmath.ast.mstInField
import kscience.kmath.ast.parseMath
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.Complex
import kscience.kmath.operations.ComplexField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,9 +1,9 @@
package scietifik.kmath.ast
import scientifik.kmath.ast.evaluate
import scientifik.kmath.ast.parseMath
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.RealField
import kscience.kmath.ast.evaluate
import kscience.kmath.ast.parseMath
import kscience.kmath.operations.Field
import kscience.kmath.operations.RealField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,13 +1,13 @@
package scietifik.kmath.ast
import scientifik.kmath.ast.evaluate
import scientifik.kmath.ast.mstInField
import scientifik.kmath.ast.parseMath
import scientifik.kmath.expressions.invoke
import scientifik.kmath.operations.Algebra
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import scientifik.kmath.operations.RealField
import kscience.kmath.ast.evaluate
import kscience.kmath.ast.mstInField
import kscience.kmath.ast.parseMath
import kscience.kmath.expressions.invoke
import kscience.kmath.operations.Algebra
import kscience.kmath.operations.Complex
import kscience.kmath.operations.ComplexField
import kscience.kmath.operations.RealField
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,11 +1,11 @@
package scientifik.kmath.commons.expressions
package kscience.kmath.commons.expressions
import kscience.kmath.expressions.Expression
import kscience.kmath.expressions.ExpressionAlgebra
import kscience.kmath.operations.ExtendedField
import kscience.kmath.operations.Field
import kscience.kmath.operations.invoke
import org.apache.commons.math3.analysis.differentiation.DerivativeStructure
import scientifik.kmath.expressions.Expression
import scientifik.kmath.expressions.ExpressionAlgebra
import scientifik.kmath.operations.ExtendedField
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.invoke
import kotlin.properties.ReadOnlyProperty
/**

View File

@ -1,9 +1,9 @@
package scientifik.kmath.commons.linear
package kscience.kmath.commons.linear
import kscience.kmath.linear.*
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.NDStructure
import org.apache.commons.math3.linear.*
import scientifik.kmath.linear.*
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.NDStructure
public class CMMatrix(public val origin: RealMatrix, features: Set<MatrixFeature>? = null) :
FeaturedMatrix<Double> {

View File

@ -1,8 +1,8 @@
package scientifik.kmath.commons.linear
package kscience.kmath.commons.linear
import kscience.kmath.linear.Point
import kscience.kmath.structures.Matrix
import org.apache.commons.math3.linear.*
import scientifik.kmath.linear.Point
import scientifik.kmath.structures.Matrix
public enum class CMDecomposition {
LUP,

View File

@ -1,6 +1,6 @@
package scientifik.kmath.commons.random
package kscience.kmath.commons.random
import scientifik.kmath.prob.RandomGenerator
import kscience.kmath.prob.RandomGenerator
public class CMRandomGeneratorWrapper(public val factory: (IntArray) -> RandomGenerator) :
org.apache.commons.math3.random.RandomGenerator {

View File

@ -1,13 +1,13 @@
package scientifik.kmath.commons.transform
package kscience.kmath.commons.transform
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kscience.kmath.operations.Complex
import kscience.kmath.streaming.chunked
import kscience.kmath.streaming.spread
import kscience.kmath.structures.*
import org.apache.commons.math3.transform.*
import scientifik.kmath.operations.Complex
import scientifik.kmath.streaming.chunked
import scientifik.kmath.streaming.spread
import scientifik.kmath.structures.*
/**

View File

@ -1,6 +1,6 @@
package scientifik.kmath.commons.expressions
package kscience.kmath.commons.expressions
import scientifik.kmath.expressions.invoke
import kscience.kmath.expressions.invoke
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract
import kotlin.test.Test

View File

@ -10,31 +10,31 @@ The core features of KMath:
- Automatic differentiation.
> #### Artifact:
> This module is distributed in the artifact `scientifik:kmath-core:0.1.4-dev-8`.
> This module is distributed in the artifact `kscience.kmath:kmath-core:0.1.4-dev-8`.
>
> **Gradle:**
>
> ```gradle
> repositories {
> maven { url 'https://dl.bintray.com/mipt-npm/scientifik' }
> maven { url 'https://dl.bintray.com/mipt-npm/kscience' }
> maven { url 'https://dl.bintray.com/mipt-npm/dev' }
> maven { url https://dl.bintray.com/hotkeytlt/maven' }
> }
>
> dependencies {
> implementation 'scientifik:kmath-core:0.1.4-dev-8'
> implementation 'kscience.kmath:kmath-core:0.1.4-dev-8'
> }
> ```
> **Gradle Kotlin DSL:**
>
> ```kotlin
> repositories {
> maven("https://dl.bintray.com/mipt-npm/scientifik")
> maven("https://dl.bintray.com/mipt-npm/kscience")
> maven("https://dl.bintray.com/mipt-npm/dev")
> maven("https://dl.bintray.com/hotkeytlt/maven")
> }
>
> dependencies {``
> implementation("scientifik:kmath-core:0.1.4-dev-8")
> dependencies {
> implementation("kscience.kmath:kmath-core:0.1.4-dev-8")
> }
> ```

View File

@ -1,6 +1,6 @@
package scientifik.kmath.domains
package kscience.kmath.domains
import scientifik.kmath.linear.Point
import kscience.kmath.linear.Point
/**
* A simple geometric domain.

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package scientifik.kmath.domains
package kscience.kmath.domains
import scientifik.kmath.linear.Point
import scientifik.kmath.structures.RealBuffer
import scientifik.kmath.structures.indices
import kscience.kmath.linear.Point
import kscience.kmath.structures.RealBuffer
import kscience.kmath.structures.indices
/**
*

View File

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package scientifik.kmath.domains
package kscience.kmath.domains
import scientifik.kmath.linear.Point
import kscience.kmath.linear.Point
/**
* n-dimensional volume

View File

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package scientifik.kmath.domains
package kscience.kmath.domains
import scientifik.kmath.linear.Point
import kscience.kmath.linear.Point
public class UnconstrainedDomain(public override val dimension: Int) : RealDomain {
public override operator fun contains(point: Point<Double>): Boolean = true

View File

@ -1,7 +1,7 @@
package scientifik.kmath.domains
package kscience.kmath.domains
import scientifik.kmath.linear.Point
import scientifik.kmath.structures.asBuffer
import kscience.kmath.linear.Point
import kscience.kmath.structures.asBuffer
public inline class UnivariateDomain(public val range: ClosedFloatingPointRange<Double>) : RealDomain {
public override val dimension: Int

View File

@ -1,6 +1,6 @@
package scientifik.kmath.expressions
package kscience.kmath.expressions
import scientifik.kmath.operations.Algebra
import kscience.kmath.operations.Algebra
/**
* An elementary function that could be invoked on a map of arguments

View File

@ -1,6 +1,6 @@
package scientifik.kmath.expressions
package kscience.kmath.expressions
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
internal class FunctionalUnaryOperation<T>(val context: Algebra<T>, val name: String, private val expr: Expression<T>) :
Expression<T> {

View File

@ -1,9 +1,9 @@
package scientifik.kmath.expressions
package kscience.kmath.expressions
import scientifik.kmath.operations.ExtendedField
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.Space
import kscience.kmath.operations.ExtendedField
import kscience.kmath.operations.Field
import kscience.kmath.operations.Ring
import kscience.kmath.operations.Space
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View File

@ -1,8 +1,8 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.Ring
import scientifik.kmath.structures.*
import kscience.kmath.operations.RealField
import kscience.kmath.operations.Ring
import kscience.kmath.structures.*
/**
* Basic implementation of Matrix space based on [NDStructure]

View File

@ -1,10 +1,9 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.operations.Ring
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.Structure2D
import scientifik.kmath.structures.asBuffer
import kotlin.contracts.contract
import kscience.kmath.operations.Ring
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.Structure2D
import kscience.kmath.structures.asBuffer
import kotlin.math.sqrt
/**

View File

@ -1,13 +1,12 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.invoke
import scientifik.kmath.structures.BufferAccessor2D
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.Structure2D
import kotlin.contracts.contract
import kscience.kmath.operations.Field
import kscience.kmath.operations.RealField
import kscience.kmath.operations.Ring
import kscience.kmath.operations.invoke
import kscience.kmath.structures.BufferAccessor2D
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.Structure2D
import kotlin.reflect.KClass
/**

View File

@ -1,8 +1,8 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.structures.Buffer
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.VirtualBuffer
import kscience.kmath.structures.Buffer
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.VirtualBuffer
public typealias Point<T> = Buffer<T>

View File

@ -1,9 +1,9 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.structures.Buffer
import scientifik.kmath.structures.BufferFactory
import scientifik.kmath.structures.Structure2D
import scientifik.kmath.structures.asBuffer
import kscience.kmath.structures.Buffer
import kscience.kmath.structures.BufferFactory
import kscience.kmath.structures.Structure2D
import kscience.kmath.structures.asBuffer
public class MatrixBuilder(public val rows: Int, public val columns: Int) {
public operator fun <T : Any> invoke(vararg elements: T): FeaturedMatrix<T> {

View File

@ -1,13 +1,13 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.SpaceOperations
import scientifik.kmath.operations.invoke
import scientifik.kmath.operations.sum
import scientifik.kmath.structures.Buffer
import scientifik.kmath.structures.BufferFactory
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.asSequence
import kscience.kmath.operations.Ring
import kscience.kmath.operations.SpaceOperations
import kscience.kmath.operations.invoke
import kscience.kmath.operations.sum
import kscience.kmath.structures.Buffer
import kscience.kmath.structures.BufferFactory
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.asSequence
/**
* Basic operations on matrices. Operates on [Matrix]

View File

@ -1,4 +1,4 @@
package scientifik.kmath.linear
package kscience.kmath.linear
/**
* A marker interface representing some matrix feature like diagonal, sparse, zero, etc. Features used to optimize matrix

View File

@ -1,10 +1,10 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
import scientifik.kmath.structures.Buffer
import scientifik.kmath.structures.BufferFactory
import kscience.kmath.operations.RealField
import kscience.kmath.operations.Space
import kscience.kmath.operations.invoke
import kscience.kmath.structures.Buffer
import kscience.kmath.structures.BufferFactory
/**
* A linear space for vectors.

View File

@ -1,6 +1,6 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.structures.Matrix
import kscience.kmath.structures.Matrix
public class VirtualMatrix<T : Any>(
override val rowNum: Int,

View File

@ -1,11 +1,11 @@
package scientifik.kmath.misc
package kscience.kmath.misc
import scientifik.kmath.linear.Point
import scientifik.kmath.operations.ExtendedField
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.invoke
import scientifik.kmath.operations.sum
import scientifik.kmath.structures.asBuffer
import kscience.kmath.linear.Point
import kscience.kmath.operations.ExtendedField
import kscience.kmath.operations.Field
import kscience.kmath.operations.invoke
import kscience.kmath.operations.sum
import kscience.kmath.structures.asBuffer
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View File

@ -1,4 +1,4 @@
package scientifik.kmath.misc
package kscience.kmath.misc
import kotlin.math.abs

View File

@ -1,8 +1,7 @@
package scientifik.kmath.misc
package kscience.kmath.misc
import scientifik.kmath.operations.Space
import scientifik.kmath.operations.invoke
import kotlin.contracts.contract
import kscience.kmath.operations.Space
import kscience.kmath.operations.invoke
import kotlin.jvm.JvmName
/**

View File

@ -1,6 +1,4 @@
package scientifik.kmath.operations
import kotlin.contracts.contract
package kscience.kmath.operations
/**
* Stub for DSL the [Algebra] is.

View File

@ -1,4 +1,4 @@
package scientifik.kmath.operations
package kscience.kmath.operations
/**
* The generic mathematics elements which is able to store its context

View File

@ -1,4 +1,4 @@
package scientifik.kmath.operations
package kscience.kmath.operations
/**
* Returns the sum of all elements in the iterable in this [Space].

View File

@ -1,9 +1,8 @@
package scientifik.kmath.operations
package kscience.kmath.operations
import scientifik.kmath.operations.BigInt.Companion.BASE
import scientifik.kmath.operations.BigInt.Companion.BASE_SIZE
import scientifik.kmath.structures.*
import kotlin.contracts.contract
import kscience.kmath.operations.BigInt.Companion.BASE
import kscience.kmath.operations.BigInt.Companion.BASE_SIZE
import kscience.kmath.structures.*
import kotlin.math.log2
import kotlin.math.max
import kotlin.math.min

View File

@ -1,12 +1,11 @@
package scientifik.kmath.operations
package kscience.kmath.operations
import scientifik.kmath.structures.Buffer
import scientifik.kmath.structures.MemoryBuffer
import scientifik.kmath.structures.MutableBuffer
import scientifik.memory.MemoryReader
import scientifik.memory.MemorySpec
import scientifik.memory.MemoryWriter
import kotlin.contracts.contract
import kscience.kmath.structures.Buffer
import kscience.kmath.structures.MemoryBuffer
import kscience.kmath.structures.MutableBuffer
import kscience.memory.MemoryReader
import kscience.memory.MemorySpec
import kscience.memory.MemoryWriter
import kotlin.math.*
/**

View File

@ -1,4 +1,4 @@
package scientifik.kmath.operations
package kscience.kmath.operations
import kotlin.math.abs
import kotlin.math.pow as kpow

View File

@ -1,4 +1,4 @@
package scientifik.kmath.operations
package kscience.kmath.operations
/**
* A container for trigonometric operations for specific type.

View File

@ -1,7 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.FieldElement
import kscience.kmath.operations.Field
import kscience.kmath.operations.FieldElement
public class BoxingNDField<T, F : Field<T>>(
public override val shape: IntArray,

View File

@ -1,7 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.RingElement
import kscience.kmath.operations.Ring
import kscience.kmath.operations.RingElement
public class BoxingNDRing<T, R : Ring<T>>(
override val shape: IntArray,

View File

@ -1,4 +1,4 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlin.reflect.KClass

View File

@ -1,6 +1,6 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
public interface BufferedNDAlgebra<T, C> : NDAlgebra<T, C, NDBuffer<T>> {
public val strides: Strides

View File

@ -1,6 +1,6 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.*
import kscience.kmath.operations.*
/**
* Base class for an element with context, containing strides

View File

@ -1,8 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.complex
import kotlin.contracts.contract
import kscience.kmath.operations.Complex
import kscience.kmath.operations.complex
import kotlin.reflect.KClass
/**

View File

@ -1,9 +1,9 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import scientifik.kmath.operations.FieldElement
import scientifik.kmath.operations.complex
import kscience.kmath.operations.Complex
import kscience.kmath.operations.ComplexField
import kscience.kmath.operations.FieldElement
import kscience.kmath.operations.complex
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

View File

@ -1,6 +1,6 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.ExtendedField
import kscience.kmath.operations.ExtendedField
/**
* [ExtendedField] over [NDStructure].

View File

@ -1,6 +1,5 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlin.contracts.contract
import kotlin.experimental.and
/**

View File

@ -1,6 +1,4 @@
package scientifik.kmath.structures
import kotlin.contracts.contract
package kscience.kmath.structures
/**
* Specialized [MutableBuffer] implementation over [FloatArray].

View File

@ -1,6 +1,4 @@
package scientifik.kmath.structures
import kotlin.contracts.contract
package kscience.kmath.structures
/**
* Specialized [MutableBuffer] implementation over [IntArray].

View File

@ -1,6 +1,4 @@
package scientifik.kmath.structures
import kotlin.contracts.contract
package kscience.kmath.structures
/**
* Specialized [MutableBuffer] implementation over [LongArray].

View File

@ -1,6 +1,6 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.memory.*
import kscience.memory.*
/**
* A non-boxing buffer over [Memory] object.

View File

@ -1,9 +1,9 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.Space
import kscience.kmath.operations.Complex
import kscience.kmath.operations.Field
import kscience.kmath.operations.Ring
import kscience.kmath.operations.Space
/**
* An exception is thrown when the expected ans actual shape of NDArray differs

View File

@ -1,10 +1,9 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.Field
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.Ring
import scientifik.kmath.operations.Space
import kotlin.contracts.contract
import kscience.kmath.operations.Field
import kscience.kmath.operations.RealField
import kscience.kmath.operations.Ring
import kscience.kmath.operations.Space
/**
* The root for all [NDStructure] based algebra elements. Does not implement algebra element root because of problems with recursive self-types

View File

@ -1,6 +1,5 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import kotlin.contracts.contract
import kotlin.jvm.JvmName
import kotlin.reflect.KClass

View File

@ -1,6 +1,4 @@
package scientifik.kmath.structures
import kotlin.contracts.contract
package kscience.kmath.structures
/**
* Specialized [MutableBuffer] implementation over [DoubleArray].

View File

@ -1,7 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.ExtendedField
import scientifik.kmath.operations.ExtendedFieldOperations
import kscience.kmath.operations.ExtendedField
import kscience.kmath.operations.ExtendedFieldOperations
import kotlin.math.*
/**

View File

@ -1,7 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.FieldElement
import scientifik.kmath.operations.RealField
import kscience.kmath.operations.FieldElement
import kscience.kmath.operations.RealField
public typealias RealNDElement = BufferedNDFieldElement<Double, RealField>

View File

@ -1,6 +1,4 @@
package scientifik.kmath.structures
import kotlin.contracts.contract
package kscience.kmath.structures
/**
* Specialized [MutableBuffer] implementation over [ShortArray].

View File

@ -1,7 +1,7 @@
package scientifik.kmath.structures
package kscience.kmath.structures
import scientifik.kmath.operations.RingElement
import scientifik.kmath.operations.ShortRing
import kscience.kmath.operations.RingElement
import kscience.kmath.operations.ShortRing
public typealias ShortNDElement = BufferedNDRingElement<Short, ShortRing>

View File

@ -1,4 +1,4 @@
package scientifik.kmath.structures
package kscience.kmath.structures
/**
* A structure that is guaranteed to be one-dimensional

View File

@ -1,4 +1,4 @@
package scientifik.kmath.structures
package kscience.kmath.structures
/**
* A structure that is guaranteed to be two-dimensional

View File

@ -1,9 +1,9 @@
package scientifik.kmath.expressions
package kscience.kmath.expressions
import scientifik.kmath.operations.Complex
import scientifik.kmath.operations.ComplexField
import scientifik.kmath.operations.RealField
import scientifik.kmath.operations.invoke
import kscience.kmath.operations.Complex
import kscience.kmath.operations.ComplexField
import kscience.kmath.operations.RealField
import kscience.kmath.operations.invoke
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,8 +1,8 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.structures.Matrix
import scientifik.kmath.structures.NDStructure
import scientifik.kmath.structures.as2D
import kscience.kmath.structures.Matrix
import kscience.kmath.structures.NDStructure
import kscience.kmath.structures.as2D
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,6 +1,6 @@
package scientifik.kmath.linear
package kscience.kmath.linear
import scientifik.kmath.structures.Matrix
import kscience.kmath.structures.Matrix
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,7 +1,7 @@
package scientifik.kmath.misc
package kscience.kmath.misc
import scientifik.kmath.operations.RealField
import scientifik.kmath.structures.asBuffer
import kscience.kmath.operations.RealField
import kscience.kmath.structures.asBuffer
import kotlin.math.PI
import kotlin.math.pow
import kotlin.math.sqrt

View File

@ -1,4 +1,4 @@
package scientifik.kmath.misc
package kscience.kmath.misc
import kotlin.test.Test
import kotlin.test.assertEquals

View File

@ -1,6 +1,6 @@
package scientifik.kmath.operations
package kscience.kmath.operations
import scientifik.kmath.operations.internal.RingVerifier
import kscience.kmath.operations.internal.RingVerifier
import kotlin.test.Test
import kotlin.test.assertEquals

Some files were not shown because too many files have changed in this diff Show More