daxpy.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. // Vector add, alpha X + Y
  14. #include "eclblas.hpp"
  15. namespace eclblas {
  16. ECLBLAS_CALL void daxpy(bool & __isAllResult, size32_t & __lenResult,
  17. void * & __result, uint32_t n, double alpha,
  18. bool isAllX, size32_t lenX, const void * x, uint32_t incx,
  19. bool isAllY, size32_t lenY, const void* y, uint32_t incy,
  20. uint32_t x_skipped, uint32_t y_skipped) {
  21. __isAllResult = false;
  22. __lenResult = lenY;
  23. const double* X = ((const double*)x) + x_skipped;
  24. double *result = (double*) rtlMalloc(__lenResult);
  25. memcpy(result, y,lenY);
  26. double* Y = result + y_skipped;
  27. cblas_daxpy(n, alpha, X, incx, Y, incy);
  28. __result = (void*) result;
  29. }
  30. }