KMP library for tensors #300
@ -2768,6 +2768,11 @@ public abstract interface class space/kscience/kmath/tensors/TensorPartialDivisi
|
|||||||
public abstract fun variance (Lspace/kscience/kmath/nd/MutableStructureND;IZZ)Lspace/kscience/kmath/nd/MutableStructureND;
|
public abstract fun variance (Lspace/kscience/kmath/nd/MutableStructureND;IZZ)Lspace/kscience/kmath/nd/MutableStructureND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class space/kscience/kmath/tensors/TensorPartialDivisionAlgebra$DefaultImpls {
|
||||||
|
public static synthetic fun mean$default (Lspace/kscience/kmath/tensors/TensorPartialDivisionAlgebra;Lspace/kscience/kmath/nd/MutableStructureND;IZILjava/lang/Object;)Lspace/kscience/kmath/nd/MutableStructureND;
|
||||||
|
public static synthetic fun variance$default (Lspace/kscience/kmath/tensors/TensorPartialDivisionAlgebra;Lspace/kscience/kmath/nd/MutableStructureND;IZZILjava/lang/Object;)Lspace/kscience/kmath/nd/MutableStructureND;
|
||||||
|
}
|
||||||
|
|
||||||
public final class space/kscience/kmath/tensors/core/BroadcastDoubleTensorAlgebra : space/kscience/kmath/tensors/core/DoubleTensorAlgebra {
|
public final class space/kscience/kmath/tensors/core/BroadcastDoubleTensorAlgebra : space/kscience/kmath/tensors/core/DoubleTensorAlgebra {
|
||||||
public fun <init> ()V
|
public fun <init> ()V
|
||||||
public synthetic fun div (Lspace/kscience/kmath/nd/MutableStructureND;Lspace/kscience/kmath/nd/MutableStructureND;)Lspace/kscience/kmath/nd/MutableStructureND;
|
public synthetic fun div (Lspace/kscience/kmath/nd/MutableStructureND;Lspace/kscience/kmath/nd/MutableStructureND;)Lspace/kscience/kmath/nd/MutableStructureND;
|
||||||
|
@ -71,6 +71,21 @@ private inline class Buffer1DWrapper<T>(val buffer: Buffer<T>) : Structure1D<T>
|
|||||||
override operator fun get(index: Int): T = buffer[index]
|
override operator fun get(index: Int): T = buffer[index]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal inline class MutableBuffer1DWrapper<T>(val buffer: MutableBuffer<T>) : MutableStructure1D<T> {
|
||||||
|
override val shape: IntArray get() = intArrayOf(buffer.size)
|
||||||
|
override val size: Int get() = buffer.size
|
||||||
|
|
||||||
|
override fun elements(): Sequence<Pair<IntArray, T>> =
|
||||||
|
buffer.asSequence().mapIndexed { index, value -> intArrayOf(index) to value }
|
||||||
|
|
||||||
|
override operator fun get(index: Int): T = buffer[index]
|
||||||
|
override fun set(index: Int, value: T) {
|
||||||
|
buffer[index] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun copy(): MutableBuffer<T> = buffer.copy()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent a [StructureND] as [Structure1D]. Throw error in case of dimension mismatch
|
* Represent a [StructureND] as [Structure1D]. Throw error in case of dimension mismatch
|
||||||
*/
|
*/
|
||||||
|
@ -75,14 +75,14 @@ public interface MutableStructure2D<T> : Structure2D<T>, MutableStructureND<T> {
|
|||||||
/**
|
/**
|
||||||
* The buffer of rows of this structure. It gets elements from the structure dynamically.
|
* The buffer of rows of this structure. It gets elements from the structure dynamically.
|
||||||
*/
|
*/
|
||||||
override val rows: List<MutableBuffer<T>>
|
override val rows: List<MutableStructure1D<T>>
|
||||||
get() = List(rowNum) { i -> VirtualMutableBuffer(colNum) { j -> get(i, j) } }
|
get() = List(rowNum) { i -> MutableBuffer1DWrapper(VirtualMutableBuffer(colNum) { j -> get(i, j) })}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The buffer of columns of this structure. It gets elements from the structure dynamically.
|
* The buffer of columns of this structure. It gets elements from the structure dynamically.
|
||||||
*/
|
*/
|
||||||
override val columns: List<MutableBuffer<T>>
|
override val columns: List<MutableStructure1D<T>>
|
||||||
get() = List(colNum) { j -> VirtualMutableBuffer(rowNum) { i -> get(i, j) } }
|
get() = List(colNum) { j -> MutableBuffer1DWrapper(VirtualMutableBuffer(rowNum) { i -> get(i, j) }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user