All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.danilopianini.symmetricmatrix.MutableShortSymmetricMatrix.kt Maven / Gradle / Ivy

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