From 622a6a7756bd7fc95e8df029ada595eb29b0babb Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 31 Dec 2018 14:10:02 +0300 Subject: [PATCH] Removed empty files and fixed one test --- .../kmath/structures/LazyStructure.kt | 20 ------------------- .../scientifik/kmath/structures/LazyField.kt | 7 ------- .../kmath/structures/LazyNDField.kt | 4 ++-- .../kmath/structures/LazyNDFieldTest.kt | 2 +- 4 files changed, 3 insertions(+), 30 deletions(-) delete mode 100644 kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/LazyStructure.kt delete mode 100644 kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyField.kt diff --git a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/LazyStructure.kt b/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/LazyStructure.kt deleted file mode 100644 index 0428535f9..000000000 --- a/kmath-core/src/commonMain/kotlin/scientifik/kmath/structures/LazyStructure.kt +++ /dev/null @@ -1,20 +0,0 @@ -package scientifik.kmath.structures - -// -//class LazyStructureField(val field: Field): Field>{ -// -//} -// -//class LazyStructure : NDStructure { -// -// override val shape: IntArray -// get() = TODO("not implemented") //To change initializer of created properties use File | Settings | File Templates. -// -// override fun get(index: IntArray): T { -// TODO("not implemented") //To change body of created functions use File | Settings | File Templates. -// } -// -// override fun iterator(): Iterator> { -// TODO("not implemented") //To change body of created functions use File | Settings | File Templates. -// } -//} \ No newline at end of file diff --git a/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyField.kt b/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyField.kt deleted file mode 100644 index d534d3eb3..000000000 --- a/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyField.kt +++ /dev/null @@ -1,7 +0,0 @@ -package scientifik.kmath.structures - -// -//class LazyField: Field { -//} -// -//class LazyValue(): \ No newline at end of file diff --git a/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyNDField.kt b/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyNDField.kt index bf823d64b..ad38100cb 100644 --- a/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyNDField.kt +++ b/kmath-coroutines/src/commonMain/kotlin/scientifik/kmath/structures/LazyNDField.kt @@ -67,10 +67,10 @@ fun > NDElement.lazy(scope: CoroutineScope = GlobalScope): } } -inline fun > LazyNDStructure.transformIndexed(crossinline action: suspend F.(IntArray, T) -> T) = LazyNDStructure(context) { index -> +inline fun > LazyNDStructure.mapIndexed(crossinline action: suspend F.(IntArray, T) -> T) = LazyNDStructure(context) { index -> action.invoke(this, index, await(index)) } -inline fun > LazyNDStructure.transform(crossinline action: suspend F.(T) -> T) = LazyNDStructure(context) { index -> +inline fun > LazyNDStructure.map(crossinline action: suspend F.(T) -> T) = LazyNDStructure(context) { index -> action.invoke(this, await(index)) } \ No newline at end of file diff --git a/kmath-coroutines/src/commonTest/kotlin/scientifik/kmath/structures/LazyNDFieldTest.kt b/kmath-coroutines/src/commonTest/kotlin/scientifik/kmath/structures/LazyNDFieldTest.kt index b5594cbdb..6e712f2a8 100644 --- a/kmath-coroutines/src/commonTest/kotlin/scientifik/kmath/structures/LazyNDFieldTest.kt +++ b/kmath-coroutines/src/commonTest/kotlin/scientifik/kmath/structures/LazyNDFieldTest.kt @@ -9,7 +9,7 @@ class LazyNDFieldTest { @Test fun testLazyStructure() { var counter = 0 - val regularStructure = NDElements.generic(intArrayOf(2, 2, 2), IntField) { it[0] + it[1] - it[2] } + val regularStructure = NDField.generic(intArrayOf(2, 2, 2), IntField).produce { it[0] + it[1] - it[2] } val result = (regularStructure.lazy() + 2).transform { counter++ it * it