#NEWLINE# def _flat_to_triang_pure( flat_mat ) : #NEWLINE# #INDENT# ( N , D ) = flat_mat . shape #NEWLINE# M = ( ( ( - 1 ) + safe_root ( ( ( 8 * N ) + 1 ) ) ) // 2 ) #NEWLINE# ret = np . zeros ( ( D , M , M ) ) #NEWLINE# for d in range ( D ) : #NEWLINE# #INDENT# count = 0 #NEWLINE# for m in range ( M ) : #NEWLINE# #INDENT# for mm in range ( ( m + 1 ) ) : #NEWLINE# #INDENT# ret [ ( d , m , mm ) ] = flat_mat [ ( count , d ) ] #NEWLINE# count = ( count + 1 ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ret