Examples for type-safe dimensions
This commit is contained in:
parent
09f2f37780
commit
169801060b
@ -40,6 +40,8 @@ can be used for a wide variety of purposes from high performance calculations to
|
||||
|
||||
* **Streaming** Streaming operations on mathematical objects and objects buffers.
|
||||
|
||||
* **Type-safe dimensions** Type-safe dimensions for matrix operations.
|
||||
|
||||
* **Commons-math wrapper** It is planned to gradually wrap most parts of [Apache commons-math](http://commons.apache.org/proper/commons-math/)
|
||||
library in Kotlin code and maybe rewrite some parts to better suit the Kotlin programming paradigm, however there is no fixed roadmap for that. Feel free
|
||||
to submit a feature request if you want something to be done first.
|
||||
|
@ -14,14 +14,14 @@ fun DMatrixContext<Double, RealField>.simple() {
|
||||
m1.transpose() + m2
|
||||
}
|
||||
|
||||
object D5: Dimension{
|
||||
object D5 : Dimension {
|
||||
override val dim: UInt = 5u
|
||||
}
|
||||
|
||||
fun DMatrixContext<Double, RealField>.custom() {
|
||||
val m1 = produce<D2, D5> { i, j -> (i+j).toDouble() }
|
||||
val m2 = produce<D5,D2> { i, j -> (i-j).toDouble() }
|
||||
val m3 = produce<D2,D2> { i, j -> (i-j).toDouble() }
|
||||
val m1 = produce<D2, D5> { i, j -> (i + j).toDouble() }
|
||||
val m2 = produce<D5, D2> { i, j -> (i - j).toDouble() }
|
||||
val m3 = produce<D2, D2> { i, j -> (i - j).toDouble() }
|
||||
|
||||
(m1 dot m2) + m3
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user