Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python matrix condensed to square

def square_to_condensed(i, j, n):
    assert i != j, "no diagonal elements in condensed matrix"
    if i < j:
        i, j = j, i
    return n*j - j*(j+1)//2 + i - 1 - j
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #matrix #condensed #square
ADD COMMENT
Topic
Name
1+3 =