forked from kscience/kmath
Removed empty files and fixed one test
This commit is contained in:
parent
b47cdd12c2
commit
622a6a7756
@ -1,20 +0,0 @@
|
||||
package scientifik.kmath.structures
|
||||
|
||||
//
|
||||
//class LazyStructureField<T: Any>(val field: Field<T>): Field<LazyStructure<T>>{
|
||||
//
|
||||
//}
|
||||
//
|
||||
//class LazyStructure<T : Any> : NDStructure<T> {
|
||||
//
|
||||
// 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<Pair<IntArray, T>> {
|
||||
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||
// }
|
||||
//}
|
@ -1,7 +0,0 @@
|
||||
package scientifik.kmath.structures
|
||||
|
||||
//
|
||||
//class LazyField<T>: Field<T> {
|
||||
//}
|
||||
//
|
||||
//class LazyValue<T: Any>():
|
@ -67,10 +67,10 @@ fun <T, F : Field<T>> NDElement<T, F>.lazy(scope: CoroutineScope = GlobalScope):
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T, F : Field<T>> LazyNDStructure<T, F>.transformIndexed(crossinline action: suspend F.(IntArray, T) -> T) = LazyNDStructure(context) { index ->
|
||||
inline fun <T, F : Field<T>> LazyNDStructure<T, F>.mapIndexed(crossinline action: suspend F.(IntArray, T) -> T) = LazyNDStructure(context) { index ->
|
||||
action.invoke(this, index, await(index))
|
||||
}
|
||||
|
||||
inline fun <T, F : Field<T>> LazyNDStructure<T, F>.transform(crossinline action: suspend F.(T) -> T) = LazyNDStructure(context) { index ->
|
||||
inline fun <T, F : Field<T>> LazyNDStructure<T, F>.map(crossinline action: suspend F.(T) -> T) = LazyNDStructure(context) { index ->
|
||||
action.invoke(this, await(index))
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user