Diagonal

An \(n \times n\) matrix \(A\) is called diagonal if each entry \((i,j)\), where \(i \neq j\), is \(0\). They are therefore defined by the diagonal values, where \(i = j\).

The following routines construct a diagonal matrix from the vector of diagonal values, \(d\).

C++ API

void Diagonal(Matrix<S> &D, const std::vector<T> &d)
void Diagonal(AbstractDistMatrix<S> &D, const std::vector<T> &d)
void Diagonal(AbstractBlockDistMatrix<S> &D, const std::vector<T> &d)

C API

ElError ElDiagonal_i(ElMatrix_i A, ElInt dSize, ElInt* dBuf)
ElError ElDiagonal_s(ElMatrix_s A, ElInt dSize, float* dBuf)
ElError ElDiagonal_d(ElMatrix_d A, ElInt dSize, double* dBuf)
ElError ElDiagonal_c(ElMatrix_c A, ElInt dSize, complex_float* dBuf)
ElError ElDiagonal_z(ElMatrix_z A, ElInt dSize, complex_double* dBuf)
ElError ElDiagonalDist_i(ElDistMatrix_i A, ElInt dSize, ElInt* dBuf)
ElError ElDiagonalDist_s(ElDistMatrix_s A, ElInt dSize, float* dBuf)
ElError ElDiagonalDist_d(ElDistMatrix_d A, ElInt dSize, double* dBuf)
ElError ElDiagonalDist_c(ElDistMatrix_c A, ElInt dSize, complex_float* dBuf)
ElError ElDiagonalDist_z(ElDistMatrix_z A, ElInt dSize, complex_double* dBuf)

Python API

Diagonal(A, d)