Skip to content

Instantly share code, notes, and snippets.

@Volatile var i = 0
val lock = AtomicInteger(0)
fun LockSynchronized()
{
synchronized(this) {
i++
}
}
@vagran
vagran / determinant.py
Created March 14, 2018 11:00
Get determinant expression for matrix of arbitrary size.
# Get determinant expression for a matrix.
def Minor(M, rowIdx):
"""
:param M Matrix to get minor for.
:param rowIdx: Row index for minor submatrix. Assuming column 0.
:return: Minor submatrix.
"""
m = []
for i in range(0, len(M)):
@vagran
vagran / determinant.py
Last active March 14, 2018 11:02
Get determinant expression for a 4x4 matrix
# Get determinant expression for a matrix.
# Works for 4x4 matrix only because Rule of Sarrus is used. Can be adapted for any size by using
# recursive algorithm.
M = []
SIZE = 4
def Minor(rowIdx):
"""