nGetMatDim: Compute matrix dimension based on the length of a flattened...

Description Usage Arguments Value

Description

The flattened vector contains all elements of the lower triangular part of a symmetric matrix including all diagonal elements. Because any row i of a quadratic matrix contains i elements below the diagonal, including the diagonal element, the flattened vector of an n * n symmetric matrix contains the sum of all natural numbers up to and including n. That length has a closed form and corresponds to n*(n+1)/2. Given the length of the flattened vector, we have a quadratic equation for n, that can be solved. We are only interested in the positive solution which is n = (-1 + √(1+8l))/2

Usage

1
nGetMatDim(pnLenFlatVec)

Arguments

pnLenFlatVec

length of flattened vector

Value

nMatDimResult dimension of symmetric matrix


charlotte-ngs/rgrm documentation built on May 13, 2019, 3:34 p.m.