id summary reporter owner description type status milestone component version severity resolution keywords cc 3510 Introduce new diag function for creating diagonal matrices and for returning the diagonal of a matrix marco.guazzone@… Gunter "Introduce a new '''diag''' free function in the spirit of the MATLAB's ''diag'' function and Mathematica's ''DiagonalMatrix function''. Basically it allows both the creation of a ''generalized'' diagonal matrix and the creation of a ''diagonal'' view of an existing matrix. A ''generalized'' k-th diagonal matrix is a special kind of matrix which has all elements set to zero but the ones on its k-th diagonal. The integer k is the offset from the main diagonal, that is: * k = 0: the elements on the main diagonal can be different from zero. * k > 0: only the elements on the k-th upper diagonal can be different from zero. * k < 0: only the elements on the k-th lower diagonal can be different from zero. A generalized diagonal matrix can be a rectangular matrix. Here below is a list of the requested cases: * Create a square diagonal matrix M with vector V being the k-th diagonal {{{M = diag(v,k)}}} * Like the above, but M has layout l (e.g., column major) {{{M = diag(v,k,l)}}} * Create a rectangular diagonal matrix M of size mXn with vector V being the k-th diagonal {{{M = diag(v,m,n,k)}}} * Like the above, but M has layout l (e.g., column major) {{{M = diag(v,m,n,k,l)}}} * Create a diagonal view of the k-th diagonal of matrix M {{{v = diag(M,k)}}} " Feature Requests new Boost 1.41.0 uBLAS Boost 1.40.0 Not Applicable