v0.2.0 #206
@ -9,7 +9,10 @@ import kscience.kmath.structures.BufferFactory
|
|||||||
import kscience.kmath.structures.asSequence
|
import kscience.kmath.structures.asSequence
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic operations on matrices. Operates on [Matrix]
|
* Basic operations on matrices. Operates on [Matrix].
|
||||||
|
*
|
||||||
|
* @param T the type of items in the matrices.
|
||||||
|
* @param M the type of operated matrices.
|
||||||
*/
|
*/
|
||||||
public interface MatrixContext<T : Any, out M : Matrix<T>> : SpaceOperations<Matrix<T>> {
|
public interface MatrixContext<T : Any, out M : Matrix<T>> : SpaceOperations<Matrix<T>> {
|
||||||
/**
|
/**
|
||||||
@ -83,9 +86,16 @@ public interface MatrixContext<T : Any, out M : Matrix<T>> : SpaceOperations<Mat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Partial implementation of [MatrixContext] for matrices of [Ring].
|
||||||
|
*
|
||||||
|
* @param T the type of items in the matrices.
|
||||||
|
* @param R the type of ring of matrix elements.
|
||||||
|
* @param M the type of operated matrices.
|
||||||
|
*/
|
||||||
public interface GenericMatrixContext<T : Any, R : Ring<T>, out M : Matrix<T>> : MatrixContext<T, M> {
|
public interface GenericMatrixContext<T : Any, R : Ring<T>, out M : Matrix<T>> : MatrixContext<T, M> {
|
||||||
/**
|
/**
|
||||||
* The ring context for matrix elements
|
* The ring over matrix elements.
|
||||||
*/
|
*/
|
||||||
public val elementContext: R
|
public val elementContext: R
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
package kscience.kmath.linear
|
package kscience.kmath.linear
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The matrix where each element is evaluated each time when is being accessed.
|
||||||
|
*
|
||||||
|
* @property generator the function that provides elements.
|
||||||
|
*/
|
||||||
public class VirtualMatrix<T : Any>(
|
public class VirtualMatrix<T : Any>(
|
||||||
override val rowNum: Int,
|
override val rowNum: Int,
|
||||||
override val colNum: Int,
|
override val colNum: Int,
|
||||||
|
@ -86,3 +86,10 @@ public fun <T> NDStructure<T>.as2D(): Structure2D<T> = if (shape.size == 2)
|
|||||||
Structure2DWrapper(this)
|
Structure2DWrapper(this)
|
||||||
else
|
else
|
||||||
error("Can't create 2d-structure from ${shape.size}d-structure")
|
error("Can't create 2d-structure from ${shape.size}d-structure")
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alias for [Structure2D] with more familiar name.
|
||||||
|
*
|
||||||
|
* @param T the type of items in the matrix.
|
||||||
|
*/
|
||||||
|
public typealias Matrix<T> = Structure2D<T>
|
||||||
|
Loading…
Reference in New Issue
Block a user