Fix compilation issues

This commit is contained in:
Iaroslav Postovalov 2020-08-27 16:44:58 +07:00
parent 7157878485
commit 2bc62356d6
No known key found for this signature in database
GPG Key ID: 70D5F4DCB0972F1B
3 changed files with 6 additions and 3 deletions

View File

@ -14,8 +14,9 @@ class BoxingNDField<T, F : Field<T>>(
fun buildBuffer(size: Int, initializer: (Int) -> T): Buffer<T> =
bufferFactory(size, initializer)
override fun check(vararg elements: NDBuffer<T>) {
override fun check(vararg elements: NDBuffer<T>): Array<out NDBuffer<T>> {
if (!elements.all { it.strides == this.strides }) error("Element strides are not the same as context strides")
return elements
}
override val zero: BufferedNDFieldElement<T, F> by lazy { produce { zero } }

View File

@ -14,8 +14,9 @@ class BoxingNDRing<T, R : Ring<T>>(
fun buildBuffer(size: Int, initializer: (Int) -> T): Buffer<T> =
bufferFactory(size, initializer)
override fun check(vararg elements: NDBuffer<T>) {
override fun check(vararg elements: NDBuffer<T>): Array<out NDBuffer<T>> {
if (!elements.all { it.strides == this.strides }) error("Element strides are not the same as context strides")
return elements
}
override val zero: BufferedNDRingElement<T, R> by lazy { produce { zero } }

View File

@ -5,8 +5,9 @@ import scientifik.kmath.operations.*
interface BufferedNDAlgebra<T, C> : NDAlgebra<T, C, NDBuffer<T>> {
val strides: Strides
override fun check(vararg elements: NDBuffer<T>) {
override fun check(vararg elements: NDBuffer<T>): Array<out NDBuffer<T>> {
if (!elements.all { it.strides == this.strides }) error("Strides mismatch")
return elements
}
/**