dpttrs function

void dpttrs(
  1. int N,
  2. int NRHS,
  3. Array<double> D_,
  4. Array<double> E_,
  5. Matrix<double> B_,
  6. int LDB,
  7. Box<int> INFO,
)

Implementation

void dpttrs(
  final int N,
  final int NRHS,
  final Array<double> D_,
  final Array<double> E_,
  final Matrix<double> B_,
  final int LDB,
  final Box<int> INFO,
) {
  final D = D_.having();
  final E = E_.having();
  final B = B_.having(ld: LDB);

  // Test the input arguments.

  INFO.value = 0;
  if (N < 0) {
    INFO.value = -1;
  } else if (NRHS < 0) {
    INFO.value = -2;
  } else if (LDB < max(1, N)) {
    INFO.value = -6;
  }
  if (INFO.value != 0) {
    xerbla('DPTTRS', -INFO.value);
    return;
  }

  // Quick return if possible

  if (N == 0 || NRHS == 0) return;

  // Determine the number of right-hand sides to solve at a time.

  final NB = NRHS == 1 ? 1 : max(1, ilaenv(1, 'DPTTRS', ' ', N, NRHS, -1, -1));

  if (NB >= NRHS) {
    dptts2(N, NRHS, D, E, B, LDB);
  } else {
    for (var J = 1; J <= NRHS; J += NB) {
      final JB = min(NRHS - J + 1, NB);
      dptts2(N, JB, D, E, B(1, J), LDB);
    }
  }
}