Chains moved to coroutines. Cumulatives to core
This commit is contained in:
parent
9182a4279c
commit
8208cb772f
@ -7,7 +7,7 @@ description = "Commons math binding for kmath"
|
||||
|
||||
dependencies {
|
||||
api(project(":kmath-core"))
|
||||
api(project(":kmath-sequential"))
|
||||
api(project(":kmath-streaming"))
|
||||
api("org.apache.commons:commons-math3:3.6.1")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
|
||||
|
@ -2,9 +2,9 @@ package scientifik.kmath.transform
|
||||
|
||||
import org.apache.commons.math3.transform.*
|
||||
import scientifik.kmath.operations.Complex
|
||||
import scientifik.kmath.sequential.Processor
|
||||
import scientifik.kmath.sequential.Producer
|
||||
import scientifik.kmath.sequential.map
|
||||
import scientifik.kmath.streaming.Processor
|
||||
import scientifik.kmath.streaming.Producer
|
||||
import scientifik.kmath.streaming.map
|
||||
import scientifik.kmath.structures.*
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.misc
|
||||
|
||||
import scientifik.kmath.operations.Space
|
||||
import kotlin.jvm.JvmName
|
@ -1,6 +1,5 @@
|
||||
package scientifik.kmath.misc
|
||||
|
||||
import scientifik.kmath.sequential.cumulativeSum
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertEquals
|
||||
|
@ -14,14 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package scientifik.kmath.sequential
|
||||
package sicentifik.kmath.chains
|
||||
|
||||
import kotlinx.atomicfu.atomic
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.channels.ReceiveChannel
|
||||
import kotlinx.coroutines.channels.produce
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.FlowPreview
|
||||
|
||||
|
||||
/**
|
||||
@ -47,10 +43,11 @@ interface Chain<out R> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Chain as a coroutine receive channel
|
||||
* Chain as a coroutine flow. The flow emit affects chain state and vice versa
|
||||
*/
|
||||
@ExperimentalCoroutinesApi
|
||||
fun <R> Chain<R>.asChannel(scope: CoroutineScope): ReceiveChannel<R> = scope.produce { while (isActive) send(next()) }
|
||||
@FlowPreview
|
||||
val <R> Chain<R>.flow
|
||||
get() = kotlinx.coroutines.flow.flow { while (true) emit(next()) }
|
||||
|
||||
fun <T> Iterator<T>.asChain(): Chain<T> = SimpleChain { next() }
|
||||
fun <T> Sequence<T>.asChain(): Chain<T> = iterator().asChain()
|
@ -1,6 +1,7 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.chains
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import sicentifik.kmath.chains.Chain
|
||||
import kotlin.sequences.Sequence
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.streaming
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
@ -1,4 +1,4 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.streaming
|
||||
|
||||
import kotlinx.coroutines.sync.Mutex
|
||||
import kotlinx.coroutines.sync.withLock
|
@ -1,4 +1,4 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.streaming
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.GlobalScope
|
@ -1,4 +1,4 @@
|
||||
package scientifik.kmath.sequential
|
||||
package scientifik.kmath.streaming
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import scientifik.kmath.structures.asSequence
|
@ -29,6 +29,6 @@ include(
|
||||
":kmath-histograms",
|
||||
":kmath-commons",
|
||||
":kmath-koma",
|
||||
":kmath-sequential",
|
||||
":kmath-streaming",
|
||||
":benchmarks"
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user