
commonMain.org.danilopianini.symmetricmatrix.MutableShortSymmetricMatrix.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-symmetric-matrix-jvm Show documentation
Show all versions of kotlin-symmetric-matrix-jvm Show documentation
A template repository for Kotlin Multiplatform projects
The newest version!
package org.danilopianini.symmetricmatrix
/**
* A mutable symmetric matrix of shorts.
*/
class MutableShortSymmetricMatrix(
override val size: Int,
) : AbstractSymmetricMatrix(),
MutableSymmetricMatrix {
private val data: ShortArray = ShortArray(size * (size + 1) / 2)
override operator fun get(
i: Int,
j: Int,
): Short = data[indexOf(i, j)]
override operator fun set(
i: Int,
j: Int,
value: Short,
) {
data[indexOf(i, j)] = value
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy