Quantcast
Channel: Intel® oneAPI Math Kernel Library & Intel® Math Kernel Library
Viewing all articles
Browse latest Browse all 2652

Number of non-zeros less than nRows

$
0
0

Hello. I have two very related questions that I hope you can answer. I am writing code that uses the MKL to get the LDL' decomposition of a matrix that is real and symmetric but, in general, indefinite.

First question: given the type of the problem I'm solving, the matrix D might (and should) be composed of 1x1 and 2x2 blocks. Can dss_factor_real(), when the opt parameter is set to MKL_DSS_INDEFINITE, generate such a matrix?

Second question: from the dss_sym_c.c example it appears that, when passing the option MKL_DSS_SYMMETRIC to dss_define_structure(), one does not need to pass the indices and values of the lower triangle of the matrix, but only those of the diagonal and the upper triangle. This said, the LDL' decomposition for the matrix (using Matlab notation)

A=[0 1; 1 0]

should be L=I and D=A. If I call dss_define_structure(), dss_reorder(), and then dss_factor_real() on A, I need to define it with only one nonzero, given that the other one is below the diagonal. As a result, the parameters passed to dss_define_structure() dss_factor_real() should be as follows (see mkl/examples/solverc/source/dss_sym_c.c), where NROWS=NCOLS=2 and NNONZEROS=1:

  _INTEGER_t rowIndex[NROWS + 1] = { 1, 2, 2};
  _INTEGER_t columns[NNONZEROS] = { 2};
  _DOUBLE_PRECISION_t values[NNONZEROS] = { 3};
  _DOUBLE_PRECISION_t rhs[NROWS] = { 1, 6};

However, when I do so, the program fails after printing "MKL-DSS-DSS-Error, Number of non-zeros less than nRows".

I can avoid this error by passing both off-diagonal values of the matrix, i.e.,

  _INTEGER_t rowIndex[NROWS + 1] = { 1, 2, 3};
  _INTEGER_t columns[NNONZEROS] = { 2, 1};
  _DOUBLE_PRECISION_t values[NNONZEROS] = { 3, 3};
  _DOUBLE_PRECISION_t rhs[NRHS*NROWS] = { 1, 6};

However this seems a little inconsistent with the standard passing method, and I am afraid that it might either cause errors or be inefficient since twice as many numbers must then be passed. Do I have to pass all values of the matrix?

Thanks,

Pietro


Viewing all articles
Browse latest Browse all 2652

Trending Articles