dtrsm.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2016 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. // Triangular matrix solver.
  14. // op( A )*X = alpha*B, or X*op( A ) = alpha*B; B is m x n
  15. //
  16. #include "eclblas.hpp"
  17. namespace eclblas {
  18. ECLBLAS_CALL void dtrsm(bool & __isAllResult, size32_t & __lenResult,
  19. void * & __result, uint8_t side, uint8_t tri,
  20. bool transposeA, uint8_t diag, uint32_t m,
  21. uint32_t n, uint32_t lda, double alpha, bool isAllA,
  22. size32_t lenA, const void * a, bool isAllB, size32_t lenB,
  23. const void * b) {
  24. unsigned int ldb = m;
  25. __isAllResult = false;
  26. __lenResult = lenB;
  27. double *new_b = (double*) rtlMalloc(lenB);
  28. memcpy(new_b, b, __lenResult);
  29. cblas_dtrsm(CblasColMajor,
  30. side==AX ? CblasLeft : CblasRight,
  31. tri==UPPER ? CblasUpper : CblasLower,
  32. transposeA ? CblasTrans : CblasNoTrans,
  33. diag==UNIT ? CblasUnit : CblasNonUnit,
  34. m, n, alpha, (const double *)a, lda, new_b, ldb);
  35. __result = (void*) new_b;
  36. }
  37. }