add fromMatrix
This commit is contained in:
parent
f9500f44ec
commit
95b814e163
@ -2,8 +2,12 @@ package space.kscience.kmath.tensors
|
|||||||
|
|
||||||
import space.kscience.kmath.linear.BufferMatrix
|
import space.kscience.kmath.linear.BufferMatrix
|
||||||
import space.kscience.kmath.linear.RealMatrixContext.toBufferMatrix
|
import space.kscience.kmath.linear.RealMatrixContext.toBufferMatrix
|
||||||
|
import space.kscience.kmath.nd.Matrix
|
||||||
import space.kscience.kmath.nd.MutableNDBuffer
|
import space.kscience.kmath.nd.MutableNDBuffer
|
||||||
|
import space.kscience.kmath.nd.Structure2D
|
||||||
import space.kscience.kmath.nd.as2D
|
import space.kscience.kmath.nd.as2D
|
||||||
|
import space.kscience.kmath.structures.Buffer
|
||||||
|
import space.kscience.kmath.structures.BufferAccessor2D
|
||||||
import space.kscience.kmath.structures.MutableBuffer
|
import space.kscience.kmath.structures.MutableBuffer
|
||||||
import space.kscience.kmath.structures.toList
|
import space.kscience.kmath.structures.toList
|
||||||
|
|
||||||
@ -22,7 +26,8 @@ public fun <T : Any> BufferTensor<T>.toBufferMatrix(): BufferMatrix<T> {
|
|||||||
return BufferMatrix(shape[0], shape[1], this.buffer)
|
return BufferMatrix(shape[0], shape[1], this.buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun <T : Any> BufferMatrix<T>.BufferTensor(): BufferTensor<T> {
|
// T???
|
||||||
return BufferTensor(intArrayOf(rowNum, colNum), buffer)
|
public fun BufferMatrix<Double>.BufferTensor(): BufferTensor<Double> {
|
||||||
|
return BufferTensor(intArrayOf(rowNum, colNum), BufferAccessor2D(rowNum, colNum, Buffer.Companion::real).create(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user