Lines Matching +full:x +full:- +full:alpha

8  *      http://www.apache.org/licenses/LICENSE-2.0
71 // For Single-precision BLAS. in setUpBLASCall()
72 call.alpha.f = alphaF; in setUpBLASCall()
76 // For Double-precision BLAS. in setUpBLASCall()
77 call.alpha.d = alphaD; in setUpBLASCall()
81 // For Single-precision complex BLAS. in setUpBLASCall()
82 call.alpha.c.r = alphaCX; in setUpBLASCall()
83 call.alpha.c.i = alphaCY; in setUpBLASCall()
88 // For Double-precision complex BLAS. in setUpBLASCall()
89 call.alpha.z.r = alphaZX; in setUpBLASCall()
90 call.alpha.z.i = alphaZY; in setUpBLASCall()
109 float alpha, RsAllocation A, RsAllocation B, in nScriptIntrinsicBLAS_Single() argument
112 M, N, K, incX, incY, KL, KU, alpha, beta, 0.0, 0.0, in nScriptIntrinsicBLAS_Single()
115 …tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr, in nScriptIntrinsicBLAS_Single()
123 double alpha, RsAllocation A, RsAllocation B, in nScriptIntrinsicBLAS_Double() argument
126 M, N, K, incX, incY, KL, KU, 0.0f, 0.0f, alpha, beta, in nScriptIntrinsicBLAS_Double()
129 …tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr, in nScriptIntrinsicBLAS_Double()
142 …tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr, in nScriptIntrinsicBLAS_Complex()
155 …tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr, in nScriptIntrinsicBLAS_Z()
176 …tryDispatch(mRS, RS::dispatch->ScriptForEachMulti(con, id, 0, in_allocs, NELEM(in_allocs), nullptr, in nScriptIntrinsicBLAS_BNNM()
184 const sp<Allocation>& X, int incX, const sp<Allocation>& Y, int incY) { in validateGEMV() argument
185 int M = A->getType()->getY(); in validateGEMV()
186 int N = A->getType()->getX(); in validateGEMV()
187 if (!A->getType()->getElement()->isCompatible(e) || in validateGEMV()
188 !X->getType()->getElement()->isCompatible(e) || in validateGEMV()
189 !Y->getType()->getElement()->isCompatible(e)) { in validateGEMV()
190 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateGEMV()
192 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateGEMV()
193 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateGEMV()
197 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateGEMV()
199 int expectedXDim = -1, expectedYDim = -1; in validateGEMV()
201 expectedXDim = 1 + (N - 1) * incX; in validateGEMV()
202 expectedYDim = 1 + (M - 1) * incY; in validateGEMV()
204 expectedXDim = 1 + (M - 1) * incX; in validateGEMV()
205 expectedYDim = 1 + (N - 1) * incY; in validateGEMV()
207 if ((int)X->getType()->getX() != expectedXDim || in validateGEMV()
208 (int)Y->getType()->getX() != expectedYDim) { in validateGEMV()
209 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for GEMV"); in validateGEMV()
213 …trinsicBLAS::SGEMV(RsBlasTranspose TransA, float alpha, const sp<Allocation>& A, const sp<Allocati… in SGEMV() argument
215 validateGEMV(mRS, Element::F32(mRS), TransA, A, X, incX, Y, incY); in SGEMV()
216 int M = A->getType()->getY(); in SGEMV()
217 int N = A->getType()->getX(); in SGEMV()
218 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sgemv, in SGEMV()
220 alpha, A->getID(), X->getID(), in SGEMV()
221 beta, Y->getID(), incX, incY, 0, 0); in SGEMV()
224 …rinsicBLAS::DGEMV(RsBlasTranspose TransA, double alpha, const sp<Allocation>& A, const sp<Allocati… in DGEMV() argument
226 validateGEMV(mRS, Element::F64(mRS), TransA, A, X, incX, Y, incY); in DGEMV()
227 int M = A->getType()->getY(); in DGEMV()
228 int N = A->getType()->getX(); in DGEMV()
229 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dgemv, in DGEMV()
231 alpha, A->getID(), X->getID(), in DGEMV()
232 beta, Y->getID(), incX, incY, 0, 0); in DGEMV()
235 …rinsicBLAS::CGEMV(RsBlasTranspose TransA, Float2 alpha, const sp<Allocation>& A, const sp<Allocati… in CGEMV() argument
237 validateGEMV(mRS, Element::F32_2(mRS), TransA, A, X, incX, Y, incY); in CGEMV()
238 int M = A->getType()->getY(); in CGEMV()
239 int N = A->getType()->getX(); in CGEMV()
240 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cgemv, in CGEMV()
242 alpha.x, alpha.y, A->getID(), X->getID(), in CGEMV()
243 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in CGEMV()
246 …insicBLAS::ZGEMV(RsBlasTranspose TransA, Double2 alpha, const sp<Allocation>& A, const sp<Allocati… in ZGEMV() argument
248 validateGEMV(mRS, Element::F64_2(mRS), TransA, A, X, incX, Y, incY); in ZGEMV()
249 int M = A->getType()->getY(); in ZGEMV()
250 int N = A->getType()->getX(); in ZGEMV()
251 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zgemv, in ZGEMV()
253 alpha.x, alpha.y, A->getID(), X->getID(), in ZGEMV()
254 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in ZGEMV()
257 void ScriptIntrinsicBLAS::SGBMV(RsBlasTranspose TransA, int KL, int KU, float alpha, const sp<Alloc… in SGBMV() argument
258 … const sp<Allocation>& X, int incX, float beta, const sp<Allocation>& Y, int incY) { in SGBMV() argument
260 validateGEMV(mRS, Element::F32(mRS), TransA, A, X, incX, Y, incY); in SGBMV()
262 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "KL and KU must be greater than or equal to 0"); in SGBMV()
264 int M = A->getType()->getY(); in SGBMV()
265 int N = A->getType()->getX(); in SGBMV()
267 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sgbmv, in SGBMV()
269 alpha, A->getID(), X->getID(), in SGBMV()
270 beta, Y->getID(), incX, incY, KL, KU); in SGBMV()
273 void ScriptIntrinsicBLAS::DGBMV(RsBlasTranspose TransA, int KL, int KU, double alpha, const sp<Allo… in DGBMV() argument
274 … const sp<Allocation>& X, int incX, double beta, const sp<Allocation>& Y, int incY) { in DGBMV() argument
276 validateGEMV(mRS, Element::F64(mRS), TransA, A, X, incX, Y, incY); in DGBMV()
278 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "KL and KU must be greater than or equal to 0"); in DGBMV()
280 int M = A->getType()->getY(); in DGBMV()
281 int N = A->getType()->getX(); in DGBMV()
283 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dgbmv, in DGBMV()
285 alpha, A->getID(), X->getID(), in DGBMV()
286 beta, Y->getID(), incX, incY, KL, KU); in DGBMV()
289 void ScriptIntrinsicBLAS::CGBMV(RsBlasTranspose TransA, int KL, int KU, Float2 alpha, const sp<Allo… in CGBMV() argument
290 … const sp<Allocation>& X, int incX, Float2 beta, const sp<Allocation>& Y, int incY) { in CGBMV() argument
292 validateGEMV(mRS, Element::F32_2(mRS), TransA, A, X, incX, Y, incY); in CGBMV()
294 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "KL and KU must be greater than or equal to 0"); in CGBMV()
296 int M = A->getType()->getY(); in CGBMV()
297 int N = A->getType()->getX(); in CGBMV()
299 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cgbmv, in CGBMV()
301 alpha.x, alpha.y, A->getID(), X->getID(), in CGBMV()
302 beta.x, beta.y, Y->getID(), incX, incY, KL, KU); in CGBMV()
305 void ScriptIntrinsicBLAS::ZGBMV(RsBlasTranspose TransA, int KL, int KU, Double2 alpha, const sp<All… in ZGBMV() argument
306 … const sp<Allocation>& X, int incX, Double2 beta, const sp<Allocation>& Y, int incY) { in ZGBMV() argument
308 validateGEMV(mRS, Element::F64_2(mRS), TransA, A, X, incX, Y, incY); in ZGBMV()
310 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "KL and KU must be greater than or equal to 0"); in ZGBMV()
312 int M = A->getType()->getY(); in ZGBMV()
313 int N = A->getType()->getX(); in ZGBMV()
315 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zgbmv, in ZGBMV()
317 alpha.x, alpha.y, A->getID(), X->getID(), in ZGBMV()
318 beta.x, beta.y, Y->getID(), incX, incY, KL, KU); in ZGBMV()
322 … RsBlasDiag Diag, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in validateTRMV() argument
323 int N = A->getType()->getY(); in validateTRMV()
324 if ((int)A->getType()->getX() != N) { in validateTRMV()
325 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "A must be a square matrix for TRMV"); in validateTRMV()
327 if (!A->getType()->getElement()->isCompatible(e) || in validateTRMV()
328 !X->getType()->getElement()->isCompatible(e)) { in validateTRMV()
329 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateTRMV()
331 if (X->getType()->getY() > 1) { in validateTRMV()
332 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateTRMV()
336 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateTRMV()
338 int expectedXDim = 1 + (N - 1) * incX; in validateTRMV()
339 if ((int)X->getType()->getX() != expectedXDim) { in validateTRMV()
340 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for TRMV"); in validateTRMV()
345 … RsBlasDiag Diag, const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in validateTPMV() argument
346 if (!Ap->getType()->getElement()->isCompatible(e) || in validateTPMV()
347 !X->getType()->getElement()->isCompatible(e)) { in validateTPMV()
348 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateTPMV()
350 if (X->getType()->getY() > 1) { in validateTPMV()
351 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateTPMV()
354 if (Ap->getType()->getY() > 1) { in validateTPMV()
355 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Ap must have a Y dimension of 0 or 1"); in validateTPMV()
358 int N = sqrt((double)Ap->getType()->getX() * 2); in validateTPMV()
359 if ((int)Ap->getType()->getX() != ((N * (N+1)) / 2)) { in validateTPMV()
360 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid dimension for Ap"); in validateTPMV()
363 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateTPMV()
365 int expectedXDim = 1 + (N - 1) * incX; in validateTPMV()
366 if ((int)X->getType()->getX() != expectedXDim) { in validateTPMV()
367 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for TPMV"); in validateTPMV()
375 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in STRMV() argument
376 validateTRMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, A, X, incX); in STRMV()
377 int N = A->getType()->getY(); in STRMV()
378 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_strmv, in STRMV()
380 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STRMV()
384 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in DTRMV() argument
385 validateTRMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, A, X, incX); in DTRMV()
386 int N = A->getType()->getY(); in DTRMV()
387 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtrmv, in DTRMV()
389 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTRMV()
393 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in CTRMV() argument
394 validateTRMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, A, X, incX); in CTRMV()
395 int N = A->getType()->getY(); in CTRMV()
396 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctrmv, in CTRMV()
398 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTRMV()
402 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in ZTRMV() argument
403 validateTRMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, A, X, incX); in ZTRMV()
404 int N = A->getType()->getY(); in ZTRMV()
405 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztrmv, in ZTRMV()
407 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTRMV()
411 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in STBMV() argument
414 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in STBMV()
416 validateTRMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, A, X, incX); in STBMV()
417 int N = A->getType()->getY(); in STBMV()
418 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_stbmv, in STBMV()
420 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STBMV()
424 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in DTBMV() argument
427 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in DTBMV()
429 validateTRMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, A, X, incX); in DTBMV()
430 int N = A->getType()->getY(); in DTBMV()
431 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtbmv, in DTBMV()
433 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTBMV()
437 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in CTBMV() argument
440 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in CTBMV()
442 validateTRMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, A, X, incX); in CTBMV()
443 int N = A->getType()->getY(); in CTBMV()
444 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctbmv, in CTBMV()
446 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTBMV()
450 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in ZTBMV() argument
453 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in ZTBMV()
455 validateTRMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, A, X, incX); in ZTBMV()
456 int N = A->getType()->getY(); in ZTBMV()
457 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztbmv, in ZTBMV()
459 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTBMV()
463 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in STPMV() argument
464 int N = validateTPMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, Ap, X, incX); in STPMV()
465 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_stpmv, in STPMV()
467 Ap->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STPMV()
471 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in DTPMV() argument
472 int N = validateTPMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, Ap, X, incX); in DTPMV()
473 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtpmv, in DTPMV()
475 Ap->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTPMV()
479 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in CTPMV() argument
480 int N = validateTPMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX); in CTPMV()
481 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctpmv, in CTPMV()
483 Ap->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTPMV()
487 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in ZTPMV() argument
488 int N = validateTPMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX); in ZTPMV()
489 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztpmv, in ZTPMV()
491 Ap->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTPMV()
495 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in STRSV() argument
497 validateTRMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, A, X, incX); in STRSV()
498 int N = A->getType()->getY(); in STRSV()
499 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_strsv, in STRSV()
501 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STRSV()
505 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in DTRSV() argument
507 validateTRMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, A, X, incX); in DTRSV()
508 int N = A->getType()->getY(); in DTRSV()
509 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtrsv, in DTRSV()
511 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTRSV()
516 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in CTRSV() argument
518 validateTRMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, A, X, incX); in CTRSV()
519 int N = A->getType()->getY(); in CTRSV()
520 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctrsv, in CTRSV()
522 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTRSV()
527 const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in ZTRSV() argument
529 validateTRMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, A, X, incX); in ZTRSV()
530 int N = A->getType()->getY(); in ZTRSV()
531 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztrsv, in ZTRSV()
533 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTRSV()
538 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in STBSV() argument
540 validateTRMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, A, X, incX); in STBSV()
541 int N = A->getType()->getY(); in STBSV()
543 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Number of diagonals must be positive"); in STBSV()
545 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_stbsv, in STBSV()
547 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STBSV()
551 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in DTBSV() argument
553 validateTRMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, A, X, incX); in DTBSV()
554 int N = A->getType()->getY(); in DTBSV()
556 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Number of diagonals must be positive"); in DTBSV()
558 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtbsv, in DTBSV()
560 A->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTBSV()
564 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in CTBSV() argument
566 validateTRMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, A, X, incX); in CTBSV()
567 int N = A->getType()->getY(); in CTBSV()
569 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Number of diagonals must be positive"); in CTBSV()
571 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctbsv, in CTBSV()
573 0, 0, A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTBSV()
577 int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX) { in ZTBSV() argument
579 validateTRMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, A, X, incX); in ZTBSV()
580 int N = A->getType()->getY(); in ZTBSV()
582 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Number of diagonals must be positive"); in ZTBSV()
584 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztbsv, in ZTBSV()
586 A->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTBSV()
590 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in STPSV() argument
592 int N = validateTPMV(mRS, Element::F32(mRS), Uplo, TransA, Diag, Ap, X, incX); in STPSV()
593 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_stpsv, in STPSV()
595 Ap->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in STPSV()
599 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in DTPSV() argument
601 int N = validateTPMV(mRS, Element::F64(mRS), Uplo, TransA, Diag, Ap, X, incX); in DTPSV()
602 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtpsv, in DTPSV()
604 Ap->getID(), X->getID(), 0, 0, incX, 0, 0, 0); in DTPSV()
608 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in CTPSV() argument
610 int N = validateTPMV(mRS, Element::F32_2(mRS), Uplo, TransA, Diag, Ap, X, incX); in CTPSV()
611 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctpsv, in CTPSV()
613 Ap->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in CTPSV()
617 const sp<Allocation>& Ap, const sp<Allocation>& X, int incX) { in ZTPSV() argument
619 int N = validateTPMV(mRS, Element::F64_2(mRS), Uplo, TransA, Diag, Ap, X, incX); in ZTPSV()
620 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztpsv, in ZTPSV()
622 Ap->getID(), X->getID(), 0, 0, 0, incX, 0, 0, 0); in ZTPSV()
629 const sp<Allocation>& X, const sp<Allocation>& Y, int incX, int incY) { in validateSYMV() argument
630 int N = A->getType()->getY(); in validateSYMV()
631 if ((int)A->getType()->getX() != N) { in validateSYMV()
632 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "A must be a square matrix for SYMV"); in validateSYMV()
634 if (!A->getType()->getElement()->isCompatible(e) || in validateSYMV()
635 !X->getType()->getElement()->isCompatible(e) || in validateSYMV()
636 !Y->getType()->getElement()->isCompatible(e) ) { in validateSYMV()
637 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSYMV()
639 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateSYMV()
640 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSYMV()
644 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSYMV()
646 int expectedXDim = 1 + (N - 1) * incX; in validateSYMV()
647 if ((int)X->getType()->getX() != expectedXDim) { in validateSYMV()
648 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SYMV"); in validateSYMV()
650 int expectedYDim = 1 + (N - 1) * incY; in validateSYMV()
651 if ((int)Y->getType()->getX() != expectedYDim) { in validateSYMV()
652 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SYMV"); in validateSYMV()
657 const sp<Allocation>& X, int incX, const sp<Allocation>& Y, int incY) { in validateSPMV() argument
658 if (!Ap->getType()->getElement()->isCompatible(e) || in validateSPMV()
659 !X->getType()->getElement()->isCompatible(e) || in validateSPMV()
660 !Y->getType()->getElement()->isCompatible(e)) { in validateSPMV()
661 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSPMV()
663 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateSPMV()
664 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSPMV()
667 if (Ap->getType()->getY() > 1) { in validateSPMV()
668 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Ap must have a Y dimension of 0 or 1"); in validateSPMV()
671 int N = sqrt((double)Ap->getType()->getX() * 2); in validateSPMV()
672 if ((int)Ap->getType()->getX() != ((N * (N+1)) / 2)) { in validateSPMV()
673 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid dimension for Ap"); in validateSPMV()
676 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSPMV()
678 int expectedXDim = 1 + (N - 1) * incX; in validateSPMV()
679 if ((int)X->getType()->getX() != expectedXDim) { in validateSPMV()
680 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SPMV"); in validateSPMV()
682 int expectedYDim = 1 + (N - 1) * incY; in validateSPMV()
683 if ((int)Y->getType()->getX() != expectedYDim) { in validateSPMV()
684 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SPMV"); in validateSPMV()
689 static void validateGER(RS* mRS, const sp<const Element>& e, const sp<Allocation>& X, int incX, in validateGER() argument
691 if (!A->getType()->getElement()->isCompatible(e) || in validateGER()
692 !X->getType()->getElement()->isCompatible(e) || in validateGER()
693 !Y->getType()->getElement()->isCompatible(e) ) { in validateGER()
694 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateGER()
697 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateGER()
698 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateGER()
701 int M = A->getType()->getY(); in validateGER()
702 int N = A->getType()->getX(); in validateGER()
705 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "M and N must be 1 or greater for GER"); in validateGER()
708 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateGER()
710 int expectedXDim = 1 + (M - 1) * incX; in validateGER()
711 if ((int)X->getType()->getX() != expectedXDim) { in validateGER()
712 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for GER"); in validateGER()
714 int expectedYDim = 1 + (N - 1) * incY; in validateGER()
715 if ((int)Y->getType()->getX() != expectedYDim) { in validateGER()
716 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for GER"); in validateGER()
722 const sp<Allocation>& X, int incX, const sp<Allocation>& A) { in validateSYR() argument
723 if (!A->getType()->getElement()->isCompatible(e) || in validateSYR()
724 !X->getType()->getElement()->isCompatible(e)) { in validateSYR()
725 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSYR()
728 int N = A->getType()->getX(); in validateSYR()
730 if (X->getType()->getY() > 1) { in validateSYR()
731 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSYR()
733 if (N != (int)A->getType()->getY()) { in validateSYR()
734 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "A must be a symmetric matrix"); in validateSYR()
737 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSYR()
739 int expectedXDim = 1 + (N - 1) * incX; in validateSYR()
740 if ((int)X->getType()->getX() != expectedXDim) { in validateSYR()
741 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SYR"); in validateSYR()
746 const sp<Allocation>& X, int incX, const sp<Allocation>& Ap) { in validateSPR() argument
747 if (!Ap->getType()->getElement()->isCompatible(e) || in validateSPR()
748 !X->getType()->getElement()->isCompatible(e)) { in validateSPR()
749 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSPR()
751 if (X->getType()->getY() > 1) { in validateSPR()
752 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSPR()
755 if (Ap->getType()->getY() > 1) { in validateSPR()
756 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Ap must have a Y dimension of 0 or 1"); in validateSPR()
759 int N = sqrt((double)Ap->getType()->getX() * 2); in validateSPR()
760 if ((int)Ap->getType()->getX() != ((N * (N+1)) / 2)) { in validateSPR()
761 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid dimension for Ap"); in validateSPR()
764 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSPR()
766 int expectedXDim = 1 + (N - 1) * incX; in validateSPR()
767 if ((int)X->getType()->getX() != expectedXDim) { in validateSPR()
768 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SPR"); in validateSPR()
774 …tic int validateSYR2(RS* mRS, const sp<const Element>& e, RsBlasUplo Uplo, const sp<Allocation>& X, in validateSYR2() argument
776 if (!A->getType()->getElement()->isCompatible(e) || in validateSYR2()
777 !X->getType()->getElement()->isCompatible(e) || in validateSYR2()
778 !Y->getType()->getElement()->isCompatible(e)) { in validateSYR2()
779 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSYR2()
782 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateSYR2()
783 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSYR2()
786 int N = A->getType()->getX(); in validateSYR2()
788 if (N != (int)A->getType()->getY()) { in validateSYR2()
789 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "A must be a symmetric matrix"); in validateSYR2()
792 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSYR2()
794 int expectedXDim = 1 + (N - 1) * incX; in validateSYR2()
795 int expectedYDim = 1 + (N - 1) * incY; in validateSYR2()
796 if ((int)X->getType()->getX() != expectedXDim || (int)Y->getType()->getX() != expectedYDim) { in validateSYR2()
797 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SYR"); in validateSYR2()
802 …tic int validateSPR2(RS* mRS, const sp<const Element>& e, RsBlasUplo Uplo, const sp<Allocation>& X, in validateSPR2() argument
804 if (!Ap->getType()->getElement()->isCompatible(e) || in validateSPR2()
805 !X->getType()->getElement()->isCompatible(e) || in validateSPR2()
806 !Y->getType()->getElement()->isCompatible(e)) { in validateSPR2()
807 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSPR2()
809 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateSPR2()
810 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateSPR2()
813 if (Ap->getType()->getY() > 1) { in validateSPR2()
814 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Ap must have a Y dimension of 0 or 1"); in validateSPR2()
817 int N = sqrt((double)Ap->getType()->getX() * 2); in validateSPR2()
818 if ((int)Ap->getType()->getX() != ((N * (N+1)) / 2)) { in validateSPR2()
819 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid dimension for Ap"); in validateSPR2()
822 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateSPR2()
824 int expectedXDim = 1 + (N - 1) * incX; in validateSPR2()
825 int expectedYDim = 1 + (N - 1) * incY; in validateSPR2()
826 if ((int)X->getType()->getX() != expectedXDim || (int)Y->getType()->getX() != expectedYDim) { in validateSPR2()
827 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for SPR2"); in validateSPR2()
833 …criptIntrinsicBLAS::SSYMV(RsBlasUplo Uplo, float alpha, const sp<Allocation>& A, const sp<Allocati… in SSYMV() argument
835 int N = validateSYMV(mRS, Element::F32(mRS), Uplo, A, X, Y, incX, incY); in SSYMV()
836 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssymv, in SSYMV()
837 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in SSYMV()
838 A->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in SSYMV()
841 …trinsicBLAS::SSBMV(RsBlasUplo Uplo, int K, float alpha, const sp<Allocation>& A, const sp<Allocati… in SSBMV() argument
845 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in SSBMV()
847 int N = validateSYMV(mRS, Element::F32(mRS), Uplo, A, X, Y, incX, incY); in SSBMV()
848 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssbmv, in SSBMV()
849 0, 0, 0, Uplo, 0, 0, N, K, alpha, in SSBMV()
850 A->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in SSBMV()
853 …riptIntrinsicBLAS::SSPMV(RsBlasUplo Uplo, float alpha, const sp<Allocation>& Ap, const sp<Allocati… in SSPMV() argument
855 int N = validateSPMV(mRS, Element::F32(mRS), Uplo, Ap, X, incX, Y, incY); in SSPMV()
856 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sspmv, in SSPMV()
857 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in SSPMV()
858 Ap->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in SSPMV()
861 void ScriptIntrinsicBLAS::SGER(float alpha, const sp<Allocation>& X, int incX, in SGER() argument
863 int M = A->getType()->getY(); in SGER()
864 int N = A->getType()->getX(); in SGER()
865 validateGER(mRS, Element::F32(mRS), X, incX, Y, incY, A); in SGER()
866 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sger, in SGER()
867 0, 0, 0, 0, 0, M, N, 0, alpha, in SGER()
868 X->getID(), Y->getID(), 0.f, A->getID(), incX, incY, 0, 0); in SGER()
871 void ScriptIntrinsicBLAS::SSYR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, in SSYR() argument
873 int N = validateSYR(mRS, Element::F32(mRS), Uplo, X, incX, A); in SSYR()
874 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssyr, in SSYR()
875 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in SSYR()
876 X->getID(), A->getID(), 0.f, 0, incX, 0, 0, 0); in SSYR()
879 void ScriptIntrinsicBLAS::SSPR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, in SSPR() argument
881 int N = validateSPR(mRS, Element::F32(mRS), Uplo, X, incX, Ap); in SSPR()
882 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sspr, in SSPR()
884 alpha, X->getID(), Ap->getID(), 0.f, 0, incX, 0, 0, 0); in SSPR()
887 void ScriptIntrinsicBLAS::SSYR2(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, in SSYR2() argument
889 int N = validateSYR2(mRS, Element::F32(mRS), Uplo, X, incX, Y, incY, A); in SSYR2()
890 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssyr2, in SSYR2()
891 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in SSYR2()
892 X->getID(), Y->getID(), 0, A->getID(), incX, incY, 0, 0); in SSYR2()
895 void ScriptIntrinsicBLAS::SSPR2(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, in SSPR2() argument
897 int N = validateSPR2(mRS, Element::F32(mRS), Uplo, X, incX, Y, incY, Ap); in SSPR2()
898 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sspr2, in SSPR2()
899 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in SSPR2()
900 X->getID(), Y->getID(), 0, Ap->getID(), incX, incY, 0, 0); in SSPR2()
903 …riptIntrinsicBLAS::DSYMV(RsBlasUplo Uplo, double alpha, const sp<Allocation>& A, const sp<Allocati… in DSYMV() argument
905 int N = validateSYMV(mRS, Element::F64(mRS), Uplo, A, X, Y, incX, incY); in DSYMV()
906 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsymv, in DSYMV()
907 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSYMV()
908 A->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in DSYMV()
911 …rinsicBLAS::DSBMV(RsBlasUplo Uplo, int K, double alpha, const sp<Allocation>& A, const sp<Allocati… in DSBMV() argument
915 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be greater than or equal to 0"); in DSBMV()
917 int N = validateSYMV(mRS, Element::F64(mRS), Uplo, A, X, Y, incX, incY); in DSBMV()
918 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsbmv, in DSBMV()
919 0, 0, 0, Uplo, 0, 0, N, K, alpha, in DSBMV()
920 A->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in DSBMV()
923 …iptIntrinsicBLAS::DSPMV(RsBlasUplo Uplo, double alpha, const sp<Allocation>& Ap, const sp<Allocati… in DSPMV() argument
925 int N = validateSPMV(mRS, Element::F64(mRS), Uplo, Ap, X, incX, Y, incY); in DSPMV()
926 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dspmv, in DSPMV()
927 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSPMV()
928 Ap->getID(), X->getID(), beta, Y->getID(), incX, incY, 0, 0); in DSPMV()
931 void ScriptIntrinsicBLAS::DGER(double alpha, const sp<Allocation>& X, int incX, const sp<Allocation… in DGER() argument
933 int M = A->getType()->getY(); in DGER()
934 int N = A->getType()->getX(); in DGER()
935 validateGER(mRS, Element::F64(mRS), X, incX, Y, incY, A); in DGER()
936 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dger, in DGER()
937 0, 0, 0, 0, 0, M, N, 0, alpha, in DGER()
938 X->getID(), Y->getID(), 0.f, A->getID(), incX, incY, 0, 0); in DGER()
941 void ScriptIntrinsicBLAS::DSYR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, in DSYR() argument
943 int N = validateSYR(mRS, Element::F64(mRS), Uplo, X, incX, A); in DSYR()
944 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsyr, in DSYR()
945 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSYR()
946 X->getID(), A->getID(), 0.f, 0, incX, 0, 0, 0); in DSYR()
949 void ScriptIntrinsicBLAS::DSPR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, in DSPR() argument
951 int N = validateSPR(mRS, Element::F64(mRS), Uplo, X, incX, Ap); in DSPR()
952 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dspr, in DSPR()
953 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSPR()
954 X->getID(), Ap->getID(), 0.f, 0, incX, 0, 0, 0); in DSPR()
957 void ScriptIntrinsicBLAS::DSYR2(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, in DSYR2() argument
959 int N = validateSYR2(mRS, Element::F64(mRS), Uplo, X, incX, Y, incY, A); in DSYR2()
960 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsyr2, in DSYR2()
961 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSYR2()
962 X->getID(), Y->getID(), 0, A->getID(), incX, incY, 0, 0); in DSYR2()
965 void ScriptIntrinsicBLAS::DSPR2(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, in DSPR2() argument
967 int N = validateSPR2(mRS, Element::F64(mRS), Uplo, X, incX, Y, incY, Ap); in DSPR2()
968 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dspr2, in DSPR2()
969 0, 0, 0, Uplo, 0, 0, N, 0, alpha, in DSPR2()
970 X->getID(), Y->getID(), 0, Ap->getID(), incX, incY, 0, 0); in DSPR2()
978 static void validateGERU(RS* mRS, const sp<const Element>& e, const sp<Allocation>& X, int incX, in validateGERU() argument
980 if (!A->getType()->getElement()->isCompatible(e) || in validateGERU()
981 !X->getType()->getElement()->isCompatible(e) || in validateGERU()
982 !Y->getType()->getElement()->isCompatible(e)) { in validateGERU()
983 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateGERU()
985 if (X->getType()->getY() > 1 || Y->getType()->getY() > 1) { in validateGERU()
986 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "BLAS vectors must have Y dimension of 0 or 1"); in validateGERU()
989 int M = A->getType()->getY(); in validateGERU()
990 int N = A->getType()->getX(); in validateGERU()
992 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Vector increments must be greater than 0"); in validateGERU()
994 int expectedXDim = 1 + (M - 1) * incX; in validateGERU()
995 if ((int)X->getType()->getX() != expectedXDim) { in validateGERU()
996 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for GERU"); in validateGERU()
998 int expectedYDim = 1 + (N - 1) * incY; in validateGERU()
999 if ((int)Y->getType()->getX() != expectedYDim) { in validateGERU()
1000 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Incorrect vector dimensions for GERU"); in validateGERU()
1005 void ScriptIntrinsicBLAS::CHEMV(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& A, in CHEMV() argument
1006 … const sp<Allocation>& X, int incX, Float2 beta, const sp<Allocation>& Y, int incY) { in CHEMV() argument
1007 // HEMV is the same as SYR2 validation-wise in CHEMV()
1008 int N = validateSYR2(mRS, Element::F32_2(mRS), Uplo, X, incX, Y, incY, A); in CHEMV()
1009 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chemv, in CHEMV()
1011 alpha.x, alpha.y, A->getID(), X->getID(), in CHEMV()
1012 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in CHEMV()
1015 void ScriptIntrinsicBLAS::CHBMV(RsBlasUplo Uplo, int K, Float2 alpha, const sp<Allocation>& A, in CHBMV() argument
1016 … const sp<Allocation>& X, int incX, Float2 beta, const sp<Allocation>& Y, int incY) { in CHBMV() argument
1017 // HBMV is the same as SYR2 validation-wise in CHBMV()
1018 int N = validateSYR2(mRS, Element::F32_2(mRS), Uplo, X, incX, Y, incY, A); in CHBMV()
1020 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be 0 or greater for HBMV"); in CHBMV()
1022 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chbmv, in CHBMV()
1024 alpha.x, alpha.y, A->getID(), X->getID(), in CHBMV()
1025 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in CHBMV()
1028 void ScriptIntrinsicBLAS::CHPMV(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& Ap, in CHPMV() argument
1029 … const sp<Allocation>& X, int incX, Float2 beta, const sp<Allocation>& Y, int incY) { in CHPMV() argument
1031 int N = validateSPR2(mRS, Element::F32_2(mRS), Uplo, X, incX, Y, incY, Ap); in CHPMV()
1032 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chpmv, in CHPMV()
1034 alpha.x, alpha.y, Ap->getID(), X->getID(), in CHPMV()
1035 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in CHPMV()
1038 void ScriptIntrinsicBLAS::CGERU(Float2 alpha, const sp<Allocation>& X, int incX, in CGERU() argument
1040 validateGERU(mRS, Element::F32_2(mRS), X, incX, Y, incY, A); in CGERU()
1041 int M = A->getType()->getY(); in CGERU()
1042 int N = A->getType()->getX(); in CGERU()
1043 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cgeru, in CGERU()
1045 alpha.x, alpha.y, X->getID(), Y->getID(), in CGERU()
1046 0, 0, A->getID(), incX, incY, 0, 0); in CGERU()
1049 void ScriptIntrinsicBLAS::CGERC(Float2 alpha, const sp<Allocation>& X, int incX, in CGERC() argument
1052 validateGERU(mRS, Element::F32_2(mRS), X, incX, Y, incY, A); in CGERC()
1053 int M = A->getType()->getY(); in CGERC()
1054 int N = A->getType()->getX(); in CGERC()
1055 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cgerc, in CGERC()
1057 alpha.x, alpha.y, X->getID(), Y->getID(), in CGERC()
1058 0, 0, A->getID(), incX, incY, 0, 0); in CGERC()
1061 void ScriptIntrinsicBLAS::CHER(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, in CHER() argument
1064 int N = validateSYR(mRS, Element::F32_2(mRS), Uplo, X, incX, A); in CHER()
1065 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cher, in CHER()
1067 alpha, 0, X->getID(), 0, in CHER()
1068 0, 0, A->getID(), incX, 0, 0, 0); in CHER()
1071 void ScriptIntrinsicBLAS::CHPR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, in CHPR() argument
1074 int N = validateSPR(mRS, Element::F32_2(mRS), Uplo, X, incX, Ap); in CHPR()
1075 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chpr, in CHPR()
1077 alpha, 0, X->getID(), 0, in CHPR()
1078 0, 0, Ap->getID(), incX, 0, 0, 0); in CHPR()
1081 void ScriptIntrinsicBLAS::CHER2(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& X, int incX, in CHER2() argument
1084 int N = validateSYR2(mRS, Element::F32_2(mRS), Uplo, X, incX, Y, incY, A); in CHER2()
1085 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cher2, in CHER2()
1087 alpha.x, alpha.y, X->getID(), Y->getID(), in CHER2()
1088 0, 0, A->getID(), incX, incY, 0, 0); in CHER2()
1091 void ScriptIntrinsicBLAS::CHPR2(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& X, int incX, in CHPR2() argument
1094 int N = validateSPR2(mRS, Element::F32_2(mRS), Uplo, X, incX, Y, incY, Ap); in CHPR2()
1095 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chpr2, in CHPR2()
1097 alpha.x, alpha.y, X->getID(), Y->getID(), in CHPR2()
1098 0, 0, Ap->getID(), incX, incY, 0, 0); in CHPR2()
1101 void ScriptIntrinsicBLAS::ZHEMV(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& A, in ZHEMV() argument
1102 … const sp<Allocation>& X, int incX, Double2 beta, const sp<Allocation>& Y, int incY) { in ZHEMV() argument
1103 // HEMV is the same as SYR2 validation-wise in ZHEMV()
1104 int N = validateSYR2(mRS, Element::F64_2(mRS), Uplo, X, incX, Y, incY, A); in ZHEMV()
1105 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhemv, in ZHEMV()
1107 alpha.x, alpha.y, A->getID(), X->getID(), in ZHEMV()
1108 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in ZHEMV()
1111 …insicBLAS::ZHBMV(RsBlasUplo Uplo, int K, Double2 alpha, const sp<Allocation>& A, const sp<Allocati… in ZHBMV() argument
1113 // HBMV is the same as SYR2 validation-wise in ZHBMV()
1114 int N = validateSYR2(mRS, Element::F64_2(mRS), Uplo, X, incX, Y, incY, A); in ZHBMV()
1116 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "K must be 0 or greater for HBMV"); in ZHBMV()
1118 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhbmv, in ZHBMV()
1120 alpha.x, alpha.y, A->getID(), X->getID(), in ZHBMV()
1121 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in ZHBMV()
1124 …ptIntrinsicBLAS::ZHPMV(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& Ap, const sp<Allocati… in ZHPMV() argument
1127 int N = validateSPR2(mRS, Element::F64_2(mRS), Uplo, X, incX, Y, incY, Ap); in ZHPMV()
1128 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhpmv, in ZHPMV()
1130 alpha.x, alpha.y, Ap->getID(), X->getID(), in ZHPMV()
1131 beta.x, beta.y, Y->getID(), incX, incY, 0, 0); in ZHPMV()
1134 void ScriptIntrinsicBLAS::ZGERU(Double2 alpha, const sp<Allocation>& X, int incX, in ZGERU() argument
1136 validateGERU(mRS, Element::F64_2(mRS), X, incX, Y, incY, A); in ZGERU()
1137 int M = A->getType()->getY(); in ZGERU()
1138 int N = A->getType()->getX(); in ZGERU()
1139 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zgeru, in ZGERU()
1141 alpha.x, alpha.y, X->getID(), Y->getID(), in ZGERU()
1142 0, 0, A->getID(), incX, incY, 0, 0); in ZGERU()
1145 void ScriptIntrinsicBLAS::ZGERC(Double2 alpha, const sp<Allocation>& X, int incX, in ZGERC() argument
1148 validateGERU(mRS, Element::F64_2(mRS), X, incX, Y, incY, A); in ZGERC()
1149 int M = A->getType()->getY(); in ZGERC()
1150 int N = A->getType()->getX(); in ZGERC()
1151 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zgerc, in ZGERC()
1153 alpha.x, alpha.y, X->getID(), Y->getID(), in ZGERC()
1154 0, 0, A->getID(), incX, incY, 0, 0); in ZGERC()
1157 void ScriptIntrinsicBLAS::ZHER(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, in ZHER() argument
1160 int N = validateSYR(mRS, Element::F64_2(mRS), Uplo, X, incX, A); in ZHER()
1161 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zher, in ZHER()
1163 alpha, 0, X->getID(), 0, in ZHER()
1164 0, 0, A->getID(), incX, 0, 0, 0); in ZHER()
1167 void ScriptIntrinsicBLAS::ZHPR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, in ZHPR() argument
1170 int N = validateSPR(mRS, Element::F64_2(mRS), Uplo, X, incX, Ap); in ZHPR()
1171 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhpr, in ZHPR()
1173 alpha, 0, X->getID(), 0, in ZHPR()
1174 0, 0, Ap->getID(), incX, 0, 0, 0); in ZHPR()
1177 void ScriptIntrinsicBLAS::ZHER2(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& X, int incX, in ZHER2() argument
1180 int N = validateSYR2(mRS, Element::F64_2(mRS), Uplo, X, incX, Y, incY, A); in ZHER2()
1181 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zher2, in ZHER2()
1183 alpha.x, alpha.y, X->getID(), Y->getID(), in ZHER2()
1184 0, 0, A->getID(), incX, incY, 0, 0); in ZHER2()
1187 void ScriptIntrinsicBLAS::ZHPR2(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& X, int incX, in ZHPR2() argument
1190 int N = validateSPR2(mRS, Element::F64_2(mRS), Uplo, X, incX, Y, incY, Ap); in ZHPR2()
1191 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhpr2, in ZHPR2()
1193 alpha.x, alpha.y, X->getID(), Y->getID(), in ZHPR2()
1194 0, 0, Ap->getID(), incX, incY, 0, 0); in ZHPR2()
1204 int aM = -1, aN = -1, bM = -1, bN = -1, cM = -1, cN = -1; in validateL3()
1205 if ((A != nullptr && !A->getType()->getElement()->isCompatible(e)) || in validateL3()
1206 (B != nullptr && !B->getType()->getElement()->isCompatible(e)) || in validateL3()
1207 (C != nullptr && !C->getType()->getElement()->isCompatible(e))) { in validateL3()
1208 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateL3()
1212 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Allocation C cannot be null"); in validateL3()
1214 cM = C->getType()->getY(); in validateL3()
1215 cN = C->getType()->getX(); in validateL3()
1219 … mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Provided Matrix A without Matrix B, or vice versa"); in validateL3()
1222 bM = A->getType()->getY(); in validateL3()
1223 bN = A->getType()->getX(); in validateL3()
1226 aM = B->getType()->getY(); in validateL3()
1227 aN = B->getType()->getX(); in validateL3()
1232 aN = A->getType()->getY(); in validateL3()
1233 aM = A->getType()->getX(); in validateL3()
1235 aM = A->getType()->getY(); in validateL3()
1236 aN = A->getType()->getX(); in validateL3()
1241 bN = B->getType()->getY(); in validateL3()
1242 bM = B->getType()->getX(); in validateL3()
1244 bM = B->getType()->getY(); in validateL3()
1245 bN = B->getType()->getX(); in validateL3()
1251 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called BLAS with invalid dimensions"); in validateL3()
1256 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Matrix C is not symmetric"); in validateL3()
1259 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called BLAS with invalid dimensions"); in validateL3()
1264 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called BLAS with invalid dimensions"); in validateL3()
1270 void ScriptIntrinsicBLAS::SGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, float alpha, in SGEMM() argument
1274 int M = -1, N = -1, K = -1; in SGEMM()
1276 M = A->getType()->getX(); in SGEMM()
1277 K = A->getType()->getY(); in SGEMM()
1279 M = A->getType()->getY(); in SGEMM()
1280 K = A->getType()->getX(); in SGEMM()
1283 N = B->getType()->getY(); in SGEMM()
1285 N = B->getType()->getX(); in SGEMM()
1287 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_sgemm, in SGEMM()
1289 alpha, A->getID(), B->getID(), in SGEMM()
1290 beta, C->getID(), 0, 0, 0, 0); in SGEMM()
1293 void ScriptIntrinsicBLAS::DGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, double alpha, in DGEMM() argument
1296 int M = -1, N = -1, K = -1; in DGEMM()
1298 M = A->getType()->getX(); in DGEMM()
1299 K = A->getType()->getY(); in DGEMM()
1301 M = A->getType()->getY(); in DGEMM()
1302 K = A->getType()->getX(); in DGEMM()
1305 N = B->getType()->getY(); in DGEMM()
1307 N = B->getType()->getX(); in DGEMM()
1309 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dgemm, in DGEMM()
1311 alpha, A->getID(), B->getID(), in DGEMM()
1312 beta, C->getID(), 0, 0, 0, 0); in DGEMM()
1315 void ScriptIntrinsicBLAS::CGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Float2 alpha, in CGEMM() argument
1318 int M = -1, N = -1, K = -1; in CGEMM()
1320 M = A->getType()->getX(); in CGEMM()
1321 K = A->getType()->getY(); in CGEMM()
1323 M = A->getType()->getY(); in CGEMM()
1324 K = A->getType()->getX(); in CGEMM()
1327 N = B->getType()->getY(); in CGEMM()
1329 N = B->getType()->getX(); in CGEMM()
1331 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cgemm, in CGEMM()
1333 alpha.x, alpha.y, A->getID(), B->getID(), in CGEMM()
1334 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in CGEMM()
1337 void ScriptIntrinsicBLAS::ZGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Double2 alpha, in ZGEMM() argument
1340 int M = -1, N = -1, K = -1; in ZGEMM()
1342 M = A->getType()->getX(); in ZGEMM()
1343 K = A->getType()->getY(); in ZGEMM()
1345 M = A->getType()->getY(); in ZGEMM()
1346 K = A->getType()->getX(); in ZGEMM()
1349 N = B->getType()->getY(); in ZGEMM()
1351 N = B->getType()->getX(); in ZGEMM()
1353 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zgemm, in ZGEMM()
1355 alpha.x, alpha.y, A->getID(), B->getID(), in ZGEMM()
1356 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in ZGEMM()
1359 void ScriptIntrinsicBLAS::SSYMM(RsBlasSide Side, RsBlasUplo Uplo, float alpha, in SSYMM() argument
1362 if (A->getType()->getX() != A->getType()->getY()) { in SSYMM()
1363 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Matrix A is not symmetric"); in SSYMM()
1366 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssymm, in SSYMM()
1367 0, 0, Side, Uplo, 0, C->getType()->getY(), C->getType()->getX(), 0, in SSYMM()
1368 alpha, A->getID(), B->getID(), in SSYMM()
1369 beta, C->getID(), 0, 0, 0, 0); in SSYMM()
1372 void ScriptIntrinsicBLAS::DSYMM(RsBlasSide Side, RsBlasUplo Uplo, double alpha, in DSYMM() argument
1374 if (A->getType()->getX() != A->getType()->getY()) { in DSYMM()
1375 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Matrix A is not symmetric"); in DSYMM()
1378 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsymm, in DSYMM()
1379 0, 0, Side, Uplo, 0, C->getType()->getY(), C->getType()->getX(), 0, in DSYMM()
1380 alpha, A->getID(), B->getID(), in DSYMM()
1381 beta, C->getID(), 0, 0, 0, 0); in DSYMM()
1384 void ScriptIntrinsicBLAS::CSYMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, in CSYMM() argument
1386 if (A->getType()->getX() != A->getType()->getY()) { in CSYMM()
1387 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Matrix A is not symmetric"); in CSYMM()
1390 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_csymm, in CSYMM()
1391 0, 0, Side, Uplo, 0, C->getType()->getY(), C->getType()->getX(), 0, in CSYMM()
1392 alpha.x, alpha.y, A->getID(), B->getID(), in CSYMM()
1393 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in CSYMM()
1396 void ScriptIntrinsicBLAS::ZSYMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, in ZSYMM() argument
1398 if (A->getType()->getX() != A->getType()->getY()) { in ZSYMM()
1399 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Matrix A is not symmetric"); in ZSYMM()
1402 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zsymm, in ZSYMM()
1403 0, 0, Side, Uplo, 0, C->getType()->getY(), C->getType()->getX(), 0, in ZSYMM()
1404 alpha.x, alpha.y, A->getID(), B->getID(), in ZSYMM()
1405 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in ZSYMM()
1408 void ScriptIntrinsicBLAS::SSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, in SSYRK() argument
1411 int K = -1; in SSYRK()
1413 K = A->getType()->getY(); in SSYRK()
1415 K = A->getType()->getX(); in SSYRK()
1417 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssyrk, in SSYRK()
1418 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in SSYRK()
1419 alpha, A->getID(), 0, in SSYRK()
1420 beta, C->getID(), 0, 0, 0, 0); in SSYRK()
1423 void ScriptIntrinsicBLAS::DSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, in DSYRK() argument
1426 int K = -1; in DSYRK()
1428 K = A->getType()->getY(); in DSYRK()
1430 K = A->getType()->getX(); in DSYRK()
1432 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsyrk, in DSYRK()
1433 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in DSYRK()
1434 alpha, A->getID(), 0, in DSYRK()
1435 beta, C->getID(), 0, 0, 0, 0); in DSYRK()
1438 void ScriptIntrinsicBLAS::CSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, in CSYRK() argument
1441 int K = -1; in CSYRK()
1443 K = A->getType()->getY(); in CSYRK()
1445 K = A->getType()->getX(); in CSYRK()
1447 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_csyrk, in CSYRK()
1448 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in CSYRK()
1449 alpha.x, alpha.y, A->getID(), 0, in CSYRK()
1450 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in CSYRK()
1453 void ScriptIntrinsicBLAS::ZSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, in ZSYRK() argument
1456 int K = -1; in ZSYRK()
1458 K = A->getType()->getY(); in ZSYRK()
1460 K = A->getType()->getX(); in ZSYRK()
1462 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zsyrk, in ZSYRK()
1463 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in ZSYRK()
1464 alpha.x, alpha.y, A->getID(), 0, in ZSYRK()
1465 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in ZSYRK()
1470 if (!A->getType()->getElement()->isCompatible(e) || in validateSYR2K()
1471 !B->getType()->getElement()->isCompatible(e) || in validateSYR2K()
1472 !C->getType()->getElement()->isCompatible(e)) { in validateSYR2K()
1473 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateSYR2K()
1475 int Cdim = -1; in validateSYR2K()
1476 // A is n x k if no transpose, k x n if transpose in validateSYR2K()
1477 // C is n x n in validateSYR2K()
1480 Cdim = A->getType()->getX(); in validateSYR2K()
1483 Cdim = A->getType()->getY(); in validateSYR2K()
1485 if ((int)C->getType()->getX() != Cdim || (int)C->getType()->getY() != Cdim) { in validateSYR2K()
1486 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid symmetric matrix in SYR2K"); in validateSYR2K()
1489 …if (A->getType()->getX() != B->getType()->getX() || A->getType()->getY() != B->getType()->getY()) { in validateSYR2K()
1490 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid A and B in SYR2K"); in validateSYR2K()
1494 void ScriptIntrinsicBLAS::SSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, in SSYR2K() argument
1497 int K = -1; in SSYR2K()
1499 K = A->getType()->getY(); in SSYR2K()
1501 K = A->getType()->getX(); in SSYR2K()
1503 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_ssyr2k, in SSYR2K()
1504 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in SSYR2K()
1505 alpha, A->getID(), B->getID(), in SSYR2K()
1506 beta, C->getID(), 0, 0, 0, 0); in SSYR2K()
1509 void ScriptIntrinsicBLAS::DSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, in DSYR2K() argument
1512 int K = -1; in DSYR2K()
1514 K = A->getType()->getY(); in DSYR2K()
1516 K = A->getType()->getX(); in DSYR2K()
1518 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dsyr2k, in DSYR2K()
1519 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in DSYR2K()
1520 alpha, A->getID(), B->getID(), in DSYR2K()
1521 beta, C->getID(), 0, 0, 0, 0); in DSYR2K()
1524 void ScriptIntrinsicBLAS::CSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, in CSYR2K() argument
1527 int K = -1; in CSYR2K()
1529 K = A->getType()->getY(); in CSYR2K()
1531 K = A->getType()->getX(); in CSYR2K()
1533 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_csyr2k, in CSYR2K()
1534 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in CSYR2K()
1535 alpha.x, alpha.y, A->getID(), B->getID(), in CSYR2K()
1536 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in CSYR2K()
1539 void ScriptIntrinsicBLAS::ZSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, in ZSYR2K() argument
1542 int K = -1; in ZSYR2K()
1544 K = A->getType()->getY(); in ZSYR2K()
1546 K = A->getType()->getX(); in ZSYR2K()
1548 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zsyr2k, in ZSYR2K()
1549 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), K, in ZSYR2K()
1550 alpha.x, alpha.y, A->getID(), B->getID(), in ZSYR2K()
1551 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in ZSYR2K()
1556 int aM = -1, aN = -1, bM = -1, bN = -1; in validateTRMM()
1557 if (!A->getType()->getElement()->isCompatible(e) || in validateTRMM()
1558 !B->getType()->getElement()->isCompatible(e)) { in validateTRMM()
1559 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateTRMM()
1562 aM = A->getType()->getY(); in validateTRMM()
1563 aN = A->getType()->getX(); in validateTRMM()
1565 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRMM with a non-symmetric matrix A"); in validateTRMM()
1568 bM = B->getType()->getY(); in validateTRMM()
1569 bN = B->getType()->getX(); in validateTRMM()
1572 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRMM with invalid matrices"); in validateTRMM()
1576 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRMM with invalid matrices"); in validateTRMM()
1582 float alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in STRMM() argument
1584 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_strmm, in STRMM()
1586 B->getType()->getY(), B->getType()->getX(), 0, in STRMM()
1587 alpha, A->getID(), B->getID(), 0.f, 0, 0, 0, 0, 0); in STRMM()
1591 double alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in DTRMM() argument
1593 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtrmm, in DTRMM()
1595 B->getType()->getY(), B->getType()->getX(), 0, in DTRMM()
1596 alpha, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0); in DTRMM()
1600 Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in CTRMM() argument
1602 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctrmm, in CTRMM()
1604 B->getType()->getY(), B->getType()->getX(), 0, in CTRMM()
1605 alpha.x, alpha.y, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0, 0); in CTRMM()
1609 Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in ZTRMM() argument
1611 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztrmm, in ZTRMM()
1613 B->getType()->getY(), B->getType()->getX(), 0, in ZTRMM()
1614 alpha.x, alpha.y, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0, 0); in ZTRMM()
1619 int adim = -1, bM = -1, bN = -1; in validateTRSM()
1620 if (!A->getType()->getElement()->isCompatible(e) || in validateTRSM()
1621 !B->getType()->getElement()->isCompatible(e)) { in validateTRSM()
1622 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateTRSM()
1624 adim = A->getType()->getX(); in validateTRSM()
1625 if (adim != (int)A->getType()->getY()) { in validateTRSM()
1629 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRSM with a non-symmetric matrix A"); in validateTRSM()
1631 bM = B->getType()->getY(); in validateTRSM()
1632 bN = B->getType()->getX(); in validateTRSM()
1636 … mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRSM with invalid matrix dimensions"); in validateTRSM()
1641 … mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called TRSM with invalid matrix dimensions"); in validateTRSM()
1647 float alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in STRSM() argument
1649 nScriptIntrinsicBLAS_Single(mRS, mRS->getContext(), getID(), RsBlas_strsm, in STRSM()
1651 B->getType()->getY(), B->getType()->getX(), 0, in STRSM()
1652 alpha, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0); in STRSM()
1656 double alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in DTRSM() argument
1658 nScriptIntrinsicBLAS_Double(mRS, mRS->getContext(), getID(), RsBlas_dtrsm, in DTRSM()
1660 B->getType()->getY(), B->getType()->getX(), 0, in DTRSM()
1661 alpha, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0); in DTRSM()
1665 Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in CTRSM() argument
1667 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_ctrsm, in CTRSM()
1669 B->getType()->getY(), B->getType()->getX(), 0, in CTRSM()
1670 alpha.x, alpha.y, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0, 0); in CTRSM()
1674 Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& B) { in ZTRSM() argument
1676 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_ztrsm, in ZTRSM()
1678 B->getType()->getY(), B->getType()->getX(), 0, in ZTRSM()
1679 alpha.x, alpha.y, A->getID(), B->getID(), 0, 0, 0, 0, 0, 0, 0); in ZTRSM()
1684 if (!A->getType()->getElement()->isCompatible(e) || in validateHEMM()
1685 !B->getType()->getElement()->isCompatible(e) || in validateHEMM()
1686 !C->getType()->getElement()->isCompatible(e)) { in validateHEMM()
1687 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateHEMM()
1691 int adim = A->getType()->getX(); in validateHEMM()
1692 if (adim != (int)A->getType()->getY()) { in validateHEMM()
1693 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HEMM with non-square A"); in validateHEMM()
1695 if ((Side == RsBlasLeft && adim != (int)B->getType()->getY()) || in validateHEMM()
1696 (Side == RsBlasRight && adim != (int)B->getType()->getX())) { in validateHEMM()
1697 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HEMM with invalid B"); in validateHEMM()
1699 if (B->getType()->getX() != C->getType()->getX() || in validateHEMM()
1700 B->getType()->getY() != C->getType()->getY()) { in validateHEMM()
1701 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HEMM with mismatched B and C"); in validateHEMM()
1705 void ScriptIntrinsicBLAS::CHEMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, in CHEMM() argument
1708 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_chemm, in CHEMM()
1710 C->getType()->getY(), C->getType()->getX(), 0, in CHEMM()
1711 alpha.x, alpha.y, A->getID(), B->getID(), in CHEMM()
1712 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in CHEMM()
1715 void ScriptIntrinsicBLAS::ZHEMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, in ZHEMM() argument
1718 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zhemm, in ZHEMM()
1720 C->getType()->getY(), C->getType()->getX(), 0, in ZHEMM()
1721 alpha.x, alpha.y, A->getID(), B->getID(), in ZHEMM()
1722 beta.x, beta.y, C->getID(), 0, 0, 0, 0); in ZHEMM()
1727 if (!A->getType()->getElement()->isCompatible(e) || in validateHERK()
1728 !C->getType()->getElement()->isCompatible(e)) { in validateHERK()
1729 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateHERK()
1732 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Call HERK with invalid Transpose"); in validateHERK()
1734 int cdim = C->getType()->getX(); in validateHERK()
1735 if (cdim != (int)C->getType()->getY()) { in validateHERK()
1736 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HERK with non-square C"); in validateHERK()
1739 if (cdim != (int)A->getType()->getY()) { in validateHERK()
1740 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HERK with invalid A"); in validateHERK()
1743 if (cdim != (int)A->getType()->getX()) { in validateHERK()
1744 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HERK with invalid A"); in validateHERK()
1749 void ScriptIntrinsicBLAS::CHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, in CHERK() argument
1754 k = A->getType()->getY(); in CHERK()
1756 k = A->getType()->getX(); in CHERK()
1758 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cherk, in CHERK()
1759 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), k, in CHERK()
1760 alpha, 0, A->getID(), 0, in CHERK()
1761 beta, 0, C->getID(), 0, 0, 0, 0); in CHERK()
1764 void ScriptIntrinsicBLAS::ZHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, in ZHERK() argument
1769 k = A->getType()->getY(); in ZHERK()
1771 k = A->getType()->getX(); in ZHERK()
1773 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zherk, in ZHERK()
1774 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), k, in ZHERK()
1775 alpha, 0, A->getID(), 0, in ZHERK()
1776 beta, 0, C->getID(), 0, 0, 0, 0); in ZHERK()
1781 if (!A->getType()->getElement()->isCompatible(e) || in validateHER2K()
1782 !B->getType()->getElement()->isCompatible(e) || in validateHER2K()
1783 !C->getType()->getElement()->isCompatible(e)) { in validateHER2K()
1784 mRS->throwError(RS_ERROR_INVALID_ELEMENT, "Called BLAS with wrong Element type"); in validateHER2K()
1787 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Call HERK with invalid Transpose"); in validateHER2K()
1789 int cdim = C->getType()->getX(); in validateHER2K()
1790 if (cdim != (int)C->getType()->getY()) { in validateHER2K()
1791 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HER2K with non-square C"); in validateHER2K()
1794 if ((int)A->getType()->getY() != cdim) { in validateHER2K()
1795 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HER2K with invalid matrices"); in validateHER2K()
1798 if ((int)A->getType()->getX() != cdim) { in validateHER2K()
1799 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HER2K with invalid matrices"); in validateHER2K()
1802 …if (A->getType()->getX() != B->getType()->getX() || A->getType()->getY() != B->getType()->getY()) { in validateHER2K()
1803 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Called HER2K with invalid A and B matrices"); in validateHER2K()
1807 void ScriptIntrinsicBLAS::CHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, in CHER2K() argument
1812 k = A->getType()->getX(); in CHER2K()
1814 k = A->getType()->getY(); in CHER2K()
1816 nScriptIntrinsicBLAS_Complex(mRS, mRS->getContext(), getID(), RsBlas_cher2k, in CHER2K()
1817 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), k, in CHER2K()
1818 alpha.x, alpha.y, A->getID(), B->getID(), in CHER2K()
1819 beta, 0, C->getID(), 0, 0, 0, 0); in CHER2K()
1822 void ScriptIntrinsicBLAS::ZHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, in ZHER2K() argument
1827 k = A->getType()->getX(); in ZHER2K()
1829 k = A->getType()->getY(); in ZHER2K()
1831 nScriptIntrinsicBLAS_Z(mRS, mRS->getContext(), getID(), RsBlas_zher2k, in ZHER2K()
1832 Trans, 0, 0, Uplo, 0, 0, C->getType()->getX(), k, in ZHER2K()
1833 alpha.x, alpha.y, A->getID(), B->getID(), in ZHER2K()
1834 beta, 0, C->getID(), 0, 0, 0, 0); in ZHER2K()
1844 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid a_offset passed to BNNM"); in BNNM()
1847 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Invalid b_offset passed to BNNM"); in BNNM()
1849 int M = -1, N = -1, K = -1; in BNNM()
1850 M = A->getType()->getY(); in BNNM()
1851 N = B->getType()->getY(); in BNNM()
1852 K = A->getType()->getX(); in BNNM()
1854 nScriptIntrinsicBLAS_BNNM(mRS, mRS->getContext(), getID(), M, N, K, A->getID(), a_offset, in BNNM()
1855 B->getID(), b_offset, C->getID(), c_offset, c_mult); in BNNM()