xref: /aosp_15_r20/frameworks/rs/cpp/rsCppStructs.h (revision e1eccf28f96817838ad6867f7f39d2351ec11f56)
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_RSCPPSTRUCTS_H
18 #define ANDROID_RSCPPSTRUCTS_H
19 
20 #include "rsDefines.h"
21 #include "util/RefBase.h"
22 
23 #include <pthread.h>
24 
25 
26 /**
27  * Every row in an RS allocation is guaranteed to be aligned by this amount, and
28  * every row in a user-backed allocation must be aligned by this amount.
29  */
30 #define RS_CPU_ALLOCATION_ALIGNMENT 16
31 
32 struct dispatchTable;
33 
34 namespace android {
35 
36 namespace RSC {
37 
38 
39 typedef void (*ErrorHandlerFunc_t)(uint32_t errorNum, const char *errorText);
40 typedef void (*MessageHandlerFunc_t)(uint32_t msgNum, const void *msgData, size_t msgLen);
41 
42 class RS;
43 class BaseObj;
44 class Element;
45 class Type;
46 class Allocation;
47 class Script;
48 class ScriptC;
49 class Sampler;
50 
51 /**
52  * Possible error codes used by RenderScript. Once a status other than RS_SUCCESS
53  * is returned, the RenderScript context is considered dead and cannot perform any
54  * additional work.
55  */
56  enum RSError {
57      RS_SUCCESS = 0,                 ///< No error
58      RS_ERROR_INVALID_PARAMETER = 1, ///< An invalid parameter was passed to a function
59      RS_ERROR_RUNTIME_ERROR = 2,     ///< The RenderScript driver returned an error; this is
60                                      ///< often indicative of a kernel that crashed
61      RS_ERROR_INVALID_ELEMENT = 3,   ///< An invalid Element was passed to a function
62      RS_ERROR_MAX = 9999
63 
64  };
65 
66  /**
67   * Flags that can control RenderScript behavior on a per-context level.
68   */
69  enum RSInitFlags {
70      RS_INIT_SYNCHRONOUS = 1, ///< All RenderScript calls will be synchronous. May reduce latency.
71      RS_INIT_LOW_LATENCY = 2, ///< Prefer low latency devices over potentially higher throughput devices.
72      // Bitflag 4 is reserved for the context flag low power
73      RS_INIT_WAIT_FOR_ATTACH = 8,   ///< Kernel execution will hold to give time for a debugger to be attached
74      RS_INIT_MAX = 16
75  };
76 
77 
78 class Byte2 {
79  public:
80   int8_t x, y;
81 
Byte2(int8_t initX,int8_t initY)82   Byte2(int8_t initX, int8_t initY)
83     : x(initX), y(initY) {}
Byte2()84   Byte2() : x(0), y(0) {}
85 };
86 
87 class Byte3 {
88  public:
89   int8_t x, y, z;
90 
Byte3(int8_t initX,int8_t initY,int8_t initZ)91   Byte3(int8_t initX, int8_t initY, int8_t initZ)
92     : x(initX), y(initY), z(initZ) {}
Byte3()93   Byte3() : x(0), y(0), z(0) {}
94 };
95 
96 class Byte4 {
97  public:
98   int8_t x, y, z, w;
99 
Byte4(int8_t initX,int8_t initY,int8_t initZ,int8_t initW)100   Byte4(int8_t initX, int8_t initY, int8_t initZ, int8_t initW)
101     : x(initX), y(initY), z(initZ), w(initW) {}
Byte4()102   Byte4() : x(0), y(0), z(0), w(0) {}
103 };
104 
105 class UByte2 {
106  public:
107   uint8_t x, y;
108 
UByte2(uint8_t initX,uint8_t initY)109   UByte2(uint8_t initX, uint8_t initY)
110     : x(initX), y(initY) {}
UByte2()111   UByte2() : x(0), y(0) {}
112 };
113 
114 class UByte3 {
115  public:
116   uint8_t x, y, z;
117 
UByte3(uint8_t initX,uint8_t initY,uint8_t initZ)118   UByte3(uint8_t initX, uint8_t initY, uint8_t initZ)
119     : x(initX), y(initY), z(initZ) {}
UByte3()120   UByte3() : x(0), y(0), z(0) {}
121 };
122 
123 class UByte4 {
124  public:
125   uint8_t x, y, z, w;
126 
UByte4(uint8_t initX,uint8_t initY,uint8_t initZ,uint8_t initW)127   UByte4(uint8_t initX, uint8_t initY, uint8_t initZ, uint8_t initW)
128     : x(initX), y(initY), z(initZ), w(initW) {}
UByte4()129   UByte4() : x(0), y(0), z(0), w(0) {}
130 };
131 
132 class Short2 {
133  public:
134   int16_t x, y;
135 
Short2(int16_t initX,int16_t initY)136   Short2(int16_t initX, int16_t initY)
137     : x(initX), y(initY) {}
Short2()138   Short2() : x(0), y(0) {}
139 };
140 
141 class Short3 {
142  public:
143   int16_t x, y, z;
144 
Short3(int16_t initX,int16_t initY,int16_t initZ)145   Short3(int16_t initX, int16_t initY, int16_t initZ)
146     : x(initX), y(initY), z(initZ) {}
Short3()147   Short3() : x(0), y(0), z(0) {}
148 };
149 
150 class Short4 {
151  public:
152   int16_t x, y, z, w;
153 
Short4(int16_t initX,int16_t initY,int16_t initZ,int16_t initW)154   Short4(int16_t initX, int16_t initY, int16_t initZ, int16_t initW)
155     : x(initX), y(initY), z(initZ), w(initW) {}
Short4()156   Short4() : x(0), y(0), z(0), w(0) {}
157 };
158 
159 class UShort2 {
160  public:
161   uint16_t x, y;
162 
UShort2(uint16_t initX,uint16_t initY)163   UShort2(uint16_t initX, uint16_t initY)
164     : x(initX), y(initY) {}
UShort2()165   UShort2() : x(0), y(0) {}
166 };
167 
168 class UShort3 {
169  public:
170   uint16_t x, y, z;
171 
UShort3(uint16_t initX,uint16_t initY,uint16_t initZ)172   UShort3(uint16_t initX, uint16_t initY, uint16_t initZ)
173     : x(initX), y(initY), z(initZ) {}
UShort3()174   UShort3() : x(0), y(0), z(0) {}
175 };
176 
177 class UShort4 {
178  public:
179   uint16_t x, y, z, w;
180 
UShort4(uint16_t initX,uint16_t initY,uint16_t initZ,uint16_t initW)181   UShort4(uint16_t initX, uint16_t initY, uint16_t initZ, uint16_t initW)
182     : x(initX), y(initY), z(initZ), w(initW) {}
UShort4()183   UShort4() : x(0), y(0), z(0), w(0) {}
184 };
185 
186 class Int2 {
187  public:
188   int x, y;
189 
Int2(int initX,int initY)190   Int2(int initX, int initY)
191     : x(initX), y(initY) {}
Int2()192   Int2() : x(0), y(0) {}
193 };
194 
195 class Int3 {
196  public:
197   int x, y, z;
198 
Int3(int initX,int initY,int initZ)199   Int3(int initX, int initY, int initZ)
200     : x(initX), y(initY), z(initZ) {}
Int3()201   Int3() : x(0), y(0), z(0) {}
202 };
203 
204 class Int4 {
205  public:
206   int x, y, z, w;
207 
Int4(int initX,int initY,int initZ,int initW)208   Int4(int initX, int initY, int initZ, int initW)
209     : x(initX), y(initY), z(initZ), w(initW) {}
Int4()210   Int4() : x(0), y(0), z(0), w(0) {}
211 };
212 
213 class UInt2 {
214  public:
215   uint32_t x, y;
216 
UInt2(uint32_t initX,uint32_t initY)217   UInt2(uint32_t initX, uint32_t initY)
218     : x(initX), y(initY) {}
UInt2()219   UInt2() : x(0), y(0) {}
220 };
221 
222 class UInt3 {
223  public:
224   uint32_t x, y, z;
225 
UInt3(uint32_t initX,uint32_t initY,uint32_t initZ)226   UInt3(uint32_t initX, uint32_t initY, uint32_t initZ)
227     : x(initX), y(initY), z(initZ) {}
UInt3()228   UInt3() : x(0), y(0), z(0) {}
229 };
230 
231 class UInt4 {
232  public:
233   uint32_t x, y, z, w;
234 
UInt4(uint32_t initX,uint32_t initY,uint32_t initZ,uint32_t initW)235   UInt4(uint32_t initX, uint32_t initY, uint32_t initZ, uint32_t initW)
236     : x(initX), y(initY), z(initZ), w(initW) {}
UInt4()237   UInt4() : x(0), y(0), z(0), w(0) {}
238 };
239 
240 class Long2 {
241  public:
242   int64_t x, y;
243 
Long2(int64_t initX,int64_t initY)244   Long2(int64_t initX, int64_t initY)
245     : x(initX), y(initY) {}
Long2()246   Long2() : x(0), y(0) {}
247 };
248 
249 class Long3 {
250  public:
251   int64_t x, y, z;
252 
Long3(int64_t initX,int64_t initY,int64_t initZ)253   Long3(int64_t initX, int64_t initY, int64_t initZ)
254     : x(initX), y(initY), z(initZ) {}
Long3()255   Long3() : x(0), y(0), z(0) {}
256 };
257 
258 class Long4 {
259  public:
260   int64_t x, y, z, w;
261 
Long4(int64_t initX,int64_t initY,int64_t initZ,int64_t initW)262   Long4(int64_t initX, int64_t initY, int64_t initZ, int64_t initW)
263     : x(initX), y(initY), z(initZ), w(initW) {}
Long4()264   Long4() : x(0), y(0), z(0), w(0) {}
265 };
266 
267 class ULong2 {
268  public:
269   uint64_t x, y;
270 
ULong2(uint64_t initX,uint64_t initY)271   ULong2(uint64_t initX, uint64_t initY)
272     : x(initX), y(initY) {}
ULong2()273   ULong2() : x(0), y(0) {}
274 };
275 
276 class ULong3 {
277  public:
278   uint64_t x, y, z;
279 
ULong3(uint64_t initX,uint64_t initY,uint64_t initZ)280   ULong3(uint64_t initX, uint64_t initY, uint64_t initZ)
281     : x(initX), y(initY), z(initZ) {}
ULong3()282   ULong3() : x(0), y(0), z(0) {}
283 };
284 
285 class ULong4 {
286  public:
287   uint64_t x, y, z, w;
288 
ULong4(uint64_t initX,uint64_t initY,uint64_t initZ,uint64_t initW)289   ULong4(uint64_t initX, uint64_t initY, uint64_t initZ, uint64_t initW)
290     : x(initX), y(initY), z(initZ), w(initW) {}
ULong4()291   ULong4() : x(0), y(0), z(0), w(0) {}
292 };
293 
294 class Float2 {
295  public:
296   float x, y;
297 
Float2(float initX,float initY)298   Float2(float initX, float initY)
299     : x(initX), y(initY) {}
Float2()300   Float2() : x(0), y(0) {}
301 };
302 
303 class Float3 {
304  public:
305   float x, y, z;
306 
Float3(float initX,float initY,float initZ)307   Float3(float initX, float initY, float initZ)
308     : x(initX), y(initY), z(initZ) {}
Float3()309   Float3() : x(0.f), y(0.f), z(0.f) {}
310 };
311 
312 class Float4 {
313  public:
314   float x, y, z, w;
315 
Float4(float initX,float initY,float initZ,float initW)316   Float4(float initX, float initY, float initZ, float initW)
317     : x(initX), y(initY), z(initZ), w(initW) {}
Float4()318   Float4() : x(0.f), y(0.f), z(0.f), w(0.f) {}
319 };
320 
321 class Double2 {
322  public:
323   double x, y;
324 
Double2(double initX,double initY)325   Double2(double initX, double initY)
326     : x(initX), y(initY) {}
Double2()327   Double2() : x(0), y(0) {}
328 };
329 
330 class Double3 {
331  public:
332   double x, y, z;
333 
Double3(double initX,double initY,double initZ)334   Double3(double initX, double initY, double initZ)
335     : x(initX), y(initY), z(initZ) {}
Double3()336   Double3() : x(0), y(0), z(0) {}
337 };
338 
339 class Double4 {
340  public:
341   double x, y, z, w;
342 
Double4(double initX,double initY,double initZ,double initW)343   Double4(double initX, double initY, double initZ, double initW)
344     : x(initX), y(initY), z(initZ), w(initW) {}
Double4()345   Double4() : x(0), y(0), z(0), w(0) {}
346 };
347 
348  /**
349   * The RenderScript context. This class controls initialization, resource management, and teardown.
350   */
351  class RS : public android::RSC::LightRefBase<RS> {
352 
353  public:
354     RS();
355     virtual ~RS();
356 
357     /**
358      * Initializes a RenderScript context. A context must be initialized before it can be used.
359      * @param[in] name Directory name to be used by this context. This should be equivalent to
360      * Context.getCacheDir().
361      * @param[in] flags Optional flags for this context.
362      * @return true on success
363      */
364     bool init(const char * name, uint32_t flags = 0);
365 
366     /**
367      * Initializes a RenderScript context. A context must be initialized before it can be used.
368      * @param[in] name Directory name to be used by this context. This should be equivalent to
369      * Context.getCacheDir().
370      * @param[in] flags Flags for this context.
371      * @param[in] targetApi Target RS API level.
372      * @return true on success
373      */
374     bool init(const char * name, uint32_t flags, int targetApi);
375 
376     /**
377      * Sets the error handler function for this context. This error handler is
378      * called whenever an error is set.
379      *
380      * @param[in] func Error handler function
381      */
382     void setErrorHandler(ErrorHandlerFunc_t func);
383 
384     /**
385      * Returns the current error handler function for this context.
386      *
387      * @return pointer to current error handler function or NULL if not set
388      */
getErrorHandler()389     ErrorHandlerFunc_t getErrorHandler() { return mErrorFunc; }
390 
391     /**
392      * Sets the message handler function for this context. This message handler
393      * is called whenever a message is sent from a RenderScript kernel.
394      *
395      *  @param[in] func Message handler function
396      */
397     void setMessageHandler(MessageHandlerFunc_t func);
398 
399     /**
400      * Returns the current message handler function for this context.
401      *
402      * @return pointer to current message handler function or NULL if not set
403      */
getMessageHandler()404     MessageHandlerFunc_t getMessageHandler() { return mMessageFunc; }
405 
406     /**
407      * Returns current status for the context.
408      *
409      * @return current error
410      */
411     RSError getError();
412 
413     /**
414      * Waits for any currently running asynchronous operations to finish. This
415      * should only be used for performance testing and timing.
416      */
417     void finish();
418 
getContext()419     RsContext getContext() { return mContext; }
420     void throwError(RSError error, const char *errMsg);
421 
422     static dispatchTable* dispatch;
423 
424  private:
425     static bool usingNative;
426     static bool initDispatch(int targetApi);
427 
428     static void * threadProc(void *);
429 
430     static bool gInitialized;
431     static pthread_mutex_t gInitMutex;
432 
433     pthread_t mMessageThreadId;
434     pid_t mNativeMessageThreadId;
435     bool mMessageRun;
436 
437     RsContext mContext;
438     RSError mCurrentError;
439 
440     ErrorHandlerFunc_t mErrorFunc;
441     MessageHandlerFunc_t mMessageFunc;
442     bool mInit;
443 
444     char mCacheDir[PATH_MAX+1];
445     uint32_t mCacheDirLen;
446 
447     struct {
448         sp<const Element> U8;
449         sp<const Element> U8_2;
450         sp<const Element> U8_3;
451         sp<const Element> U8_4;
452         sp<const Element> I8;
453         sp<const Element> I8_2;
454         sp<const Element> I8_3;
455         sp<const Element> I8_4;
456         sp<const Element> U16;
457         sp<const Element> U16_2;
458         sp<const Element> U16_3;
459         sp<const Element> U16_4;
460         sp<const Element> I16;
461         sp<const Element> I16_2;
462         sp<const Element> I16_3;
463         sp<const Element> I16_4;
464         sp<const Element> U32;
465         sp<const Element> U32_2;
466         sp<const Element> U32_3;
467         sp<const Element> U32_4;
468         sp<const Element> I32;
469         sp<const Element> I32_2;
470         sp<const Element> I32_3;
471         sp<const Element> I32_4;
472         sp<const Element> U64;
473         sp<const Element> U64_2;
474         sp<const Element> U64_3;
475         sp<const Element> U64_4;
476         sp<const Element> I64;
477         sp<const Element> I64_2;
478         sp<const Element> I64_3;
479         sp<const Element> I64_4;
480         sp<const Element> F16;
481         sp<const Element> F16_2;
482         sp<const Element> F16_3;
483         sp<const Element> F16_4;
484         sp<const Element> F32;
485         sp<const Element> F32_2;
486         sp<const Element> F32_3;
487         sp<const Element> F32_4;
488         sp<const Element> F64;
489         sp<const Element> F64_2;
490         sp<const Element> F64_3;
491         sp<const Element> F64_4;
492         sp<const Element> BOOLEAN;
493 
494         sp<const Element> ELEMENT;
495         sp<const Element> TYPE;
496         sp<const Element> ALLOCATION;
497         sp<const Element> SAMPLER;
498         sp<const Element> SCRIPT;
499         sp<const Element> MESH;
500         sp<const Element> PROGRAM_FRAGMENT;
501         sp<const Element> PROGRAM_VERTEX;
502         sp<const Element> PROGRAM_RASTER;
503         sp<const Element> PROGRAM_STORE;
504 
505         sp<const Element> A_8;
506         sp<const Element> RGB_565;
507         sp<const Element> RGB_888;
508         sp<const Element> RGBA_5551;
509         sp<const Element> RGBA_4444;
510         sp<const Element> RGBA_8888;
511 
512         sp<const Element> YUV;
513 
514         sp<const Element> MATRIX_4X4;
515         sp<const Element> MATRIX_3X3;
516         sp<const Element> MATRIX_2X2;
517     } mElements;
518 
519     struct {
520         sp<const Sampler> CLAMP_NEAREST;
521         sp<const Sampler> CLAMP_LINEAR;
522         sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR;
523         sp<const Sampler> WRAP_NEAREST;
524         sp<const Sampler> WRAP_LINEAR;
525         sp<const Sampler> WRAP_LINEAR_MIP_LINEAR;
526         sp<const Sampler> MIRRORED_REPEAT_NEAREST;
527         sp<const Sampler> MIRRORED_REPEAT_LINEAR;
528         sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR;
529     } mSamplers;
530     friend class Sampler;
531     friend class Element;
532     friend class ScriptC;
533 };
534 
535  /**
536   * Base class for all RenderScript objects. Not for direct use by developers.
537   */
538 class BaseObj : public android::RSC::LightRefBase<BaseObj> {
539 public:
540     void * getID() const;
541     virtual ~BaseObj();
542     virtual void updateFromNative();
543     virtual bool equals(const sp<const BaseObj>& obj);
544 
545 protected:
546     void *mID;
547     RS* mRS;
548     const char * mName;
549 
550     BaseObj(void *id, sp<RS> rs);
551     void checkValid();
552 
553     static void * getObjID(const sp<const BaseObj>& o);
554 
555 };
556 
557  /**
558   * This class provides the primary method through which data is passed to and
559   * from RenderScript kernels. An Allocation provides the backing store for a
560   * given Type.
561   *
562   * An Allocation also contains a set of usage flags that denote how the
563   * Allocation could be used. For example, an Allocation may have usage flags
564   * specifying that it can be used from a script as well as input to a
565   * Sampler. A developer must synchronize across these different usages using
566   * syncAll(int) in order to ensure that different users of the Allocation have
567   * a consistent view of memory. For example, in the case where an Allocation is
568   * used as the output of one kernel and as Sampler input in a later kernel, a
569   * developer must call syncAll(RS_ALLOCATION_USAGE_SCRIPT) prior to launching the
570   * second kernel to ensure correctness.
571   */
572 class Allocation : public BaseObj {
573 protected:
574     sp<const Type> mType;
575     uint32_t mUsage;
576     sp<Allocation> mAdaptedAllocation;
577 
578     bool mConstrainedLOD;
579     bool mConstrainedFace;
580     bool mConstrainedY;
581     bool mConstrainedZ;
582     bool mReadAllowed;
583     bool mWriteAllowed;
584     bool mAutoPadding;
585     uint32_t mSelectedY;
586     uint32_t mSelectedZ;
587     uint32_t mSelectedLOD;
588     RsAllocationCubemapFace mSelectedFace;
589 
590     uint32_t mCurrentDimX;
591     uint32_t mCurrentDimY;
592     uint32_t mCurrentDimZ;
593     uint32_t mCurrentCount;
594 
595     void * getIDSafe() const;
596     void updateCacheInfo(const sp<const Type>& t);
597 
598     Allocation(void *id, sp<RS> rs, sp<const Type> t, uint32_t usage);
599 
600     void validateIsInt64();
601     void validateIsInt32();
602     void validateIsInt16();
603     void validateIsInt8();
604     void validateIsFloat32();
605     void validateIsFloat64();
606     void validateIsObject();
607 
608     virtual void updateFromNative();
609 
610     void validate2DRange(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h);
611     void validate3DRange(uint32_t xoff, uint32_t yoff, uint32_t zoff,
612                          uint32_t w, uint32_t h, uint32_t d);
613 
614 public:
615 
616     /**
617      * Return Type for the allocation.
618      * @return pointer to underlying Type
619      */
getType()620     sp<const Type> getType() const {
621         return mType;
622     }
623 
624     /**
625      * Enable/Disable AutoPadding for Vec3 elements.
626      *
627      * @param useAutoPadding True: enable AutoPadding; flase: disable AutoPadding
628      *
629      */
setAutoPadding(bool useAutoPadding)630     void setAutoPadding(bool useAutoPadding) {
631         mAutoPadding = useAutoPadding;
632     }
633 
634     /**
635      * Propagate changes from one usage of the Allocation to other usages of the Allocation.
636      * @param[in] srcLocation source location with changes to propagate elsewhere
637      */
638     void syncAll(RsAllocationUsageType srcLocation);
639 
640     /**
641      * Send a buffer to the output stream.  The contents of the Allocation will
642      * be undefined after this operation. This operation is only valid if
643      * USAGE_IO_OUTPUT is set on the Allocation.
644      */
645     void ioSendOutput();
646 
647     /**
648      * Receive the latest input into the Allocation. This operation
649      * is only valid if USAGE_IO_INPUT is set on the Allocation.
650      */
651     void ioGetInput();
652 
653     /**
654      * Generate a mipmap chain. This is only valid if the Type of the Allocation
655      * includes mipmaps. This function will generate a complete set of mipmaps
656      * from the top level LOD and place them into the script memory space. If
657      * the Allocation is also using other memory spaces, a call to
658      * syncAll(Allocation.USAGE_SCRIPT) is required.
659      */
660     void generateMipmaps();
661 
662     /**
663      * Copy an array into part of this Allocation.
664      * @param[in] off offset of first Element to be overwritten
665      * @param[in] count number of Elements to copy
666      * @param[in] data array from which to copy
667      */
668     void copy1DRangeFrom(uint32_t off, size_t count, const void *data);
669 
670     /**
671      * Copy part of an Allocation into part of this Allocation.
672      * @param[in] off offset of first Element to be overwritten
673      * @param[in] count number of Elements to copy
674      * @param[in] data Allocation from which to copy
675      * @param[in] dataOff offset of first Element in data to copy
676      */
677     void copy1DRangeFrom(uint32_t off, size_t count, const sp<const Allocation>& data, uint32_t dataOff);
678 
679     /**
680      * Copy an array into part of this Allocation.
681      * @param[in] off offset of first Element to be overwritten
682      * @param[in] count number of Elements to copy
683      * @param[in] data array from which to copy
684      */
685     void copy1DRangeTo(uint32_t off, size_t count, void *data);
686 
687     /**
688      * Copy entire array to an Allocation.
689      * @param[in] data array from which to copy
690      */
691     void copy1DFrom(const void* data);
692 
693     /**
694      * Copy entire Allocation to an array.
695      * @param[in] data destination array
696      */
697     void copy1DTo(void* data);
698 
699     /**
700      * Copy from an array into a rectangular region in this Allocation. The
701      * array is assumed to be tightly packed.
702      * @param[in] xoff X offset of region to update in this Allocation
703      * @param[in] yoff Y offset of region to update in this Allocation
704      * @param[in] w Width of region to update
705      * @param[in] h Height of region to update
706      * @param[in] data Array from which to copy
707      */
708     void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
709                          const void *data);
710 
711     /**
712      * Copy from this Allocation into a rectangular region in an array. The
713      * array is assumed to be tightly packed.
714      * @param[in] xoff X offset of region to copy from this Allocation
715      * @param[in] yoff Y offset of region to copy from this Allocation
716      * @param[in] w Width of region to update
717      * @param[in] h Height of region to update
718      * @param[in] data destination array
719      */
720     void copy2DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
721                        void *data);
722 
723     /**
724      * Copy from an Allocation into a rectangular region in this Allocation.
725      * @param[in] xoff X offset of region to update in this Allocation
726      * @param[in] yoff Y offset of region to update in this Allocation
727      * @param[in] w Width of region to update
728      * @param[in] h Height of region to update
729      * @param[in] data Allocation from which to copy
730      * @param[in] dataXoff X offset of region to copy from in data
731      * @param[in] dataYoff Y offset of region to copy from in data
732      */
733     void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
734                          const sp<const Allocation>& data, uint32_t dataXoff, uint32_t dataYoff);
735 
736     /**
737      * Copy from a strided array into a rectangular region in this Allocation.
738      * @param[in] xoff X offset of region to update in this Allocation
739      * @param[in] yoff Y offset of region to update in this Allocation
740      * @param[in] w Width of region to update
741      * @param[in] h Height of region to update
742      * @param[in] data array from which to copy
743      * @param[in] stride stride of data in bytes
744      */
745     void copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
746                            const void *data, size_t stride);
747 
748     /**
749      * Copy from a strided array into this Allocation.
750      * @param[in] data array from which to copy
751      * @param[in] stride stride of data in bytes
752      */
753     void copy2DStridedFrom(const void *data, size_t stride);
754 
755     /**
756      * Copy from a rectangular region in this Allocation into a strided array.
757      * @param[in] xoff X offset of region to update in this Allocation
758      * @param[in] yoff Y offset of region to update in this Allocation
759      * @param[in] w Width of region to update
760      * @param[in] h Height of region to update
761      * @param[in] data destination array
762      * @param[in] stride stride of data in bytes
763      */
764     void copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
765                          void *data, size_t stride);
766 
767     /**
768      * Copy this Allocation into a strided array.
769      * @param[in] data destination array
770      * @param[in] stride stride of data in bytes
771      */
772     void copy2DStridedTo(void *data, size_t stride);
773 
774 
775     /**
776      * Copy from an array into a 3D region in this Allocation. The
777      * array is assumed to be tightly packed.
778      * @param[in] xoff X offset of region to update in this Allocation
779      * @param[in] yoff Y offset of region to update in this Allocation
780      * @param[in] zoff Z offset of region to update in this Allocation
781      * @param[in] w Width of region to update
782      * @param[in] h Height of region to update
783      * @param[in] d Depth of region to update
784      * @param[in] data Array from which to copy
785      */
786     void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
787                          uint32_t h, uint32_t d, const void* data);
788 
789     /**
790      * Copy from an Allocation into a 3D region in this Allocation.
791      * @param[in] xoff X offset of region to update in this Allocation
792      * @param[in] yoff Y offset of region to update in this Allocation
793      * @param[in] zoff Z offset of region to update in this Allocation
794      * @param[in] w Width of region to update
795      * @param[in] h Height of region to update
796      * @param[in] d Depth of region to update
797      * @param[in] data Allocation from which to copy
798      * @param[in] dataXoff X offset of region in data to copy from
799      * @param[in] dataYoff Y offset of region in data to copy from
800      * @param[in] dataZoff Z offset of region in data to copy from
801      */
802     void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff,
803                          uint32_t w, uint32_t h, uint32_t d,
804                          const sp<const Allocation>& data,
805                          uint32_t dataXoff, uint32_t dataYoff, uint32_t dataZoff);
806 
807     /**
808      * Copy a 3D region in this Allocation into an array. The
809      * array is assumed to be tightly packed.
810      * @param[in] xoff X offset of region to update in this Allocation
811      * @param[in] yoff Y offset of region to update in this Allocation
812      * @param[in] zoff Z offset of region to update in this Allocation
813      * @param[in] w Width of region to update
814      * @param[in] h Height of region to update
815      * @param[in] d Depth of region to update
816      * @param[in] data Array from which to copy
817      */
818     void copy3DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
819                          uint32_t h, uint32_t d, void* data);
820 
821     /**
822      * Creates an Allocation for use by scripts with a given Type.
823      * @param[in] rs Context to which the Allocation will belong
824      * @param[in] type Type of the Allocation
825      * @param[in] mipmaps desired mipmap behavior for the Allocation
826      * @param[in] usage usage for the Allocation
827      * @return new Allocation
828      */
829     static sp<Allocation> createTyped(const sp<RS>& rs, const sp<const Type>& type,
830                                    RsAllocationMipmapControl mipmaps, uint32_t usage);
831 
832     /**
833      * Creates an Allocation for use by scripts with a given Type and a backing pointer. For use
834      * with RS_ALLOCATION_USAGE_SHARED.
835      * @param[in] rs Context to which the Allocation will belong
836      * @param[in] type Type of the Allocation
837      * @param[in] mipmaps desired mipmap behavior for the Allocation
838      * @param[in] usage usage for the Allocation
839      * @param[in] pointer existing backing store to use for this Allocation if possible
840      * @return new Allocation
841      */
842     static sp<Allocation> createTyped(const sp<RS>& rs, const sp<const Type>& type,
843                                    RsAllocationMipmapControl mipmaps, uint32_t usage, void * pointer);
844 
845     /**
846      * Creates an Allocation for use by scripts with a given Type with no mipmaps.
847      * @param[in] rs Context to which the Allocation will belong
848      * @param[in] type Type of the Allocation
849      * @param[in] usage usage for the Allocation
850      * @return new Allocation
851      */
852     static sp<Allocation> createTyped(const sp<RS>& rs, const sp<const Type>& type,
853                                    uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
854     /**
855      * Creates an Allocation with a specified number of given elements.
856      * @param[in] rs Context to which the Allocation will belong
857      * @param[in] e Element used in the Allocation
858      * @param[in] count Number of elements of the Allocation
859      * @param[in] usage usage for the Allocation
860      * @return new Allocation
861      */
862     static sp<Allocation> createSized(const sp<RS>& rs, const sp<const Element>& e, size_t count,
863                                    uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
864 
865     /**
866      * Creates a 2D Allocation with a specified number of given elements.
867      * @param[in] rs Context to which the Allocation will belong
868      * @param[in] e Element used in the Allocation
869      * @param[in] x Width in Elements of the Allocation
870      * @param[in] y Height of the Allocation
871      * @param[in] usage usage for the Allocation
872      * @return new Allocation
873      */
874     static sp<Allocation> createSized2D(const sp<RS>& rs, const sp<const Element>& e,
875                                         size_t x, size_t y,
876                                         uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
877 
878 
879     /**
880      * Get the backing pointer for a USAGE_SHARED allocation.
881      * @param[in] stride optional parameter. when non-NULL, will contain
882      *   stride in bytes of a 2D Allocation
883      * @return pointer to data
884      */
885     void * getPointer(size_t *stride = NULL);
886 };
887 
888  /**
889   * An Element represents one item within an Allocation. An Element is roughly
890   * equivalent to a C type in a RenderScript kernel. Elements may be basic
891   * or complex. Some basic elements are:
892 
893   * - A single float value (equivalent to a float in a kernel)
894   * - A four-element float vector (equivalent to a float4 in a kernel)
895   * - An unsigned 32-bit integer (equivalent to an unsigned int in a kernel)
896   * - A single signed 8-bit integer (equivalent to a char in a kernel)
897 
898   * Basic Elements are comprised of a Element.DataType and a
899   * Element.DataKind. The DataType encodes C type information of an Element,
900   * while the DataKind encodes how that Element should be interpreted by a
901   * Sampler. Note that Allocation objects with DataKind USER cannot be used as
902   * input for a Sampler. In general, Allocation objects that are intended for
903   * use with a Sampler should use bitmap-derived Elements such as
904   * Element::RGBA_8888.
905  */
906 
907 
908 class Element : public BaseObj {
909 public:
910     bool isComplex();
911 
912     /**
913      * Elements could be simple, such as an int or a float, or a structure with
914      * multiple sub-elements, such as a collection of floats, float2,
915      * float4. This function returns zero for simple elements or the number of
916      * sub-elements otherwise.
917      * @return number of sub-elements
918      */
getSubElementCount()919     size_t getSubElementCount() {
920         return mVisibleElementMapSize;
921     }
922 
923     /**
924      * For complex Elements, this returns the sub-element at a given index.
925      * @param[in] index index of sub-element
926      * @return sub-element
927      */
928     sp<const Element> getSubElement(uint32_t index);
929 
930     /**
931      * For complex Elements, this returns the name of the sub-element at a given
932      * index.
933      * @param[in] index index of sub-element
934      * @return name of sub-element
935      */
936     const char * getSubElementName(uint32_t index);
937 
938     /**
939      * For complex Elements, this returns the size of the sub-element at a given
940      * index.
941      * @param[in] index index of sub-element
942      * @return size of sub-element
943      */
944     size_t getSubElementArraySize(uint32_t index);
945 
946     /**
947      * Returns the location of a sub-element within a complex Element.
948      * @param[in] index index of sub-element
949      * @return offset in bytes
950      */
951     uint32_t getSubElementOffsetBytes(uint32_t index);
952 
953     /**
954      * Returns the data type used for the Element.
955      * @return data type
956      */
getDataType()957     RsDataType getDataType() const {
958         return mType;
959     }
960 
961     /**
962      * Returns the data kind used for the Element.
963      * @return data kind
964      */
getDataKind()965     RsDataKind getDataKind() const {
966         return mKind;
967     }
968 
969     /**
970      * Returns the size in bytes of the Element.
971      * @return size in bytes
972      */
getSizeBytes()973     size_t getSizeBytes() const {
974         return mSizeBytes;
975     }
976 
977     /**
978      * Returns the number of vector components for this Element.
979      * @return number of vector components
980      */
getVectorSize()981     uint32_t getVectorSize() const {
982         return mVectorSize;
983     }
984 
985     /**
986      * Utility function for returning an Element containing a single bool.
987      * @param[in] rs RenderScript context
988      * @return Element
989      */
990     static sp<const Element> BOOLEAN(const sp<RS> &rs);
991     /**
992      * Utility function for returning an Element containing a single unsigned char.
993      * @param[in] rs RenderScript context
994      * @return Element
995      */
996     static sp<const Element> U8(const sp<RS> &rs);
997     /**
998      * Utility function for returning an Element containing a single signed char.
999      * @param[in] rs RenderScript context
1000      * @return Element
1001      */
1002     static sp<const Element> I8(const sp<RS> &rs);
1003     /**
1004      * Utility function for returning an Element containing a single unsigned short.
1005      * @param[in] rs RenderScript context
1006      * @return Element
1007      */
1008     static sp<const Element> U16(const sp<RS> &rs);
1009     /**
1010      * Utility function for returning an Element containing a single signed short.
1011      * @param[in] rs RenderScript context
1012      * @return Element
1013      */
1014     static sp<const Element> I16(const sp<RS> &rs);
1015     /**
1016      * Utility function for returning an Element containing a single unsigned int.
1017      * @param[in] rs RenderScript context
1018      * @return Element
1019      */
1020     static sp<const Element> U32(const sp<RS> &rs);
1021     /**
1022      * Utility function for returning an Element containing a single signed int.
1023      * @param[in] rs RenderScript context
1024      * @return Element
1025      */
1026     static sp<const Element> I32(const sp<RS> &rs);
1027     /**
1028      * Utility function for returning an Element containing a single unsigned long long.
1029      * @param[in] rs RenderScript context
1030      * @return Element
1031      */
1032     static sp<const Element> U64(const sp<RS> &rs);
1033     /**
1034      * Utility function for returning an Element containing a single signed long long.
1035      * @param[in] rs RenderScript context
1036      * @return Element
1037      */
1038     static sp<const Element> I64(const sp<RS> &rs);
1039     /**
1040      * Utility function for returning an Element containing a single half.
1041      * @param[in] rs RenderScript context
1042      * @return Element
1043      */
1044     static sp<const Element> F16(const sp<RS> &rs);
1045     /**
1046      * Utility function for returning an Element containing a single float.
1047      * @param[in] rs RenderScript context
1048      * @return Element
1049      */
1050     static sp<const Element> F32(const sp<RS> &rs);
1051     /**
1052      * Utility function for returning an Element containing a single double.
1053      * @param[in] rs RenderScript context
1054      * @return Element
1055      */
1056     static sp<const Element> F64(const sp<RS> &rs);
1057     /**
1058      * Utility function for returning an Element containing a single Element.
1059      * @param[in] rs RenderScript context
1060      * @return Element
1061      */
1062     static sp<const Element> ELEMENT(const sp<RS> &rs);
1063     /**
1064      * Utility function for returning an Element containing a single Type.
1065      * @param[in] rs RenderScript context
1066      * @return Element
1067      */
1068     static sp<const Element> TYPE(const sp<RS> &rs);
1069     /**
1070      * Utility function for returning an Element containing a single Allocation.
1071      * @param[in] rs RenderScript context
1072      * @return Element
1073      */
1074     static sp<const Element> ALLOCATION(const sp<RS> &rs);
1075     /**
1076      * Utility function for returning an Element containing a single Sampler.
1077      * @param[in] rs RenderScript context
1078      * @return Element
1079      */
1080     static sp<const Element> SAMPLER(const sp<RS> &rs);
1081     /**
1082      * Utility function for returning an Element containing a single Script.
1083      * @param[in] rs RenderScript context
1084      * @return Element
1085      */
1086     static sp<const Element> SCRIPT(const sp<RS> &rs);
1087     /**
1088      * Utility function for returning an Element containing an ALPHA_8 pixel.
1089      * @param[in] rs RenderScript context
1090      * @return Element
1091      */
1092     static sp<const Element> A_8(const sp<RS> &rs);
1093     /**
1094      * Utility function for returning an Element containing an RGB_565 pixel.
1095      * @param[in] rs RenderScript context
1096      * @return Element
1097      */
1098     static sp<const Element> RGB_565(const sp<RS> &rs);
1099     /**
1100      * Utility function for returning an Element containing an RGB_888 pixel.
1101      * @param[in] rs RenderScript context
1102      * @return Element
1103      */
1104     static sp<const Element> RGB_888(const sp<RS> &rs);
1105     /**
1106      * Utility function for returning an Element containing an RGBA_5551 pixel.
1107      * @param[in] rs RenderScript context
1108      * @return Element
1109      */
1110     static sp<const Element> RGBA_5551(const sp<RS> &rs);
1111     /**
1112      * Utility function for returning an Element containing an RGBA_4444 pixel.
1113      * @param[in] rs RenderScript context
1114      * @return Element
1115      */
1116     static sp<const Element> RGBA_4444(const sp<RS> &rs);
1117     /**
1118      * Utility function for returning an Element containing an RGBA_8888 pixel.
1119      * @param[in] rs RenderScript context
1120      * @return Element
1121      */
1122     static sp<const Element> RGBA_8888(const sp<RS> &rs);
1123 
1124     /**
1125      * Utility function for returning an Element containing a half2.
1126      * @param[in] rs RenderScript context
1127      * @return Element
1128      */
1129     static sp<const Element> F16_2(const sp<RS> &rs);
1130     /**
1131      * Utility function for returning an Element containing a half3.
1132      * @param[in] rs RenderScript context
1133      * @return Element
1134      */
1135     static sp<const Element> F16_3(const sp<RS> &rs);
1136     /**
1137      * Utility function for returning an Element containing a half4.
1138      * @param[in] rs RenderScript context
1139      * @return Element
1140      */
1141     static sp<const Element> F16_4(const sp<RS> &rs);
1142 
1143     /**
1144      * Utility function for returning an Element containing a float2.
1145      * @param[in] rs RenderScript context
1146      * @return Element
1147      */
1148     static sp<const Element> F32_2(const sp<RS> &rs);
1149     /**
1150      * Utility function for returning an Element containing a float3.
1151      * @param[in] rs RenderScript context
1152      * @return Element
1153      */
1154     static sp<const Element> F32_3(const sp<RS> &rs);
1155     /**
1156      * Utility function for returning an Element containing a float4.
1157      * @param[in] rs RenderScript context
1158      * @return Element
1159      */
1160     static sp<const Element> F32_4(const sp<RS> &rs);
1161     /**
1162      * Utility function for returning an Element containing a double2.
1163      * @param[in] rs RenderScript context
1164      * @return Element
1165      */
1166     static sp<const Element> F64_2(const sp<RS> &rs);
1167     /**
1168      * Utility function for returning an Element containing a double3.
1169      * @param[in] rs RenderScript context
1170      * @return Element
1171      */
1172     static sp<const Element> F64_3(const sp<RS> &rs);
1173     /**
1174      * Utility function for returning an Element containing a double4.
1175      * @param[in] rs RenderScript context
1176      * @return Element
1177      */
1178     static sp<const Element> F64_4(const sp<RS> &rs);
1179     /**
1180      * Utility function for returning an Element containing a uchar2.
1181      * @param[in] rs RenderScript context
1182      * @return Element
1183      */
1184     static sp<const Element> U8_2(const sp<RS> &rs);
1185     /**
1186      * Utility function for returning an Element containing a uchar3.
1187      * @param[in] rs RenderScript context
1188      * @return Element
1189      */
1190     static sp<const Element> U8_3(const sp<RS> &rs);
1191     /**
1192      * Utility function for returning an Element containing a uchar4.
1193      * @param[in] rs RenderScript context
1194      * @return Element
1195      */
1196     static sp<const Element> U8_4(const sp<RS> &rs);
1197     /**
1198      * Utility function for returning an Element containing a char2.
1199      * @param[in] rs RenderScript context
1200      * @return Element
1201      */
1202     static sp<const Element> I8_2(const sp<RS> &rs);
1203     /**
1204      * Utility function for returning an Element containing a char3.
1205      * @param[in] rs RenderScript context
1206      * @return Element
1207      */
1208     static sp<const Element> I8_3(const sp<RS> &rs);
1209     /**
1210      * Utility function for returning an Element containing a char4.
1211      * @param[in] rs RenderScript context
1212      * @return Element
1213      */
1214     static sp<const Element> I8_4(const sp<RS> &rs);
1215     /**
1216      * Utility function for returning an Element containing a ushort2.
1217      * @param[in] rs RenderScript context
1218      * @return Element
1219      */
1220     static sp<const Element> U16_2(const sp<RS> &rs);
1221     /**
1222      * Utility function for returning an Element containing a ushort3.
1223      * @param[in] rs RenderScript context
1224      * @return Element
1225      */
1226     static sp<const Element> U16_3(const sp<RS> &rs);
1227     /**
1228      * Utility function for returning an Element containing a ushort4.
1229      * @param[in] rs RenderScript context
1230      * @return Element
1231      */
1232     static sp<const Element> U16_4(const sp<RS> &rs);
1233     /**
1234      * Utility function for returning an Element containing a short2.
1235      * @param[in] rs RenderScript context
1236      * @return Element
1237      */
1238     static sp<const Element> I16_2(const sp<RS> &rs);
1239     /**
1240      * Utility function for returning an Element containing a short3.
1241      * @param[in] rs RenderScript context
1242      * @return Element
1243      */
1244     static sp<const Element> I16_3(const sp<RS> &rs);
1245     /**
1246      * Utility function for returning an Element containing a short4.
1247      * @param[in] rs RenderScript context
1248      * @return Element
1249      */
1250     static sp<const Element> I16_4(const sp<RS> &rs);
1251     /**
1252      * Utility function for returning an Element containing a uint2.
1253      * @param[in] rs RenderScript context
1254      * @return Element
1255      */
1256     static sp<const Element> U32_2(const sp<RS> &rs);
1257     /**
1258      * Utility function for returning an Element containing a uint3.
1259      * @param[in] rs RenderScript context
1260      * @return Element
1261      */
1262     static sp<const Element> U32_3(const sp<RS> &rs);
1263     /**
1264      * Utility function for returning an Element containing a uint4.
1265      * @param[in] rs RenderScript context
1266      * @return Element
1267      */
1268     static sp<const Element> U32_4(const sp<RS> &rs);
1269     /**
1270      * Utility function for returning an Element containing an int2.
1271      * @param[in] rs RenderScript context
1272      * @return Element
1273      */
1274     static sp<const Element> I32_2(const sp<RS> &rs);
1275     /**
1276      * Utility function for returning an Element containing an int3.
1277      * @param[in] rs RenderScript context
1278      * @return Element
1279      */
1280     static sp<const Element> I32_3(const sp<RS> &rs);
1281     /**
1282      * Utility function for returning an Element containing an int4.
1283      * @param[in] rs RenderScript context
1284      * @return Element
1285      */
1286     static sp<const Element> I32_4(const sp<RS> &rs);
1287     /**
1288      * Utility function for returning an Element containing a ulong2.
1289      * @param[in] rs RenderScript context
1290      * @return Element
1291      */
1292     static sp<const Element> U64_2(const sp<RS> &rs);
1293     /**
1294      * Utility function for returning an Element containing a ulong3.
1295      * @param[in] rs RenderScript context
1296      * @return Element
1297      */
1298     static sp<const Element> U64_3(const sp<RS> &rs);
1299     /**
1300      * Utility function for returning an Element containing a ulong4.
1301      * @param[in] rs RenderScript context
1302      * @return Element
1303      */
1304     static sp<const Element> U64_4(const sp<RS> &rs);
1305     /**
1306      * Utility function for returning an Element containing a long2.
1307      * @param[in] rs RenderScript context
1308      * @return Element
1309      */
1310     static sp<const Element> I64_2(const sp<RS> &rs);
1311     /**
1312      * Utility function for returning an Element containing a long3.
1313      * @param[in] rs RenderScript context
1314      * @return Element
1315      */
1316     static sp<const Element> I64_3(const sp<RS> &rs);
1317     /**
1318      * Utility function for returning an Element containing a long4.
1319      * @param[in] rs RenderScript context
1320      * @return Element
1321      */
1322     static sp<const Element> I64_4(const sp<RS> &rs);
1323     /**
1324      * Utility function for returning an Element containing a YUV pixel.
1325      * @param[in] rs RenderScript context
1326      * @return Element
1327      */
1328     static sp<const Element> YUV(const sp<RS> &rs);
1329     /**
1330      * Utility function for returning an Element containing an rs_matrix_4x4.
1331      * @param[in] rs RenderScript context
1332      * @return Element
1333      */
1334     static sp<const Element> MATRIX_4X4(const sp<RS> &rs);
1335     /**
1336      * Utility function for returning an Element containing an rs_matrix_3x3.
1337      * @param[in] rs RenderScript context
1338      * @return Element
1339      */
1340     static sp<const Element> MATRIX_3X3(const sp<RS> &rs);
1341     /**
1342      * Utility function for returning an Element containing an rs_matrix_2x2.
1343      * @param[in] rs RenderScript context
1344      * @return Element
1345      */
1346     static sp<const Element> MATRIX_2X2(const sp<RS> &rs);
1347 
1348     void updateFromNative();
1349 
1350     /**
1351      * Create an Element with a given DataType.
1352      * @param[in] rs RenderScript context
1353      * @param[in] dt data type
1354      * @return Element
1355      */
1356     static sp<const Element> createUser(const sp<RS>& rs, RsDataType dt);
1357     /**
1358      * Create a vector Element with the given DataType
1359      * @param[in] rs RenderScript
1360      * @param[in] dt DataType
1361      * @param[in] size vector size
1362      * @return Element
1363      */
1364     static sp<const Element> createVector(const sp<RS>& rs, RsDataType dt, uint32_t size);
1365     /**
1366      * Create an Element with a given DataType and DataKind.
1367      * @param[in] rs RenderScript context
1368      * @param[in] dt DataType
1369      * @param[in] dk DataKind
1370      * @return Element
1371      */
1372     static sp<const Element> createPixel(const sp<RS>& rs, RsDataType dt, RsDataKind dk);
1373 
1374     /**
1375      * Returns true if the Element can interoperate with this Element.
1376      * @param[in] e Element to compare
1377      * @return true if Elements can interoperate
1378      */
1379     bool isCompatible(const sp<const Element>&e) const;
1380 
1381     /**
1382      * Builder class for producing complex elements with matching field and name
1383      * pairs. The builder starts empty. The order in which elements are added is
1384      * retained for the layout in memory.
1385      */
1386     class Builder {
1387     private:
1388         RS* mRS;
1389         size_t mElementsCount;
1390         size_t mElementsVecSize;
1391         sp<const Element> * mElements;
1392         char ** mElementNames;
1393         size_t * mElementNameLengths;
1394         uint32_t * mArraySizes;
1395         bool mSkipPadding;
1396 
1397     public:
1398         explicit Builder(sp<RS> rs);
1399         ~Builder();
1400         void add(const sp<const Element>& e, const char * name, uint32_t arraySize = 1);
1401         sp<const Element> create();
1402     };
1403 
1404 protected:
1405     friend class Type;
1406     Element(void *id, sp<RS> rs,
1407             sp<const Element> * elements,
1408             size_t elementCount,
1409             const char ** elementNames,
1410             size_t * elementNameLengths,
1411             uint32_t * arraySizes);
1412     Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size);
1413     Element(void *id, sp<RS> rs);
1414     explicit Element(sp<RS> rs);
1415     virtual ~Element();
1416 
1417 private:
1418     void updateVisibleSubElements();
1419 
1420     size_t mElementsCount;
1421     size_t mVisibleElementMapSize;
1422 
1423     sp<const Element> * mElements;
1424     char ** mElementNames;
1425     size_t * mElementNameLengths;
1426     uint32_t * mArraySizes;
1427     uint32_t * mVisibleElementMap;
1428     uint32_t * mOffsetInBytes;
1429 
1430     RsDataType mType;
1431     RsDataKind mKind;
1432     bool mNormalized;
1433     size_t mSizeBytes;
1434     size_t mVectorSize;
1435 };
1436 
1437 class FieldPacker {
1438 protected:
1439     unsigned char* mData;
1440     size_t mPos;
1441     size_t mLen;
1442 
1443 public:
FieldPacker(size_t len)1444     explicit FieldPacker(size_t len)
1445         : mPos(0), mLen(len) {
1446             mData = new unsigned char[len];
1447         }
1448 
~FieldPacker()1449     virtual ~FieldPacker() {
1450         delete [] mData;
1451     }
1452 
align(size_t v)1453     void align(size_t v) {
1454         if ((v & (v - 1)) != 0) {
1455             //            ALOGE("Non-power-of-two alignment: %zu", v);
1456             return;
1457         }
1458 
1459         while ((mPos & (v - 1)) != 0) {
1460             mData[mPos++] = 0;
1461         }
1462     }
1463 
reset()1464     void reset() {
1465         mPos = 0;
1466     }
1467 
reset(size_t i)1468     void reset(size_t i) {
1469         if (i >= mLen) {
1470             //            ALOGE("Out of bounds: i (%zu) >= len (%zu)", i, mLen);
1471             return;
1472         }
1473         mPos = i;
1474     }
1475 
skip(size_t i)1476     void skip(size_t i) {
1477         size_t res = mPos + i;
1478         if (res > mLen) {
1479             //            ALOGE("Exceeded buffer length: i (%zu) > len (%zu)", i, mLen);
1480             return;
1481         }
1482         mPos = res;
1483     }
1484 
getData()1485     void* getData() const {
1486         return mData;
1487     }
1488 
getLength()1489     size_t getLength() const {
1490         return mLen;
1491     }
1492 
1493     template <typename T>
add(T t)1494         void add(T t) {
1495         align(sizeof(t));
1496         if (mPos + sizeof(t) <= mLen) {
1497             memcpy(&mData[mPos], &t, sizeof(t));
1498             mPos += sizeof(t);
1499         }
1500     }
1501 
1502     /*
1503       void add(rs_matrix4x4 m) {
1504       for (size_t i = 0; i < 16; i++) {
1505       add(m.m[i]);
1506       }
1507       }
1508 
1509       void add(rs_matrix3x3 m) {
1510       for (size_t i = 0; i < 9; i++) {
1511       add(m.m[i]);
1512       }
1513       }
1514 
1515       void add(rs_matrix2x2 m) {
1516       for (size_t i = 0; i < 4; i++) {
1517       add(m.m[i]);
1518       }
1519       }
1520     */
1521 
add(const sp<BaseObj> & obj)1522     void add(const sp<BaseObj>& obj) {
1523         if (obj != NULL) {
1524             add((uint32_t) (uintptr_t) obj->getID());
1525         } else {
1526             add((uint32_t) 0);
1527         }
1528     }
1529 };
1530 
1531 /**
1532  * A Type describes the Element and dimensions used for an Allocation or a
1533  * parallel operation.
1534  *
1535  * A Type always includes an Element and an X dimension. A Type may be
1536  * multidimensional, up to three dimensions. A nonzero value in the Y or Z
1537  * dimensions indicates that the dimension is present. Note that a Type with
1538  * only a given X dimension and a Type with the same X dimension but Y = 1 are
1539  * not equivalent.
1540  *
1541  * A Type also supports inclusion of level of detail (LOD) or cube map
1542  * faces. LOD and cube map faces are booleans to indicate present or not
1543  * present.
1544  *
1545  * A Type also supports YUV format information to support an Allocation in a YUV
1546  * format. The YUV formats supported are RS_YUV_YV12 and RS_YUV_NV21.
1547  */
1548 class Type : public BaseObj {
1549 protected:
1550     friend class Allocation;
1551 
1552     uint32_t mDimX;
1553     uint32_t mDimY;
1554     uint32_t mDimZ;
1555     RsYuvFormat mYuvFormat;
1556     bool mDimMipmaps;
1557     bool mDimFaces;
1558     size_t mElementCount;
1559     sp<const Element> mElement;
1560 
1561     Type(void *id, sp<RS> rs);
1562 
1563     void calcElementCount();
1564     virtual void updateFromNative();
1565 
1566 public:
1567 
1568     /**
1569      * Returns the YUV format.
1570      * @return YUV format of the Allocation
1571      */
getYuvFormat()1572     RsYuvFormat getYuvFormat() const {
1573         return mYuvFormat;
1574     }
1575 
1576     /**
1577      * Returns the Element of the Allocation.
1578      * @return YUV format of the Allocation
1579      */
getElement()1580     sp<const Element> getElement() const {
1581         return mElement;
1582     }
1583 
1584     /**
1585      * Returns the X dimension of the Allocation.
1586      * @return X dimension of the allocation
1587      */
getX()1588     uint32_t getX() const {
1589         return mDimX;
1590     }
1591 
1592     /**
1593      * Returns the Y dimension of the Allocation.
1594      * @return Y dimension of the allocation
1595      */
getY()1596     uint32_t getY() const {
1597         return mDimY;
1598     }
1599 
1600     /**
1601      * Returns the Z dimension of the Allocation.
1602      * @return Z dimension of the allocation
1603      */
getZ()1604     uint32_t getZ() const {
1605         return mDimZ;
1606     }
1607 
1608     /**
1609      * Returns true if the Allocation has mipmaps.
1610      * @return true if the Allocation has mipmaps
1611      */
hasMipmaps()1612     bool hasMipmaps() const {
1613         return mDimMipmaps;
1614     }
1615 
1616     /**
1617      * Returns true if the Allocation is a cube map
1618      * @return true if the Allocation is a cube map
1619      */
hasFaces()1620     bool hasFaces() const {
1621         return mDimFaces;
1622     }
1623 
1624     /**
1625      * Returns number of accessible Elements in the Allocation
1626      * @return number of accessible Elements in the Allocation
1627      */
getCount()1628     size_t getCount() const {
1629         return mElementCount;
1630     }
1631 
1632     /**
1633      * Returns size in bytes of all Elements in the Allocation
1634      * @return size in bytes of all Elements in the Allocation
1635      */
getSizeBytes()1636     size_t getSizeBytes() const {
1637         return mElementCount * mElement->getSizeBytes();
1638     }
1639 
1640     /**
1641      * Creates a new Type with the given Element and dimensions.
1642      * @param[in] rs RenderScript context
1643      * @param[in] e Element
1644      * @param[in] dimX X dimension
1645      * @param[in] dimY Y dimension
1646      * @param[in] dimZ Z dimension
1647      * @return new Type
1648      */
1649     static sp<const Type> create(const sp<RS>& rs, const sp<const Element>& e, uint32_t dimX, uint32_t dimY, uint32_t dimZ);
1650 
1651     class Builder {
1652     protected:
1653         RS* mRS;
1654         uint32_t mDimX;
1655         uint32_t mDimY;
1656         uint32_t mDimZ;
1657         RsYuvFormat mYuvFormat;
1658         bool mDimMipmaps;
1659         bool mDimFaces;
1660         sp<const Element> mElement;
1661 
1662     public:
1663         Builder(sp<RS> rs, sp<const Element> e);
1664 
1665         void setX(uint32_t value);
1666         void setY(uint32_t value);
1667         void setZ(uint32_t value);
1668         void setYuvFormat(RsYuvFormat format);
1669         void setMipmaps(bool value);
1670         void setFaces(bool value);
1671         sp<const Type> create();
1672     };
1673 
1674 };
1675 
1676 /**
1677  * The parent class for all executable Scripts. This should not be used by applications.
1678  */
1679 class Script : public BaseObj {
1680 private:
1681 
1682 protected:
1683     Script(void *id, sp<RS> rs);
1684     void forEach(uint32_t slot, const sp<const Allocation>& in, const sp<const Allocation>& out,
1685             const void *v, size_t) const;
1686     void bindAllocation(const sp<Allocation>& va, uint32_t slot) const;
1687     void setVar(uint32_t index, const void *, size_t len) const;
1688     void setVar(uint32_t index, const sp<const BaseObj>& o) const;
1689     void invoke(uint32_t slot, const void *v, size_t len) const;
1690 
1691 
invoke(uint32_t slot)1692     void invoke(uint32_t slot) const {
1693         invoke(slot, NULL, 0);
1694     }
setVar(uint32_t index,float v)1695     void setVar(uint32_t index, float v) const {
1696         setVar(index, &v, sizeof(v));
1697     }
setVar(uint32_t index,double v)1698     void setVar(uint32_t index, double v) const {
1699         setVar(index, &v, sizeof(v));
1700     }
setVar(uint32_t index,int32_t v)1701     void setVar(uint32_t index, int32_t v) const {
1702         setVar(index, &v, sizeof(v));
1703     }
setVar(uint32_t index,uint32_t v)1704     void setVar(uint32_t index, uint32_t v) const {
1705         setVar(index, &v, sizeof(v));
1706     }
setVar(uint32_t index,int64_t v)1707     void setVar(uint32_t index, int64_t v) const {
1708         setVar(index, &v, sizeof(v));
1709     }
setVar(uint32_t index,bool v)1710     void setVar(uint32_t index, bool v) const {
1711         setVar(index, &v, sizeof(v));
1712     }
1713 
1714 public:
1715     class FieldBase {
1716     protected:
1717         sp<const Element> mElement;
1718         sp<Allocation> mAllocation;
1719 
1720         void init(const sp<RS>& rs, uint32_t dimx, uint32_t usages = 0);
1721 
1722     public:
getElement()1723         sp<const Element> getElement() {
1724             return mElement;
1725         }
1726 
getType()1727         sp<const Type> getType() {
1728             return mAllocation->getType();
1729         }
1730 
getAllocation()1731         sp<const Allocation> getAllocation() {
1732             return mAllocation;
1733         }
1734 
1735         //void updateAllocation();
1736     };
1737 };
1738 
1739 /**
1740  * The parent class for all user-defined scripts. This is intended to be used by auto-generated code only.
1741  */
1742 class ScriptC : public Script {
1743 protected:
1744     ScriptC(sp<RS> rs,
1745             const void *codeTxt, size_t codeLength,
1746             const char *cachedName, size_t cachedNameLength,
1747             const char *cacheDir, size_t cacheDirLength);
1748 
1749 };
1750 
1751 /**
1752  * The parent class for all script intrinsics. Intrinsics provide highly optimized implementations of
1753  * basic functions. This is not intended to be used directly.
1754  */
1755 class ScriptIntrinsic : public Script {
1756  protected:
1757     sp<const Element> mElement;
1758     ScriptIntrinsic(sp<RS> rs, int id, sp<const Element> e);
1759     virtual ~ScriptIntrinsic();
1760 };
1761 
1762 /**
1763  * Intrinsic for converting RGB to RGBA by using a 3D lookup table. The incoming
1764  * r,g,b values are use as normalized x,y,z coordinates into a 3D
1765  * allocation. The 8 nearest values are sampled and linearly interpolated. The
1766  * result is placed in the output.
1767  */
1768 class ScriptIntrinsic3DLUT : public ScriptIntrinsic {
1769  private:
1770     ScriptIntrinsic3DLUT(sp<RS> rs, sp<const Element> e);
1771  public:
1772     /**
1773      * Supported Element types are U8_4. Default lookup table is identity.
1774      * @param[in] rs RenderScript context
1775      * @param[in] e Element
1776      * @return new ScriptIntrinsic
1777      */
1778     static sp<ScriptIntrinsic3DLUT> create(const sp<RS>& rs, const sp<const Element>& e);
1779 
1780     /**
1781      * Launch the intrinsic.
1782      * @param[in] ain input Allocation
1783      * @param[in] aout output Allocation
1784      */
1785     void forEach(const sp<Allocation>& ain, const sp<Allocation>& aout);
1786 
1787     /**
1788      * Sets the lookup table. The lookup table must use the same Element as the
1789      * intrinsic.
1790      * @param[in] lut new lookup table
1791      */
1792     void setLUT(const sp<Allocation>& lut);
1793 };
1794 
1795 
1796 /**
1797  * Intrinsic kernel provides high performance RenderScript APIs to BLAS.
1798  *
1799  * The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard
1800  * building blocks for performing basic vector and matrix operations.
1801  *
1802  * For detailed description of BLAS, please refer to http://www.netlib.org/blas/
1803  *
1804  **/
1805 class ScriptIntrinsicBLAS : public ScriptIntrinsic {
1806  private:
1807     ScriptIntrinsicBLAS(sp<RS> rs, sp<const Element> e);
1808  public:
1809     /**
1810      * Create an intrinsic to access BLAS subroutines.
1811      *
1812      * @param rs The RenderScript context
1813      * @return ScriptIntrinsicBLAS
1814      */
1815     static sp<ScriptIntrinsicBLAS> create(const sp<RS>& rs);
1816 
1817     /**
1818      * SGEMV performs one of the matrix-vector operations
1819      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
1820      *
1821      * Details: http://www.netlib.org/lapack/explore-html/db/d58/sgemv_8f.html
1822      *
1823      * @param TransA The type of transpose applied to matrix A.
1824      * @param alpha The scalar alpha.
1825      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
1826      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
1827      * @param incX The increment for the elements of vector x, must be larger than zero.
1828      * @param beta The scalar beta.
1829      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
1830      * @param incY The increment for the elements of vector y, must be larger than zero.
1831      */
1832     void SGEMV(RsBlasTranspose TransA,
1833                float alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
1834                float beta, const sp<Allocation>& Y, int incY);
1835 
1836     /**
1837      * DGEMV performs one of the matrix-vector operations
1838      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
1839      *
1840      * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html
1841      *
1842      * @param TransA The type of transpose applied to matrix A.
1843      * @param alpha The scalar alpha.
1844      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
1845      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
1846      * @param incX The increment for the elements of vector x, must be larger than zero.
1847      * @param beta The scalar beta.
1848      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
1849      * @param incY The increment for the elements of vector y, must be larger than zero.
1850      */
1851     void DGEMV(RsBlasTranspose TransA,
1852                double alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
1853                double beta, const sp<Allocation>& Y, int incY);
1854 
1855     /**
1856      * CGEMV performs one of the matrix-vector operations
1857      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
1858      *
1859      * Details: http://www.netlib.org/lapack/explore-html/d4/d8a/cgemv_8f.html
1860      *
1861      * @param TransA The type of transpose applied to matrix A.
1862      * @param alpha The scalar alpha.
1863      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
1864      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
1865      * @param incX The increment for the elements of vector x, must be larger than zero.
1866      * @param beta The scalar beta.
1867      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
1868      * @param incY The increment for the elements of vector y, must be larger than zero.
1869      */
1870     void CGEMV(RsBlasTranspose TransA,
1871                Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
1872                Float2 beta, const sp<Allocation>& Y, int incY);
1873 
1874     /**
1875      * ZGEMV performs one of the matrix-vector operations
1876      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
1877      *
1878      * Details: http://www.netlib.org/lapack/explore-html/db/d40/zgemv_8f.html
1879      *
1880      * @param TransA The type of transpose applied to matrix A.
1881      * @param alpha The scalar alpha.
1882      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
1883      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
1884      * @param incX The increment for the elements of vector x, must be larger than zero.
1885      * @param beta The scalar beta.
1886      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
1887      * @param incY The increment for the elements of vector y, must be larger than zero.
1888      */
1889     void ZGEMV(RsBlasTranspose TransA,
1890                Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
1891                Double2 beta, const sp<Allocation>& Y, int incY);
1892 
1893     /**
1894      * SGBMV performs one of the matrix-vector operations
1895      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
1896      *
1897      * Details: http://www.netlib.org/lapack/explore-html/d6/d46/sgbmv_8f.html
1898      *
1899      * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
1900      *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
1901      *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
1902      *           for i in range(0, m):
1903      *              for j in range(max(0, i-kl), min(i+ku+1, n)):
1904      *                  b[i, j-i+kl] = a[i, j]
1905      *
1906      * @param TransA The type of transpose applied to matrix A.
1907      * @param KL The number of sub-diagonals of the matrix A.
1908      * @param KU The number of super-diagonals of the matrix A.
1909      * @param alpha The scalar alpha.
1910      * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32}.
1911      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
1912      * @param incX The increment for the elements of vector x, must be larger than zero.
1913      * @param beta The scalar beta.
1914      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
1915      * @param incY The increment for the elements of vector y, must be larger than zero.
1916      */
1917     void SGBMV(RsBlasTranspose TransA,
1918                int KL, int KU, float alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
1919                float beta, const sp<Allocation>& Y, int incY);
1920 
1921     /**
1922      * DGBMV performs one of the matrix-vector operations
1923      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
1924      *
1925      * Details: http://www.netlib.org/lapack/explore-html/d2/d3f/dgbmv_8f.html
1926      *
1927      * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
1928      *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
1929      *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
1930      *           for i in range(0, m):
1931      *              for j in range(max(0, i-kl), min(i+ku+1, n)):
1932      *                  b[i, j-i+kl] = a[i, j]
1933      *
1934      * @param TransA The type of transpose applied to matrix A.
1935      * @param KL The number of sub-diagonals of the matrix A.
1936      * @param KU The number of super-diagonals of the matrix A.
1937      * @param alpha The scalar alpha.
1938      * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64}.
1939      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
1940      * @param incX The increment for the elements of vector x, must be larger than zero.
1941      * @param beta The scalar beta.
1942      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
1943      * @param incY The increment for the elements of vector y, must be larger than zero.
1944      */
1945     void DGBMV(RsBlasTranspose TransA,
1946                int KL, int KU, double alpha, const sp<Allocation>& A, const sp<Allocation>& X,
1947                int incX, double beta, const sp<Allocation>& Y, int incY);
1948 
1949     /**
1950      * CGBMV performs one of the matrix-vector operations
1951      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
1952      *
1953      * Details: http://www.netlib.org/lapack/explore-html/d0/d75/cgbmv_8f.html
1954      *
1955      * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
1956      *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
1957      *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
1958      *           for i in range(0, m):
1959      *              for j in range(max(0, i-kl), min(i+ku+1, n)):
1960      *                  b[i, j-i+kl] = a[i, j]
1961      *
1962      * @param TransA The type of transpose applied to matrix A.
1963      * @param KL The number of sub-diagonals of the matrix A.
1964      * @param KU The number of super-diagonals of the matrix A.
1965      * @param alpha The scalar alpha.
1966      * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32_2}.
1967      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
1968      * @param incX The increment for the elements of vector x, must be larger than zero.
1969      * @param beta The scalar beta.
1970      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
1971      * @param incY The increment for the elements of vector y, must be larger than zero.
1972      */
1973     void CGBMV(RsBlasTranspose TransA,
1974                int KL, int KU, Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& X,
1975                int incX, Float2 beta, const sp<Allocation>& Y, int incY);
1976 
1977     /**
1978      * ZGBMV performs one of the matrix-vector operations
1979      * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
1980      *
1981      * Details: http://www.netlib.org/lapack/explore-html/d9/d46/zgbmv_8f.html
1982      *
1983      * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
1984      *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
1985      *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
1986      *           for i in range(0, m):
1987      *              for j in range(max(0, i-kl), min(i+ku+1, n)):
1988      *                  b[i, j-i+kl] = a[i, j]
1989      *
1990      * @param TransA The type of transpose applied to matrix A.
1991      * @param KL The number of sub-diagonals of the matrix A.
1992      * @param KU The number of super-diagonals of the matrix A.
1993      * @param alpha The scalar alpha.
1994      * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64_2}.
1995      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
1996      * @param incX The increment for the elements of vector x, must be larger than zero.
1997      * @param beta The scalar beta.
1998      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
1999      * @param incY The increment for the elements of vector y, must be larger than zero.
2000      */
2001     void ZGBMV(RsBlasTranspose TransA,
2002                int KL, int KU, Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
2003                Double2 beta, const sp<Allocation>& Y, int incY);
2004 
2005     /**
2006      * STRMV performs one of the matrix-vector operations
2007      * x := A*x   or   x := A**T*x
2008      *
2009      * Details: http://www.netlib.org/lapack/explore-html/de/d45/strmv_8f.html
2010      *
2011      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2012      * @param TransA The type of transpose applied to matrix A.
2013      * @param Diag Specifies whether or not A is unit triangular.
2014      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2015      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2016      * @param incX The increment for the elements of vector x, must be larger than zero.
2017      */
2018     void STRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2019                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2020 
2021     /**
2022      * DTRMV performs one of the matrix-vector operations
2023      * x := A*x   or   x := A**T*x
2024      *
2025      * Details: http://www.netlib.org/lapack/explore-html/dc/d7e/dtrmv_8f.html
2026      *
2027      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2028      * @param TransA The type of transpose applied to matrix A.
2029      * @param Diag Specifies whether or not A is unit triangular.
2030      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2031      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2032      * @param incX The increment for the elements of vector x, must be larger than zero.
2033      */
2034     void DTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2035                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2036 
2037     /**
2038      * CTRMV performs one of the matrix-vector operations
2039      * x := A*x   or   x := A**T*x   or   x := A**H*x
2040      *
2041      * Details: http://www.netlib.org/lapack/explore-html/df/d78/ctrmv_8f.html
2042      *
2043      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2044      * @param TransA The type of transpose applied to matrix A.
2045      * @param Diag Specifies whether or not A is unit triangular.
2046      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2047      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2048      * @param incX The increment for the elements of vector x, must be larger than zero.
2049      */
2050     void CTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2051                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2052 
2053     /**
2054      * ZTRMV performs one of the matrix-vector operations
2055      * x := A*x   or   x := A**T*x   or   x := A**H*x
2056      *
2057      * Details: http://www.netlib.org/lapack/explore-html/d0/dd1/ztrmv_8f.html
2058      *
2059      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2060      * @param TransA The type of transpose applied to matrix A.
2061      * @param Diag Specifies whether or not A is unit triangular.
2062      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
2063      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2064      * @param incX The increment for the elements of vector x, must be larger than zero.
2065      */
2066     void ZTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2067                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2068 
2069     /**
2070      * STBMV performs one of the matrix-vector operations
2071      * x := A*x   or   x := A**T*x
2072      *
2073      * Details: http://www.netlib.org/lapack/explore-html/d6/d7d/stbmv_8f.html
2074      *
2075      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2076      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2077      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2078      *           for i in range(0, n):
2079      *              for j in range(i, min(i+k+1, n)):
2080      *                  b[i, j-i] = a[i, j]
2081      *
2082      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2083      * @param TransA The type of transpose applied to matrix A.
2084      * @param Diag Specifies whether or not A is unit triangular.
2085      * @param K The number of off-diagonals of the matrix A
2086      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2087      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2088      * @param incX The increment for the elements of vector x, must be larger than zero.
2089      */
2090     void STBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2091                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2092 
2093     /**
2094      * DTBMV performs one of the matrix-vector operations
2095      * x := A*x   or   x := A**T*x
2096      *
2097      * Details: http://www.netlib.org/lapack/explore-html/df/d29/dtbmv_8f.html
2098      *
2099      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2100      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2101      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2102      *           for i in range(0, n):
2103      *              for j in range(i, min(i+k+1, n)):
2104      *                  b[i, j-i] = a[i, j]
2105      *
2106      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2107      * @param TransA The type of transpose applied to matrix A.
2108      * @param Diag Specifies whether or not A is unit triangular.
2109      * @param K The number of off-diagonals of the matrix A
2110      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2111      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2112      * @param incX The increment for the elements of vector x, must be larger than zero.
2113      */
2114     void DTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2115                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2116 
2117     /**
2118      * CTBMV performs one of the matrix-vector operations
2119      * x := A*x   or   x := A**T*x   or   x := A**H*x
2120      *
2121      * Details: http://www.netlib.org/lapack/explore-html/d3/dcd/ctbmv_8f.html
2122      *
2123      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2124      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2125      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2126      *           for i in range(0, n):
2127      *              for j in range(i, min(i+k+1, n)):
2128      *                  b[i, j-i] = a[i, j]
2129      *
2130      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2131      * @param TransA The type of transpose applied to matrix A.
2132      * @param Diag Specifies whether or not A is unit triangular.
2133      * @param K The number of off-diagonals of the matrix A
2134      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2135      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2136      * @param incX The increment for the elements of vector x, must be larger than zero.
2137      */
2138     void CTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2139                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2140 
2141     /**
2142      * ZTBMV performs one of the matrix-vector operations
2143      * x := A*x   or   x := A**T*x   or   x := A**H*x
2144      *
2145      * Details: http://www.netlib.org/lapack/explore-html/d3/d39/ztbmv_8f.html
2146      *
2147      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2148      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2149      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2150      *           for i in range(0, n):
2151      *              for j in range(i, min(i+k+1, n)):
2152      *                  b[i, j-i] = a[i, j]
2153      *
2154      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2155      * @param TransA The type of transpose applied to matrix A.
2156      * @param Diag Specifies whether or not A is unit triangular.
2157      * @param K The number of off-diagonals of the matrix A
2158      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
2159      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2160      * @param incX The increment for the elements of vector x, must be larger than zero.
2161      */
2162     void ZTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2163                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2164 
2165     /**
2166      * STPMV performs one of the matrix-vector operations
2167      * x := A*x   or   x := A**T*x
2168      *
2169      * Details: http://www.netlib.org/lapack/explore-html/db/db1/stpmv_8f.html
2170      *
2171      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2172      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2173      *       'a' to packed matrix 'b'.
2174      *           k = 0
2175      *           for i in range(0, n):
2176      *              for j in range(i, n):
2177      *                  b[k++] = a[i, j]
2178      *
2179      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2180      * @param TransA The type of transpose applied to matrix A.
2181      * @param Diag Specifies whether or not A is unit triangular.
2182      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}.
2183      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2184      * @param incX The increment for the elements of vector x, must be larger than zero.
2185      */
2186     void STPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2187                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2188 
2189     /**
2190      * DTPMV performs one of the matrix-vector operations
2191      * x := A*x   or   x := A**T*x
2192      *
2193      * Details: http://www.netlib.org/lapack/explore-html/dc/dcd/dtpmv_8f.html
2194      *
2195      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2196      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2197      *       'a' to packed matrix 'b'.
2198      *           k = 0
2199      *           for i in range(0, n):
2200      *              for j in range(i, n):
2201      *                  b[k++] = a[i, j]
2202      *
2203      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2204      * @param TransA The type of transpose applied to matrix A.
2205      * @param Diag Specifies whether or not A is unit triangular.
2206      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}.
2207      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2208      * @param incX The increment for the elements of vector x, must be larger than zero.
2209      */
2210     void DTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2211                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2212 
2213     /**
2214      * CTPMV performs one of the matrix-vector operations
2215      * x := A*x   or   x := A**T*x   or   x := A**H*x
2216      *
2217      * Details: http://www.netlib.org/lapack/explore-html/d4/dbb/ctpmv_8f.html
2218      *
2219      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2220      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2221      *       'a' to packed matrix 'b'.
2222      *           k = 0
2223      *           for i in range(0, n):
2224      *              for j in range(i, n):
2225      *                  b[k++] = a[i, j]
2226      *
2227      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2228      * @param TransA The type of transpose applied to matrix A.
2229      * @param Diag Specifies whether or not A is unit triangular.
2230      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}.
2231      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2232      * @param incX The increment for the elements of vector x, must be larger than zero.
2233      */
2234     void CTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2235                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2236 
2237     /**
2238      * ZTPMV performs one of the matrix-vector operations
2239      * x := A*x   or   x := A**T*x   or   x := A**H*x
2240      *
2241      * Details: http://www.netlib.org/lapack/explore-html/d2/d9e/ztpmv_8f.html
2242      *
2243      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2244      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2245      *       'a' to packed matrix 'b'.
2246      *           k = 0
2247      *           for i in range(0, n):
2248      *              for j in range(i, n):
2249      *                  b[k++] = a[i, j]
2250      *
2251      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2252      * @param TransA The type of transpose applied to matrix A.
2253      * @param Diag Specifies whether or not A is unit triangular.
2254      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}.
2255      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2256      * @param incX The increment for the elements of vector x, must be larger than zero.
2257      */
2258     void ZTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2259                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2260 
2261     /**
2262      * STRSV solves one of the systems of equations
2263      * A*x = b   or   A**T*x = b
2264      *
2265      * Details: http://www.netlib.org/lapack/explore-html/d0/d2a/strsv_8f.html
2266      *
2267      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2268      * @param TransA The type of transpose applied to matrix A.
2269      * @param Diag Specifies whether or not A is unit triangular.
2270      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2271      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2272      * @param incX The increment for the elements of vector x, must be larger than zero.
2273      */
2274     void STRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2275                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2276 
2277     /**
2278      * DTRSV solves one of the systems of equations
2279      * A*x = b   or   A**T*x = b
2280      *
2281      * Details: http://www.netlib.org/lapack/explore-html/d6/d96/dtrsv_8f.html
2282      *
2283      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2284      * @param TransA The type of transpose applied to matrix A.
2285      * @param Diag Specifies whether or not A is unit triangular.
2286      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2287      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2288      * @param incX The increment for the elements of vector x, must be larger than zero.
2289      */
2290     void DTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2291                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2292 
2293     /**
2294      * CTRSV solves one of the systems of equations
2295      * A*x = b   or   A**T*x = b   or   A**H*x = b
2296      *
2297      * Details: http://www.netlib.org/lapack/explore-html/d4/dc8/ctrsv_8f.html
2298      *
2299      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2300      * @param TransA The type of transpose applied to matrix A.
2301      * @param Diag Specifies whether or not A is unit triangular.
2302      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2303      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2304      * @param incX The increment for the elements of vector x, must be larger than zero.
2305      */
2306     void CTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2307                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2308 
2309     /**
2310      * ZTRSV solves one of the systems of equations
2311      * A*x = b   or   A**T*x = b   or   A**H*x = b
2312      *
2313      * Details: http://www.netlib.org/lapack/explore-html/d1/d2f/ztrsv_8f.html
2314      *
2315      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2316      * @param TransA The type of transpose applied to matrix A.
2317      * @param Diag Specifies whether or not A is unit triangular.
2318      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
2319      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2320      * @param incX The increment for the elements of vector x, must be larger than zero.
2321      */
2322     void ZTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2323                const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2324 
2325     /**
2326      * STBSV solves one of the systems of equations
2327      * A*x = b   or   A**T*x = b
2328      *
2329      * Details: http://www.netlib.org/lapack/explore-html/d0/d1f/stbsv_8f.html
2330      *
2331      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2332      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2333      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2334      *           for i in range(0, n):
2335      *              for j in range(i, min(i+k+1, n)):
2336      *                  b[i, j-i] = a[i, j]
2337      *
2338      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2339      * @param TransA The type of transpose applied to matrix A.
2340      * @param Diag Specifies whether or not A is unit triangular.
2341      * @param K The number of off-diagonals of the matrix A
2342      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2343      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2344      * @param incX The increment for the elements of vector x, must be larger than zero.
2345      */
2346     void STBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2347                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2348 
2349     /**
2350      * DTBSV solves one of the systems of equations
2351      * A*x = b   or   A**T*x = b
2352      *
2353      * Details: http://www.netlib.org/lapack/explore-html/d4/dcf/dtbsv_8f.html
2354      *
2355      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2356      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2357      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2358      *           for i in range(0, n):
2359      *              for j in range(i, min(i+k+1, n)):
2360      *                  b[i, j-i] = a[i, j]
2361      *
2362      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2363      * @param TransA The type of transpose applied to matrix A.
2364      * @param Diag Specifies whether or not A is unit triangular.
2365      * @param K The number of off-diagonals of the matrix A
2366      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2367      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2368      * @param incX The increment for the elements of vector x, must be larger than zero.
2369      */
2370     void DTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2371                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2372 
2373     /**
2374      * CTBSV solves one of the systems of equations
2375      * A*x = b   or   A**T*x = b   or   A**H*x = b
2376      *
2377      * Details: http://www.netlib.org/lapack/explore-html/d9/d5f/ctbsv_8f.html
2378      *
2379      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2380      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2381      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2382      *           for i in range(0, n):
2383      *              for j in range(i, min(i+k+1, n)):
2384      *                  b[i, j-i] = a[i, j]
2385      *
2386      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2387      * @param TransA The type of transpose applied to matrix A.
2388      * @param Diag Specifies whether or not A is unit triangular.
2389      * @param K The number of off-diagonals of the matrix A
2390      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2391      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2392      * @param incX The increment for the elements of vector x, must be larger than zero.
2393      */
2394     void CTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2395                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2396 
2397     /**
2398      * ZTBSV solves one of the systems of equations
2399      * A*x = b   or   A**T*x = b   or   A**H*x = b
2400      *
2401      * Details: http://www.netlib.org/lapack/explore-html/d4/d5a/ztbsv_8f.html
2402      *
2403      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2404      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2405      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2406      *           for i in range(0, n):
2407      *              for j in range(i, min(i+k+1, n)):
2408      *                  b[i, j-i] = a[i, j]
2409      *
2410      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2411      * @param TransA The type of transpose applied to matrix A.
2412      * @param Diag Specifies whether or not A is unit triangular.
2413      * @param K The number of off-diagonals of the matrix A
2414      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
2415      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2416      * @param incX The increment for the elements of vector x, must be larger than zero.
2417      */
2418     void ZTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2419                int K, const sp<Allocation>& A, const sp<Allocation>& X, int incX);
2420 
2421     /**
2422      * STPSV solves one of the systems of equations
2423      * A*x = b   or   A**T*x = b
2424      *
2425      * Details: http://www.netlib.org/lapack/explore-html/d0/d7c/stpsv_8f.html
2426      *
2427      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2428      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2429      *       'a' to packed matrix 'b'.
2430      *           k = 0
2431      *           for i in range(0, n):
2432      *              for j in range(i, n):
2433      *                  b[k++] = a[i, j]
2434      *
2435      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2436      * @param TransA The type of transpose applied to matrix A.
2437      * @param Diag Specifies whether or not A is unit triangular.
2438      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}.
2439      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2440      * @param incX The increment for the elements of vector x, must be larger than zero.
2441      */
2442     void STPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2443                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2444 
2445     /**
2446      * DTPSV solves one of the systems of equations
2447      * A*x = b   or   A**T*x = b
2448      *
2449      * Details: http://www.netlib.org/lapack/explore-html/d9/d84/dtpsv_8f.html
2450      *
2451      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2452      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2453      *       'a' to packed matrix 'b'.
2454      *           k = 0
2455      *           for i in range(0, n):
2456      *              for j in range(i, n):
2457      *                  b[k++] = a[i, j]
2458      *
2459      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2460      * @param TransA The type of transpose applied to matrix A.
2461      * @param Diag Specifies whether or not A is unit triangular.
2462      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}.
2463      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2464      * @param incX The increment for the elements of vector x, must be larger than zero.
2465      */
2466     void DTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2467                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2468 
2469     /**
2470      * CTPSV solves one of the systems of equations
2471      * A*x = b   or   A**T*x = b   or   A**H*x = b
2472      *
2473      * Details: http://www.netlib.org/lapack/explore-html/d8/d56/ctpsv_8f.html
2474      *
2475      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2476      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2477      *       'a' to packed matrix 'b'.
2478      *           k = 0
2479      *           for i in range(0, n):
2480      *              for j in range(i, n):
2481      *                  b[k++] = a[i, j]
2482      *
2483      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2484      * @param TransA The type of transpose applied to matrix A.
2485      * @param Diag Specifies whether or not A is unit triangular.
2486      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}.
2487      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2488      * @param incX The increment for the elements of vector x, must be larger than zero.
2489      */
2490     void CTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2491                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2492 
2493     /**
2494      * ZTPSV solves one of the systems of equations
2495      * A*x = b   or   A**T*x = b   or   A**H*x = b
2496      *
2497      * Details: http://www.netlib.org/lapack/explore-html/da/d57/ztpsv_8f.html
2498      *
2499      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2500      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2501      *       'a' to packed matrix 'b'.
2502      *           k = 0
2503      *           for i in range(0, n):
2504      *              for j in range(i, n):
2505      *                  b[k++] = a[i, j]
2506      *
2507      * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
2508      * @param TransA The type of transpose applied to matrix A.
2509      * @param Diag Specifies whether or not A is unit triangular.
2510      * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}.
2511      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
2512      * @param incX The increment for the elements of vector x, must be larger than zero.
2513      */
2514     void ZTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
2515                const sp<Allocation>& Ap, const sp<Allocation>& X, int incX);
2516 
2517     /**
2518      * SSYMV performs the matrix-vector operation
2519      * y := alpha*A*x + beta*y
2520      *
2521      * Details: http://www.netlib.org/lapack/explore-html/d2/d94/ssymv_8f.html
2522      *
2523      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2524      * @param alpha The scalar alpha.
2525      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2526      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2527      * @param incX The increment for the elements of vector x, must be larger than zero.
2528      * @param beta The scalar beta.
2529      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2530      * @param incY The increment for the elements of vector y, must be larger than zero.
2531      */
2532     void SSYMV(RsBlasUplo Uplo, float alpha, const sp<Allocation>& A, const sp<Allocation>& X,
2533                int incX, float beta, const sp<Allocation>& Y, int incY);
2534 
2535     /**
2536      * SSBMV performs the matrix-vector operation
2537      * y := alpha*A*x + beta*y
2538      *
2539      * Details: http://www.netlib.org/lapack/explore-html/d3/da1/ssbmv_8f.html
2540      *
2541      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2542      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2543      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2544      *           for i in range(0, n):
2545      *              for j in range(i, min(i+k+1, n)):
2546      *                  b[i, j-i] = a[i, j]
2547      *
2548      * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
2549      * @param K The number of off-diagonals of the matrix A
2550      * @param alpha The scalar alpha.
2551      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2552      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2553      * @param incX The increment for the elements of vector x, must be larger than zero.
2554      * @param beta The scalar beta.
2555      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2556      * @param incY The increment for the elements of vector y, must be larger than zero.
2557      */
2558     void SSBMV(RsBlasUplo Uplo, int K, float alpha, const sp<Allocation>& A, const sp<Allocation>& X,
2559                int incX, float beta, const sp<Allocation>& Y, int incY);
2560 
2561     /**
2562      * SSPMV performs the matrix-vector operation
2563      * y := alpha*A*x + beta*y
2564      *
2565      * Details: http://www.netlib.org/lapack/explore-html/d8/d68/sspmv_8f.html
2566      *
2567      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2568      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2569      *       'a' to packed matrix 'b'.
2570      *           k = 0
2571      *           for i in range(0, n):
2572      *              for j in range(i, n):
2573      *                  b[k++] = a[i, j]
2574      *
2575      * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
2576      * @param alpha The scalar alpha.
2577      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
2578      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2579      * @param incX The increment for the elements of vector x, must be larger than zero.
2580      * @param beta The scalar beta.
2581      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2582      * @param incY The increment for the elements of vector y, must be larger than zero.
2583      */
2584     void SSPMV(RsBlasUplo Uplo, float alpha, const sp<Allocation>& Ap, const sp<Allocation>& X,
2585                int incX, float beta, const sp<Allocation>& Y, int incY);
2586 
2587     /**
2588      * SGER performs the rank 1 operation
2589      * A := alpha*x*y**T + A
2590      *
2591      * Details: http://www.netlib.org/lapack/explore-html/db/d5c/sger_8f.html
2592      *
2593      * @param alpha The scalar alpha.
2594      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2595      * @param incX The increment for the elements of vector x, must be larger than zero.
2596      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2597      * @param incY The increment for the elements of vector y, must be larger than zero.
2598      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2599      */
2600     void SGER(float alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2601 
2602     /**
2603      * SSYR performs the rank 1 operation
2604      * A := alpha*x*x**T + A
2605      *
2606      * Details: http://www.netlib.org/lapack/explore-html/d6/dac/ssyr_8f.html
2607      *
2608      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2609      * @param alpha The scalar alpha.
2610      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2611      * @param incX The increment for the elements of vector x, must be larger than zero.
2612      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2613      */
2614     void SSYR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& A);
2615 
2616     /**
2617      * SSPR performs the rank 1 operation
2618      * A := alpha*x*x**T + A
2619      *
2620      * Details: http://www.netlib.org/lapack/explore-html/d2/d9b/sspr_8f.html
2621      *
2622      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2623      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2624      *       'a' to packed matrix 'b'.
2625      *           k = 0
2626      *           for i in range(0, n):
2627      *              for j in range(i, n):
2628      *                  b[k++] = a[i, j]
2629      *
2630      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
2631      * @param alpha The scalar alpha.
2632      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2633      * @param incX The increment for the elements of vector x, must be larger than zero.
2634      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
2635      */
2636     void SSPR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Ap);
2637 
2638     /**
2639      * SSYR2 performs the symmetric rank 2 operation
2640      * A := alpha*x*y**T + alpha*y*x**T + A
2641      *
2642      * Details: http://www.netlib.org/lapack/explore-html/db/d99/ssyr2_8f.html
2643      *
2644      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2645      * @param alpha The scalar alpha.
2646      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2647      * @param incX The increment for the elements of vector x, must be larger than zero.
2648      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2649      * @param incY The increment for the elements of vector y, must be larger than zero.
2650      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
2651      */
2652     void SSYR2(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX,
2653                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2654 
2655     /**
2656      * SSPR2 performs the symmetric rank 2 operation
2657      * A := alpha*x*y**T + alpha*y*x**T + A
2658      *
2659      * Details: http://www.netlib.org/lapack/explore-html/db/d3e/sspr2_8f.html
2660      *
2661      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2662      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2663      *       'a' to packed matrix 'b'.
2664      *           k = 0
2665      *           for i in range(0, n):
2666      *              for j in range(i, n):
2667      *                  b[k++] = a[i, j]
2668      *
2669      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
2670      * @param alpha The scalar alpha.
2671      * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
2672      * @param incX The increment for the elements of vector x, must be larger than zero.
2673      * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
2674      * @param incY The increment for the elements of vector y, must be larger than zero.
2675      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
2676      */
2677     void SSPR2(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX,
2678                const sp<Allocation>& Y, int incY, const sp<Allocation>& Ap);
2679 
2680     /**
2681      * DSYMV performs the matrix-vector operation
2682      * y := alpha*A*x + beta*y
2683      *
2684      * Details: http://www.netlib.org/lapack/explore-html/d8/dbe/dsymv_8f.html
2685      *
2686      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2687      * @param alpha The scalar alpha.
2688      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2689      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2690      * @param incX The increment for the elements of vector x, must be larger than zero.
2691      * @param beta The scalar beta.
2692      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2693      * @param incY The increment for the elements of vector y, must be larger than zero.
2694      */
2695     void DSYMV(RsBlasUplo Uplo, double alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
2696                double beta, const sp<Allocation>& Y, int incY);
2697 
2698     /**
2699      * DSBMV performs the matrix-vector operation
2700      * y := alpha*A*x + beta*y
2701      *
2702      * Details: http://www.netlib.org/lapack/explore-html/d8/d1e/dsbmv_8f.html
2703      *
2704      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2705      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2706      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2707      *           for i in range(0, n):
2708      *              for j in range(i, min(i+k+1, n)):
2709      *                  b[i, j-i] = a[i, j]
2710      *
2711      * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
2712      * @param K The number of off-diagonals of the matrix A
2713      * @param alpha The scalar alpha.
2714      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2715      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2716      * @param incX The increment for the elements of vector x, must be larger than zero.
2717      * @param beta The scalar beta.
2718      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2719      * @param incY The increment for the elements of vector y, must be larger than zero.
2720      */
2721     void DSBMV(RsBlasUplo Uplo, int K, double alpha, const sp<Allocation>& A, const sp<Allocation>& X, int incX,
2722                double beta, const sp<Allocation>& Y, int incY);
2723 
2724     /**
2725      * DSPMV performs the matrix-vector operation
2726      * y := alpha*A*x + beta*y
2727      *
2728      * Details: http://www.netlib.org/lapack/explore-html/d4/d85/dspmv_8f.html
2729      *
2730      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2731      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2732      *       'a' to packed matrix 'b'.
2733      *           k = 0
2734      *           for i in range(0, n):
2735      *              for j in range(i, n):
2736      *                  b[k++] = a[i, j]
2737      *
2738      * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
2739      * @param alpha The scalar alpha.
2740      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
2741      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2742      * @param incX The increment for the elements of vector x, must be larger than zero.
2743      * @param beta The scalar beta.
2744      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2745      * @param incY The increment for the elements of vector y, must be larger than zero.
2746      */
2747     void DSPMV(RsBlasUplo Uplo, double alpha, const sp<Allocation>& Ap, const sp<Allocation>& X, int incX,
2748                double beta, const sp<Allocation>& Y, int incY);
2749 
2750     /**
2751      * DGER performs the rank 1 operation
2752      * A := alpha*x*y**T + A
2753      *
2754      * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dger_8f.html
2755      *
2756      * @param alpha The scalar alpha.
2757      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2758      * @param incX The increment for the elements of vector x, must be larger than zero.
2759      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2760      * @param incY The increment for the elements of vector y, must be larger than zero.
2761      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2762      */
2763     void DGER(double alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2764 
2765     /**
2766      * DSYR performs the rank 1 operation
2767      * A := alpha*x*x**T + A
2768      *
2769      * Details: http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f.html
2770      *
2771      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2772      * @param alpha The scalar alpha.
2773      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2774      * @param incX The increment for the elements of vector x, must be larger than zero.
2775      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2776      */
2777     void DSYR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& A);
2778 
2779     /**
2780      * DSPR performs the rank 1 operation
2781      * A := alpha*x*x**T + A
2782      *
2783      * Details: http://www.netlib.org/lapack/explore-html/dd/dba/dspr_8f.html
2784      *
2785      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2786      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2787      *       'a' to packed matrix 'b'.
2788      *           k = 0
2789      *           for i in range(0, n):
2790      *              for j in range(i, n):
2791      *                  b[k++] = a[i, j]
2792      *
2793      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
2794      * @param alpha The scalar alpha.
2795      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2796      * @param incX The increment for the elements of vector x, must be larger than zero.
2797      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
2798      */
2799     void DSPR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Ap);
2800 
2801     /**
2802      * DSYR2 performs the symmetric rank 2 operation
2803      * A := alpha*x*y**T + alpha*y*x**T + A
2804      *
2805      * Details: http://www.netlib.org/lapack/explore-html/de/d41/dsyr2_8f.html
2806      *
2807      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2808      * @param alpha The scalar alpha.
2809      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2810      * @param incX The increment for the elements of vector x, must be larger than zero.
2811      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2812      * @param incY The increment for the elements of vector y, must be larger than zero.
2813      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
2814      */
2815     void DSYR2(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX,
2816                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2817 
2818     /**
2819      * DSPR2 performs the symmetric rank 2 operation
2820      * A := alpha*x*y**T + alpha*y*x**T + A
2821      *
2822      * Details: http://www.netlib.org/lapack/explore-html/dd/d9e/dspr2_8f.html
2823      *
2824      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2825      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2826      *       'a' to packed matrix 'b'.
2827      *           k = 0
2828      *           for i in range(0, n):
2829      *              for j in range(i, n):
2830      *                  b[k++] = a[i, j]
2831      *
2832      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
2833      * @param alpha The scalar alpha.
2834      * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
2835      * @param incX The increment for the elements of vector x, must be larger than zero.
2836      * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
2837      * @param incY The increment for the elements of vector y, must be larger than zero.
2838      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
2839      */
2840     void DSPR2(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX,
2841                const sp<Allocation>& Y, int incY, const sp<Allocation>& Ap);
2842 
2843     /**
2844      * CHEMV performs the matrix-vector operation
2845      * y := alpha*A*x + beta*y
2846      *
2847      * Details: http://www.netlib.org/lapack/explore-html/d7/d51/chemv_8f.html
2848      *
2849      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2850      * @param alpha The scalar alpha.
2851      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2852      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2853      * @param incX The increment for the elements of vector x, must be larger than zero.
2854      * @param beta The scalar beta.
2855      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2856      * @param incY The increment for the elements of vector y, must be larger than zero.
2857      */
2858     void CHEMV(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& X,
2859                int incX, Float2 beta, const sp<Allocation>& Y, int incY);
2860 
2861     /**
2862      * CHBMV performs the matrix-vector operation
2863      * y := alpha*A*x + beta*y
2864      *
2865      * Details: http://www.netlib.org/lapack/explore-html/db/dc2/chbmv_8f.html
2866      *
2867      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
2868      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
2869      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
2870      *           for i in range(0, n):
2871      *              for j in range(i, min(i+k+1, n)):
2872      *                  b[i, j-i] = a[i, j]
2873      *
2874      * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
2875      * @param K The number of off-diagonals of the matrix A
2876      * @param alpha The scalar alpha.
2877      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2878      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2879      * @param incX The increment for the elements of vector x, must be larger than zero.
2880      * @param beta The scalar beta.
2881      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2882      * @param incY The increment for the elements of vector y, must be larger than zero.
2883      */
2884     void CHBMV(RsBlasUplo Uplo, int K, Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& X,
2885                int incX, Float2 beta, const sp<Allocation>& Y, int incY);
2886 
2887     /**
2888      * CHPMV performs the matrix-vector operation
2889      * y := alpha*A*x + beta*y
2890      *
2891      * Details: http://www.netlib.org/lapack/explore-html/d2/d06/chpmv_8f.html
2892      *
2893      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2894      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2895      *       'a' to packed matrix 'b'.
2896      *           k = 0
2897      *           for i in range(0, n):
2898      *              for j in range(i, n):
2899      *                  b[k++] = a[i, j]
2900      *
2901      * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
2902      * @param alpha The scalar alpha.
2903      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2904      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2905      * @param incX The increment for the elements of vector x, must be larger than zero.
2906      * @param beta The scalar beta.
2907      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2908      * @param incY The increment for the elements of vector y, must be larger than zero.
2909      */
2910     void CHPMV(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& Ap, const sp<Allocation>& X,
2911                int incX, Float2 beta, const sp<Allocation>& Y, int incY);
2912 
2913     /**
2914      * CGERU performs the rank 1 operation
2915      * A := alpha*x*y**T + A
2916      *
2917      * Details: http://www.netlib.org/lapack/explore-html/db/d5f/cgeru_8f.html
2918      *
2919      * @param alpha The scalar alpha.
2920      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2921      * @param incX The increment for the elements of vector x, must be larger than zero.
2922      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2923      * @param incY The increment for the elements of vector y, must be larger than zero.
2924      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2925      */
2926     void CGERU(Float2 alpha, const sp<Allocation>& X, int incX,
2927                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2928 
2929     /**
2930      * CGERC performs the rank 1 operation
2931      * A := alpha*x*y**H + A
2932      *
2933      * Details: http://www.netlib.org/lapack/explore-html/dd/d84/cgerc_8f.html
2934      *
2935      * @param alpha The scalar alpha.
2936      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2937      * @param incX The increment for the elements of vector x, must be larger than zero.
2938      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2939      * @param incY The increment for the elements of vector y, must be larger than zero.
2940      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2941      */
2942     void CGERC(Float2 alpha, const sp<Allocation>& X, int incX,
2943                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2944 
2945     /**
2946      * CHER performs the rank 1 operation
2947      * A := alpha*x*x**H + A
2948      *
2949      * Details: http://www.netlib.org/lapack/explore-html/d3/d6d/cher_8f.html
2950      *
2951      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2952      * @param alpha The scalar alpha.
2953      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2954      * @param incX The increment for the elements of vector x, must be larger than zero.
2955      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2956      */
2957     void CHER(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& A);
2958 
2959     /**
2960      * CHPR performs the rank 1 operation
2961      * A := alpha*x*x**H + A
2962      *
2963      * Details: http://www.netlib.org/lapack/explore-html/db/dcd/chpr_8f.html
2964      *
2965      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
2966      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
2967      *       'a' to packed matrix 'b'.
2968      *           k = 0
2969      *           for i in range(0, n):
2970      *              for j in range(i, n):
2971      *                  b[k++] = a[i, j]
2972      *
2973      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
2974      * @param alpha The scalar alpha.
2975      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2976      * @param incX The increment for the elements of vector x, must be larger than zero.
2977      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2978      */
2979     void CHPR(RsBlasUplo Uplo, float alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Ap);
2980 
2981     /**
2982      * CHER2 performs the symmetric rank 2 operation
2983      * A := alpha*x*y**H + alpha*y*x**H + A
2984      *
2985      * Details: http://www.netlib.org/lapack/explore-html/db/d87/cher2_8f.html
2986      *
2987      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
2988      * @param alpha The scalar alpha.
2989      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
2990      * @param incX The increment for the elements of vector x, must be larger than zero.
2991      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
2992      * @param incY The increment for the elements of vector y, must be larger than zero.
2993      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
2994      */
2995     void CHER2(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& X, int incX,
2996                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
2997 
2998     /**
2999      * CHPR2 performs the symmetric rank 2 operation
3000      * A := alpha*x*y**H + alpha*y*x**H + A
3001      *
3002      * Details: http://www.netlib.org/lapack/explore-html/d6/d44/chpr2_8f.html
3003      *
3004      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
3005      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
3006      *       'a' to packed matrix 'b'.
3007      *           k = 0
3008      *           for i in range(0, n):
3009      *              for j in range(i, n):
3010      *                  b[k++] = a[i, j]
3011      *
3012      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
3013      * @param alpha The scalar alpha.
3014      * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
3015      * @param incX The increment for the elements of vector x, must be larger than zero.
3016      * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
3017      * @param incY The increment for the elements of vector y, must be larger than zero.
3018      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3019      */
3020     void CHPR2(RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& X, int incX,
3021                const sp<Allocation>& Y, int incY, const sp<Allocation>& Ap);
3022 
3023     /**
3024      * ZHEMV performs the matrix-vector operation
3025      * y := alpha*A*x + beta*y
3026      *
3027      * Details: http://www.netlib.org/lapack/explore-html/d0/ddd/zhemv_8f.html
3028      *
3029      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3030      * @param alpha The scalar alpha.
3031      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3032      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3033      * @param incX The increment for the elements of vector x, must be larger than zero.
3034      * @param beta The scalar beta.
3035      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3036      * @param incY The increment for the elements of vector y, must be larger than zero.
3037      */
3038     void ZHEMV(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& X,
3039                int incX, Double2 beta, const sp<Allocation>& Y, int incY);
3040 
3041     /**
3042      * ZHBMV performs the matrix-vector operation
3043      * y := alpha*A*x + beta*y
3044      *
3045      * Details: http://www.netlib.org/lapack/explore-html/d3/d1a/zhbmv_8f.html
3046      *
3047      * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
3048      *       but only the region N*(K+1) will be referenced. The following subroutine can is an
3049      *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
3050      *           for i in range(0, n):
3051      *              for j in range(i, min(i+k+1, n)):
3052      *                  b[i, j-i] = a[i, j]
3053      *
3054      * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
3055      * @param K The number of off-diagonals of the matrix A
3056      * @param alpha The scalar alpha.
3057      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3058      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3059      * @param incX The increment for the elements of vector x, must be larger than zero.
3060      * @param beta The scalar beta.
3061      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3062      * @param incY The increment for the elements of vector y, must be larger than zero.
3063      */
3064     void ZHBMV(RsBlasUplo Uplo, int K, Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& X,
3065                int incX, Double2 beta, const sp<Allocation>& Y, int incY);
3066 
3067     /**
3068      * ZHPMV performs the matrix-vector operation
3069      * y := alpha*A*x + beta*y
3070      *
3071      * Details: http://www.netlib.org/lapack/explore-html/d0/d60/zhpmv_8f.html
3072      *
3073      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
3074      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
3075      *       'a' to packed matrix 'b'.
3076      *           k = 0
3077      *           for i in range(0, n):
3078      *              for j in range(i, n):
3079      *                  b[k++] = a[i, j]
3080      *
3081      * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
3082      * @param alpha The scalar alpha.
3083      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3084      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3085      * @param incX The increment for the elements of vector x, must be larger than zero.
3086      * @param beta The scalar beta.
3087      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3088      * @param incY The increment for the elements of vector y, must be larger than zero.
3089      */
3090     void ZHPMV(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& Ap, const sp<Allocation>& X,
3091                int incX, Double2 beta, const sp<Allocation>& Y, int incY);
3092 
3093     /**
3094      * ZGERU performs the rank 1 operation
3095      * A := alpha*x*y**T + A
3096      *
3097      * Details: http://www.netlib.org/lapack/explore-html/d7/d12/zgeru_8f.html
3098      *
3099      * @param alpha The scalar alpha.
3100      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3101      * @param incX The increment for the elements of vector x, must be larger than zero.
3102      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3103      * @param incY The increment for the elements of vector y, must be larger than zero.
3104      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3105      */
3106     void ZGERU(Double2 alpha, const sp<Allocation>& X, int incX,
3107                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
3108 
3109     /**
3110      * ZGERC performs the rank 1 operation
3111      * A := alpha*x*y**H + A
3112      *
3113      * Details: http://www.netlib.org/lapack/explore-html/d3/dad/zgerc_8f.html
3114      *
3115      * @param alpha The scalar alpha.
3116      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3117      * @param incX The increment for the elements of vector x, must be larger than zero.
3118      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3119      * @param incY The increment for the elements of vector y, must be larger than zero.
3120      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3121      */
3122     void ZGERC(Double2 alpha, const sp<Allocation>& X, int incX,
3123                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
3124 
3125     /**
3126      * ZHER performs the rank 1 operation
3127      * A := alpha*x*x**H + A
3128      *
3129      * Details: http://www.netlib.org/lapack/explore-html/de/d0e/zher_8f.html
3130      *
3131      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3132      * @param alpha The scalar alpha.
3133      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3134      * @param incX The increment for the elements of vector x, must be larger than zero.
3135      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3136      */
3137     void ZHER(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& A);
3138 
3139     /**
3140      * ZHPR performs the rank 1 operation
3141      * A := alpha*x*x**H + A
3142      *
3143      * Details: http://www.netlib.org/lapack/explore-html/de/de1/zhpr_8f.html
3144      *
3145      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
3146      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
3147      *       'a' to packed matrix 'b'.
3148      *           k = 0
3149      *           for i in range(0, n):
3150      *              for j in range(i, n):
3151      *                  b[k++] = a[i, j]
3152      *
3153      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
3154      * @param alpha The scalar alpha.
3155      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3156      * @param incX The increment for the elements of vector x, must be larger than zero.
3157      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3158      */
3159     void ZHPR(RsBlasUplo Uplo, double alpha, const sp<Allocation>& X, int incX, const sp<Allocation>& Ap);
3160 
3161     /**
3162      * ZHER2 performs the symmetric rank 2 operation
3163      * A := alpha*x*y**H + alpha*y*x**H + A
3164      *
3165      * Details: http://www.netlib.org/lapack/explore-html/da/d8a/zher2_8f.html
3166      *
3167      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3168      * @param alpha The scalar alpha.
3169      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3170      * @param incX The increment for the elements of vector x, must be larger than zero.
3171      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3172      * @param incY The increment for the elements of vector y, must be larger than zero.
3173      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3174      */
3175     void ZHER2(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& X, int incX,
3176                const sp<Allocation>& Y, int incY, const sp<Allocation>& A);
3177 
3178     /**
3179      * ZHPR2 performs the symmetric rank 2 operation
3180      * A := alpha*x*y**H + alpha*y*x**H + A
3181      *
3182      * Details: http://www.netlib.org/lapack/explore-html/d5/d52/zhpr2_8f.html
3183      *
3184      * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
3185      *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
3186      *       'a' to packed matrix 'b'.
3187      *           k = 0
3188      *           for i in range(0, n):
3189      *              for j in range(i, n):
3190      *                  b[k++] = a[i, j]
3191      *
3192      * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
3193      * @param alpha The scalar alpha.
3194      * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
3195      * @param incX The increment for the elements of vector x, must be larger than zero.
3196      * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
3197      * @param incY The increment for the elements of vector y, must be larger than zero.
3198      * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3199      */
3200     void ZHPR2(RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& X, int incX,
3201                const sp<Allocation>& Y, int incY, const sp<Allocation>& Ap);
3202 
3203     /**
3204      * SGEMM performs one of the matrix-matrix operations
3205      * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
3206      *
3207      * Details: http://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f.html
3208      *
3209      * @param TransA The type of transpose applied to matrix A.
3210      * @param TransB The type of transpose applied to matrix B.
3211      * @param alpha The scalar alpha.
3212      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3213      * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
3214      * @param beta The scalar beta.
3215      * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
3216      */
3217     void SGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, float alpha, const sp<Allocation>& A,
3218                       const sp<Allocation>& B, float beta, const sp<Allocation>& C);
3219 
3220 
3221     /**
3222      * DGEMM performs one of the matrix-matrix operations
3223      * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
3224      *
3225      * Details: http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f.html
3226      *
3227      * @param TransA The type of transpose applied to matrix A.
3228      * @param TransB The type of transpose applied to matrix B.
3229      * @param alpha The scalar alpha.
3230      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3231      * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
3232      * @param beta The scalar beta.
3233      * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
3234      */
3235     void DGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, double alpha, const sp<Allocation>& A,
3236                       const sp<Allocation>& B, double beta, const sp<Allocation>& C);
3237 
3238     /**
3239      * CGEMM performs one of the matrix-matrix operations
3240      * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T  or  op(X) = X**H
3241      *
3242      * Details: http://www.netlib.org/lapack/explore-html/d6/d5b/cgemm_8f.html
3243      *
3244      * @param TransA The type of transpose applied to matrix A.
3245      * @param TransB The type of transpose applied to matrix B.
3246      * @param alpha The scalar alpha.
3247      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3248      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3249      * @param beta The scalar beta.
3250      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3251      */
3252     void CGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Float2 alpha, const sp<Allocation>& A,
3253                       const sp<Allocation>& B, Float2 beta, const sp<Allocation>& C);
3254 
3255     /**
3256      * ZGEMM performs one of the matrix-matrix operations
3257      * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T  or  op(X) = X**H
3258      *
3259      * Details: http://www.netlib.org/lapack/explore-html/d7/d76/zgemm_8f.html
3260      *
3261      * @param TransA The type of transpose applied to matrix A.
3262      * @param TransB The type of transpose applied to matrix B.
3263      * @param alpha The scalar alpha.
3264      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3265      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3266      * @param beta The scalar beta.
3267      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3268      */
3269     void ZGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Double2 alpha, const sp<Allocation>& A,
3270                       const sp<Allocation>& B, Double2 beta, const sp<Allocation>& C);
3271 
3272     /**
3273      * SSYMM performs one of the matrix-matrix operations
3274      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3275      *
3276      * Details: http://www.netlib.org/lapack/explore-html/d7/d42/ssymm_8f.html
3277      *
3278      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3279      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3280      * @param alpha The scalar alpha.
3281      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3282      * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
3283      * @param beta The scalar beta.
3284      * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
3285      */
3286     void SSYMM(RsBlasSide Side, RsBlasUplo Uplo, float alpha, const sp<Allocation>& A,
3287                       const sp<Allocation>& B, float beta, const sp<Allocation>& C);
3288 
3289     /**
3290      * DSYMM performs one of the matrix-matrix operations
3291      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3292      *
3293      * Details: http://www.netlib.org/lapack/explore-html/d8/db0/dsymm_8f.html
3294      *
3295      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3296      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3297      * @param alpha The scalar alpha.
3298      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3299      * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
3300      * @param beta The scalar beta.
3301      * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
3302      */
3303     void DSYMM(RsBlasSide Side, RsBlasUplo Uplo, double alpha, const sp<Allocation>& A,
3304                       const sp<Allocation>& B, double beta, const sp<Allocation>& C);
3305 
3306     /**
3307      * CSYMM performs one of the matrix-matrix operations
3308      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3309      *
3310      * Details: http://www.netlib.org/lapack/explore-html/db/d59/csymm_8f.html
3311      *
3312      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3313      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3314      * @param alpha The scalar alpha.
3315      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3316      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3317      * @param beta The scalar beta.
3318      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3319      */
3320     void CSYMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& A,
3321                       const sp<Allocation>& B, Float2 beta, const sp<Allocation>& C);
3322 
3323     /**
3324      * ZSYMM performs one of the matrix-matrix operations
3325      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3326      *
3327      * Details: http://www.netlib.org/lapack/explore-html/df/d51/zsymm_8f.html
3328      *
3329      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3330      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3331      * @param alpha The scalar alpha.
3332      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3333      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3334      * @param beta The scalar beta.
3335      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3336      */
3337     void ZSYMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& A,
3338                       const sp<Allocation>& B, Double2 beta, const sp<Allocation>& C);
3339 
3340     /**
3341      * SSYRK performs one of the symmetric rank k operations
3342      * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
3343      *
3344      * Details: http://www.netlib.org/lapack/explore-html/d0/d40/ssyrk_8f.html
3345      *
3346      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3347      * @param Trans The type of transpose applied to the operation.
3348      * @param alpha The scalar alpha.
3349      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3350      * @param beta The scalar beta.
3351      * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
3352      */
3353     void SSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha,
3354                const sp<Allocation>& A, float beta, const sp<Allocation>& C);
3355 
3356     /**
3357      * DSYRK performs one of the symmetric rank k operations
3358      * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
3359      *
3360      * Details: http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f.html
3361      *
3362      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3363      * @param Trans The type of transpose applied to the operation.
3364      * @param alpha The scalar alpha.
3365      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3366      * @param beta The scalar beta.
3367      * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
3368      */
3369     void DSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha,
3370                const sp<Allocation>& A, double beta, const sp<Allocation>& C);
3371 
3372     /**
3373      * CSYRK performs one of the symmetric rank k operations
3374      * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
3375      *
3376      * Details: http://www.netlib.org/lapack/explore-html/d3/d6a/csyrk_8f.html
3377      *
3378      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3379      * @param Trans The type of transpose applied to the operation.
3380      * @param alpha The scalar alpha.
3381      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3382      * @param beta The scalar beta.
3383      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3384      */
3385     void CSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha,
3386                const sp<Allocation>& A, Float2 beta, const sp<Allocation>& C);
3387 
3388     /**
3389      * ZSYRK performs one of the symmetric rank k operations
3390      * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
3391      *
3392      * Details: http://www.netlib.org/lapack/explore-html/de/d54/zsyrk_8f.html
3393      *
3394      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3395      * @param Trans The type of transpose applied to the operation.
3396      * @param alpha The scalar alpha.
3397      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3398      * @param beta The scalar beta.
3399      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3400      */
3401     void ZSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha,
3402                const sp<Allocation>& A, Double2 beta, const sp<Allocation>& C);
3403 
3404     /**
3405      * SSYR2K performs one of the symmetric rank 2k operations
3406      * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
3407      *
3408      * Details: http://www.netlib.org/lapack/explore-html/df/d3d/ssyr2k_8f.html
3409      *
3410      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3411      * @param Trans The type of transpose applied to the operation.
3412      * @param alpha The scalar alpha.
3413      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3414      * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
3415      * @param beta The scalar beta.
3416      * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
3417      */
3418     void SSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha,
3419                 const sp<Allocation>& A, const sp<Allocation>& B, float beta, const sp<Allocation>& C);
3420 
3421     /**
3422      * DSYR2K performs one of the symmetric rank 2k operations
3423      * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
3424      *
3425      * Details: http://www.netlib.org/lapack/explore-html/d1/dec/dsyr2k_8f.html
3426      *
3427      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3428      * @param Trans The type of transpose applied to the operation.
3429      * @param alpha The scalar alpha.
3430      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3431      * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
3432      * @param beta The scalar beta.
3433      * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
3434      */
3435     void DSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha,
3436                 const sp<Allocation>& A, const sp<Allocation>& B, double beta, const sp<Allocation>& C);
3437 
3438     /**
3439      * CSYR2K performs one of the symmetric rank 2k operations
3440      * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
3441      *
3442      * Details: http://www.netlib.org/lapack/explore-html/de/d7e/csyr2k_8f.html
3443      *
3444      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3445      * @param Trans The type of transpose applied to the operation.
3446      * @param alpha The scalar alpha.
3447      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3448      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3449      * @param beta The scalar beta.
3450      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3451      */
3452     void CSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha,
3453                 const sp<Allocation>& A, const sp<Allocation>& B, Float2 beta, const sp<Allocation>& C);
3454 
3455     /**
3456      * ZSYR2K performs one of the symmetric rank 2k operations
3457      * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
3458      *
3459      * Details: http://www.netlib.org/lapack/explore-html/df/d20/zsyr2k_8f.html
3460      *
3461      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3462      * @param Trans The type of transpose applied to the operation.
3463      * @param alpha The scalar alpha.
3464      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3465      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3466      * @param beta The scalar beta.
3467      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3468      */
3469     void ZSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha,
3470                 const sp<Allocation>& A, const sp<Allocation>& B, Double2 beta, const sp<Allocation>& C);
3471 
3472     /**
3473      * STRMM performs one of the matrix-matrix operations
3474      * B := alpha*op(A)*B   or   B := alpha*B*op(A)
3475      * op(A) is one of  op(A) = A  or  op(A) = A**T
3476      *
3477      * Details: http://www.netlib.org/lapack/explore-html/df/d01/strmm_8f.html
3478      *
3479      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3480      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3481      * @param TransA The type of transpose applied to matrix A.
3482      * @param Diag Specifies whether or not A is unit triangular.
3483      * @param alpha The scalar alpha.
3484      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3485      * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
3486      */
3487     void STRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA,
3488                RsBlasDiag Diag, float alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3489 
3490     /**
3491      * DTRMM performs one of the matrix-matrix operations
3492      * B := alpha*op(A)*B   or   B := alpha*B*op(A)
3493      * op(A) is one of  op(A) = A  or  op(A) = A**T
3494      *
3495      * Details: http://www.netlib.org/lapack/explore-html/dd/d19/dtrmm_8f.html
3496      *
3497      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3498      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3499      * @param TransA The type of transpose applied to matrix A.
3500      * @param Diag Specifies whether or not A is unit triangular.
3501      * @param alpha The scalar alpha.
3502      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3503      * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
3504      */
3505     void DTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3506                double alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3507 
3508     /**
3509      * CTRMM performs one of the matrix-matrix operations
3510      * B := alpha*op(A)*B   or   B := alpha*B*op(A)
3511      * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
3512      *
3513      * Details: http://www.netlib.org/lapack/explore-html/d4/d9b/ctrmm_8f.html
3514      *
3515      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3516      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3517      * @param TransA The type of transpose applied to matrix A.
3518      * @param Diag Specifies whether or not A is unit triangular.
3519      * @param alpha The scalar alpha.
3520      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3521      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3522      */
3523     void CTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3524                Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3525 
3526     /**
3527      * ZTRMM performs one of the matrix-matrix operations
3528      * B := alpha*op(A)*B   or   B := alpha*B*op(A)
3529      * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
3530      *
3531      * Details: http://www.netlib.org/lapack/explore-html/d8/de1/ztrmm_8f.html
3532      *
3533      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3534      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3535      * @param TransA The type of transpose applied to matrix A.
3536      * @param Diag Specifies whether or not A is unit triangular.
3537      * @param alpha The scalar alpha.
3538      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3539      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3540      */
3541     void ZTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3542                Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3543 
3544     /**
3545      * STRSM solves one of the matrix equations
3546      * op(A)*X := alpha*B   or   X*op(A) := alpha*B
3547      * op(A) is one of  op(A) = A  or  op(A) = A**T
3548      *
3549      * Details: http://www.netlib.org/lapack/explore-html/d2/d8b/strsm_8f.html
3550      *
3551      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3552      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3553      * @param TransA The type of transpose applied to matrix A.
3554      * @param Diag Specifies whether or not A is unit triangular.
3555      * @param alpha The scalar alpha.
3556      * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
3557      * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
3558      */
3559     void STRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3560                float alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3561 
3562     /**
3563      * DTRSM solves one of the matrix equations
3564      * op(A)*X := alpha*B   or   X*op(A) := alpha*B
3565      * op(A) is one of  op(A) = A  or  op(A) = A**T
3566      *
3567      * Details: http://www.netlib.org/lapack/explore-html/de/da7/dtrsm_8f.html
3568      *
3569      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3570      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3571      * @param TransA The type of transpose applied to matrix A.
3572      * @param Diag Specifies whether or not A is unit triangular.
3573      * @param alpha The scalar alpha.
3574      * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
3575      * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
3576      */
3577     void DTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3578                double alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3579 
3580     /**
3581      * CTRSM solves one of the matrix equations
3582      * op(A)*X := alpha*B   or   X*op(A) := alpha*B
3583      * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
3584      *
3585      * Details: http://www.netlib.org/lapack/explore-html/de/d30/ctrsm_8f.html
3586      *
3587      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3588      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3589      * @param TransA The type of transpose applied to matrix A.
3590      * @param Diag Specifies whether or not A is unit triangular.
3591      * @param alpha The scalar alpha.
3592      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3593      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3594      */
3595     void CTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3596                Float2 alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3597 
3598     /**
3599      * ZTRSM solves one of the matrix equations
3600      * op(A)*X := alpha*B   or   X*op(A) := alpha*B
3601      * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
3602      *
3603      * Details: http://www.netlib.org/lapack/explore-html/d1/d39/ztrsm_8f.html
3604      *
3605      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3606      * @param Uplo Specifies whether matrix A is upper or lower triangular.
3607      * @param TransA The type of transpose applied to matrix A.
3608      * @param Diag Specifies whether or not A is unit triangular.
3609      * @param alpha The scalar alpha.
3610      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3611      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3612      */
3613     void ZTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
3614                Double2 alpha, const sp<Allocation>& A, const sp<Allocation>& B);
3615 
3616     /**
3617      * CHEMM performs one of the matrix-matrix operations
3618      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3619      *
3620      * Details: http://www.netlib.org/lapack/explore-html/d3/d66/chemm_8f.html
3621      *
3622      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3623      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3624      * @param alpha The scalar alpha.
3625      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3626      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3627      * @param beta The scalar beta.
3628      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3629      */
3630     void CHEMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, const sp<Allocation>& A,
3631                const sp<Allocation>& B, Float2 beta, const sp<Allocation>& C);
3632 
3633     /**
3634      * ZHEMM performs one of the matrix-matrix operations
3635      * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
3636      *
3637      * Details: http://www.netlib.org/lapack/explore-html/d6/d3e/zhemm_8f.html
3638      *
3639      * @param Side Specifies whether the symmetric matrix A appears on the left or right.
3640      * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
3641      * @param alpha The scalar alpha.
3642      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3643      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3644      * @param beta The scalar beta.
3645      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3646      */
3647     void ZHEMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, const sp<Allocation>& A,
3648                const sp<Allocation>& B, Double2 beta, const sp<Allocation>& C);
3649 
3650     /**
3651      * CHERK performs one of the hermitian rank k operations
3652      * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
3653      *
3654      * Details: http://www.netlib.org/lapack/explore-html/d8/d52/cherk_8f.html
3655      *
3656      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3657      * @param Trans The type of transpose applied to the operation.
3658      * @param alpha The scalar alpha.
3659      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3660      * @param beta The scalar beta.
3661      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3662      */
3663     void CHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, const sp<Allocation>& A,
3664                float beta, const sp<Allocation>& C);
3665 
3666     /**
3667      * ZHERK performs one of the hermitian rank k operations
3668      * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
3669      *
3670      * Details: http://www.netlib.org/lapack/explore-html/d1/db1/zherk_8f.html
3671      *
3672      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3673      * @param Trans The type of transpose applied to the operation.
3674      * @param alpha The scalar alpha.
3675      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3676      * @param beta The scalar beta.
3677      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3678      */
3679     void ZHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, const sp<Allocation>& A,
3680                double beta, const sp<Allocation>& C);
3681 
3682     /**
3683      * CHER2K performs one of the hermitian rank 2k operations
3684      * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C   or   C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C
3685      *
3686      * Details: http://www.netlib.org/lapack/explore-html/d1/d82/cher2k_8f.html
3687      *
3688      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3689      * @param Trans The type of transpose applied to the operation.
3690      * @param alpha The scalar alpha.
3691      * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
3692      * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
3693      * @param beta The scalar beta.
3694      * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
3695      */
3696     void CHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, const sp<Allocation>& A,
3697                 const sp<Allocation>& B, float beta, const sp<Allocation>& C);
3698 
3699     /**
3700      * ZHER2K performs one of the hermitian rank 2k operations
3701      * C := alpha*A*B**H + conjg( alpha )*B*A**H + beta*C   or   C := alpha*A**H*B + conjg( alpha )*B**H*A + beta*C
3702      *
3703      * Details: http://www.netlib.org/lapack/explore-html/d7/dfa/zher2k_8f.html
3704      *
3705      * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
3706      * @param Trans The type of transpose applied to the operation.
3707      * @param alpha The scalar alpha.
3708      * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3709      * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
3710      * @param beta The scalar beta.
3711      * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
3712      */
3713     void ZHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, const sp<Allocation>& A,
3714                 const sp<Allocation>& B, double beta, const sp<Allocation>& C);
3715 
3716     /**
3717      * 8-bit GEMM-like operation for neural networks: C = A * Transpose(B)
3718      * Calculations are done in 1.10.21 fixed-point format for the final output,
3719      * just before there's a shift down to drop the fractional parts. The output
3720      * values are gated to 0 to 255 to fit in a byte, but the 10-bit format
3721      * gives some headroom to avoid wrapping around on small overflows.
3722      *
3723      * @param A The input allocation contains matrix A, supported elements type: {Element#U8}.
3724      * @param a_offset The offset for all values in matrix A, e.g A[i,j] = A[i,j] - a_offset. Value should be from 0 to 255.
3725      * @param B The input allocation contains matrix B, supported elements type: {Element#U8}.
3726      * @param b_offset The offset for all values in matrix B, e.g B[i,j] = B[i,j] - b_offset. Value should be from 0 to 255.
3727      * @param C The input allocation contains matrix C, supported elements type: {Element#U8}.
3728      * @param c_offset The offset for all values in matrix C.
3729      * @param c_mult The multiplier for all values in matrix C, e.g C[i,j] = (C[i,j] + c_offset) * c_mult.
3730      **/
3731     void BNNM(const sp<Allocation>& A, int a_offset, const sp<Allocation>& B, int b_offset, const sp<Allocation>& C,
3732               int c_offset, int c_mult);
3733 };
3734 
3735 /**
3736  * Intrinsic kernel for blending two Allocations.
3737  */
3738 class ScriptIntrinsicBlend : public ScriptIntrinsic {
3739  private:
3740     ScriptIntrinsicBlend(sp<RS> rs, sp<const Element> e);
3741  public:
3742     /**
3743      * Supported Element types are U8_4.
3744      * @param[in] rs RenderScript context
3745      * @param[in] e Element
3746      * @return new ScriptIntrinsicBlend
3747      */
3748     static sp<ScriptIntrinsicBlend> create(const sp<RS>& rs, const sp<const Element>& e);
3749     /**
3750      * sets dst = {0, 0, 0, 0}
3751      * @param[in] in input Allocation
3752      * @param[in] out output Allocation
3753      */
3754     void forEachClear(const sp<Allocation>& in, const sp<Allocation>& out);
3755     /**
3756      * Sets dst = src
3757      * @param[in] in input Allocation
3758      * @param[in] out output Allocation
3759      */
3760     void forEachSrc(const sp<Allocation>& in, const sp<Allocation>& out);
3761     /**
3762      * Sets dst = dst (NOP)
3763      * @param[in] in input Allocation
3764      * @param[in] out output Allocation
3765      */
3766     void forEachDst(const sp<Allocation>& in, const sp<Allocation>& out);
3767     /**
3768      * Sets dst = src + dst * (1.0 - src.a)
3769      * @param[in] in input Allocation
3770      * @param[in] out output Allocation
3771      */
3772     void forEachSrcOver(const sp<Allocation>& in, const sp<Allocation>& out);
3773     /**
3774      * Sets dst = dst + src * (1.0 - dst.a)
3775      * @param[in] in input Allocation
3776      * @param[in] out output Allocation
3777      */
3778     void forEachDstOver(const sp<Allocation>& in, const sp<Allocation>& out);
3779     /**
3780      * Sets dst = src * dst.a
3781      * @param[in] in input Allocation
3782      * @param[in] out output Allocation
3783      */
3784     void forEachSrcIn(const sp<Allocation>& in, const sp<Allocation>& out);
3785     /**
3786      * Sets dst = dst * src.a
3787      * @param[in] in input Allocation
3788      * @param[in] out output Allocation
3789      */
3790     void forEachDstIn(const sp<Allocation>& in, const sp<Allocation>& out);
3791     /**
3792      * Sets dst = src * (1.0 - dst.a)
3793      * @param[in] in input Allocation
3794      * @param[in] out output Allocation
3795      */
3796     void forEachSrcOut(const sp<Allocation>& in, const sp<Allocation>& out);
3797     /**
3798      * Sets dst = dst * (1.0 - src.a)
3799      * @param[in] in input Allocation
3800      * @param[in] out output Allocation
3801      */
3802     void forEachDstOut(const sp<Allocation>& in, const sp<Allocation>& out);
3803     /**
3804      * Sets dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb
3805      * @param[in] in input Allocation
3806      * @param[in] out output Allocation
3807      */
3808     void forEachSrcAtop(const sp<Allocation>& in, const sp<Allocation>& out);
3809     /**
3810      * Sets dst.rgb = dst.rgb * src.a + (1.0 - dst.a) * src.rgb
3811      * @param[in] in input Allocation
3812      * @param[in] out output Allocation
3813      */
3814     void forEachDstAtop(const sp<Allocation>& in, const sp<Allocation>& out);
3815     /**
3816      * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a}
3817      * @param[in] in input Allocation
3818      * @param[in] out output Allocation
3819      */
3820     void forEachXor(const sp<Allocation>& in, const sp<Allocation>& out);
3821     /**
3822      * Sets dst = src * dst
3823      * @param[in] in input Allocation
3824      * @param[in] out output Allocation
3825      */
3826     void forEachMultiply(const sp<Allocation>& in, const sp<Allocation>& out);
3827     /**
3828      * Sets dst = min(src + dst, 1.0)
3829      * @param[in] in input Allocation
3830      * @param[in] out output Allocation
3831      */
3832     void forEachAdd(const sp<Allocation>& in, const sp<Allocation>& out);
3833     /**
3834      * Sets dst = max(dst - src, 0.0)
3835      * @param[in] in input Allocation
3836      * @param[in] out output Allocation
3837      */
3838     void forEachSubtract(const sp<Allocation>& in, const sp<Allocation>& out);
3839 };
3840 
3841 /**
3842  * Intrinsic Gausian blur filter. Applies a Gaussian blur of the specified
3843  * radius to all elements of an Allocation.
3844  */
3845 class ScriptIntrinsicBlur : public ScriptIntrinsic {
3846  private:
3847     ScriptIntrinsicBlur(sp<RS> rs, sp<const Element> e);
3848  public:
3849     /**
3850      * Supported Element types are U8 and U8_4.
3851      * @param[in] rs RenderScript context
3852      * @param[in] e Element
3853      * @return new ScriptIntrinsicBlur
3854      */
3855     static sp<ScriptIntrinsicBlur> create(const sp<RS>& rs, const sp<const Element>& e);
3856     /**
3857      * Sets the input of the blur.
3858      * @param[in] in input Allocation
3859      */
3860     void setInput(const sp<Allocation>& in);
3861     /**
3862      * Runs the intrinsic.
3863      * @param[in] output Allocation
3864      */
3865     void forEach(const sp<Allocation>& out);
3866     /**
3867      * Sets the radius of the blur. The supported range is 0 < radius <= 25.
3868      * @param[in] radius radius of the blur
3869      */
3870     void setRadius(float radius);
3871 };
3872 
3873 /**
3874  * Intrinsic for applying a color matrix to allocations. This has the
3875  * same effect as loading each element and converting it to a
3876  * F32_N, multiplying the result by the 4x4 color matrix
3877  * as performed by rsMatrixMultiply() and writing it to the output
3878  * after conversion back to U8_N or F32_N.
3879  */
3880 class ScriptIntrinsicColorMatrix : public ScriptIntrinsic {
3881  private:
3882     ScriptIntrinsicColorMatrix(sp<RS> rs, sp<const Element> e);
3883  public:
3884     /**
3885      * Creates a new intrinsic.
3886      * @param[in] rs RenderScript context
3887      * @return new ScriptIntrinsicColorMatrix
3888      */
3889     static sp<ScriptIntrinsicColorMatrix> create(const sp<RS>& rs);
3890     /**
3891      * Applies the color matrix. Supported types are U8 and F32 with
3892      * vector lengths between 1 and 4.
3893      * @param[in] in input Allocation
3894      * @param[out] out output Allocation
3895      */
3896     void forEach(const sp<Allocation>& in, const sp<Allocation>& out);
3897     /**
3898      * Set the value to be added after the color matrix has been
3899      * applied. The default value is {0, 0, 0, 0}.
3900      * @param[in] add float[4] of values
3901      */
3902     void setAdd(float* add);
3903 
3904     /**
3905      * Set the color matrix which will be applied to each cell of the
3906      * image. The alpha channel will be copied.
3907      *
3908      * @param[in] m float[9] of values
3909      */
3910     void setColorMatrix3(float* m);
3911     /**
3912      * Set the color matrix which will be applied to each cell of the
3913      * image.
3914      *
3915      * @param[in] m float[16] of values
3916      */
3917     void setColorMatrix4(float* m);
3918     /**
3919      * Set a color matrix to convert from RGB to luminance. The alpha
3920      * channel will be a copy.
3921      */
3922     void setGreyscale();
3923     /**
3924      * Set the matrix to convert from RGB to YUV with a direct copy of
3925      * the 4th channel.
3926      */
3927     void setRGBtoYUV();
3928     /**
3929      * Set the matrix to convert from YUV to RGB with a direct copy of
3930      * the 4th channel.
3931      */
3932     void setYUVtoRGB();
3933 };
3934 
3935 /**
3936  * Intrinsic for applying a 3x3 convolve to an allocation.
3937  */
3938 class ScriptIntrinsicConvolve3x3 : public ScriptIntrinsic {
3939  private:
3940     ScriptIntrinsicConvolve3x3(sp<RS> rs, sp<const Element> e);
3941  public:
3942     /**
3943      * Supported types U8 and F32 with vector lengths between 1 and
3944      * 4. The default convolution kernel is the identity.
3945      * @param[in] rs RenderScript context
3946      * @param[in] e Element
3947      * @return new ScriptIntrinsicConvolve3x3
3948      */
3949     static sp<ScriptIntrinsicConvolve3x3> create(const sp<RS>& rs, const sp<const Element>& e);
3950     /**
3951      * Sets input for intrinsic.
3952      * @param[in] in input Allocation
3953      */
3954     void setInput(const sp<Allocation>& in);
3955     /**
3956      * Launches the intrinsic.
3957      * @param[in] out output Allocation
3958      */
3959     void forEach(const sp<Allocation>& out);
3960     /**
3961      * Sets convolution kernel.
3962      * @param[in] v float[9] of values
3963      */
3964     void setCoefficients(float* v);
3965 };
3966 
3967 /**
3968  * Intrinsic for applying a 5x5 convolve to an allocation.
3969  */
3970 class ScriptIntrinsicConvolve5x5 : public ScriptIntrinsic {
3971  private:
3972     ScriptIntrinsicConvolve5x5(sp<RS> rs, sp<const Element> e);
3973  public:
3974     /**
3975      * Supported types U8 and F32 with vector lengths between 1 and
3976      * 4. The default convolution kernel is the identity.
3977      * @param[in] rs RenderScript context
3978      * @param[in] e Element
3979      * @return new ScriptIntrinsicConvolve5x5
3980      */
3981     static sp<ScriptIntrinsicConvolve5x5> create(const sp<RS>& rs, const sp<const Element>& e);
3982     /**
3983      * Sets input for intrinsic.
3984      * @param[in] in input Allocation
3985      */
3986     void setInput(const sp<Allocation>& in);
3987     /**
3988      * Launches the intrinsic.
3989      * @param[in] out output Allocation
3990      */
3991     void forEach(const sp<Allocation>& out);
3992     /**
3993      * Sets convolution kernel.
3994      * @param[in] v float[25] of values
3995      */
3996     void setCoefficients(float* v);
3997 };
3998 
3999 /**
4000  * Intrinsic for computing a histogram.
4001  */
4002 class ScriptIntrinsicHistogram : public ScriptIntrinsic {
4003  private:
4004     ScriptIntrinsicHistogram(sp<RS> rs, sp<const Element> e);
4005     sp<Allocation> mOut;
4006  public:
4007     /**
4008      * Create an intrinsic for calculating the histogram of an uchar
4009      * or uchar4 image.
4010      *
4011      * Supported elements types are U8_4, U8_3, U8_2, and U8.
4012      *
4013      * @param[in] rs The RenderScript context
4014      * @param[in] e Element type for inputs
4015      *
4016      * @return ScriptIntrinsicHistogram
4017      */
4018     static sp<ScriptIntrinsicHistogram> create(const sp<RS>& rs, const sp<const Element>& e);
4019     /**
4020      * Set the output of the histogram.  32 bit integer types are
4021      * supported.
4022      *
4023      * @param[in] aout The output allocation
4024      */
4025     void setOutput(const sp<Allocation>& aout);
4026     /**
4027      * Set the coefficients used for the dot product calculation. The
4028      * default is {0.299f, 0.587f, 0.114f, 0.f}.
4029      *
4030      * Coefficients must be >= 0 and sum to 1.0 or less.
4031      *
4032      * @param[in] r Red coefficient
4033      * @param[in] g Green coefficient
4034      * @param[in] b Blue coefficient
4035      * @param[in] a Alpha coefficient
4036      */
4037     void setDotCoefficients(float r, float g, float b, float a);
4038     /**
4039      * Process an input buffer and place the histogram into the output
4040      * allocation. The output allocation may be a narrower vector size
4041      * than the input. In this case the vector size of the output is
4042      * used to determine how many of the input channels are used in
4043      * the computation. This is useful if you have an RGBA input
4044      * buffer but only want the histogram for RGB.
4045      *
4046      * 1D and 2D input allocations are supported.
4047      *
4048      * @param[in] ain The input image
4049      */
4050     void forEach(const sp<Allocation>& ain);
4051     /**
4052      * Process an input buffer and place the histogram into the output
4053      * allocation. The dot product of the input channel and the
4054      * coefficients from 'setDotCoefficients' are used to calculate
4055      * the output values.
4056      *
4057      * 1D and 2D input allocations are supported.
4058      *
4059      * @param ain The input image
4060      */
4061     void forEach_dot(const sp<Allocation>& ain);
4062 };
4063 
4064 /**
4065  * Intrinsic for applying a per-channel lookup table. Each channel of
4066  * the input has an independant lookup table. The tables are 256
4067  * entries in size and can cover the full value range of U8_4.
4068  **/
4069 class ScriptIntrinsicLUT : public ScriptIntrinsic {
4070  private:
4071     sp<Allocation> LUT;
4072     bool mDirty;
4073     unsigned char mCache[1024];
4074     void setTable(unsigned int offset, unsigned char base, unsigned int length, unsigned char* lutValues);
4075     ScriptIntrinsicLUT(sp<RS> rs, sp<const Element> e);
4076 
4077  public:
4078     /**
4079      * Supported elements types are U8_4.
4080      *
4081      * The defaults tables are identity.
4082      *
4083      * @param[in] rs The RenderScript context
4084      * @param[in] e Element type for intputs and outputs
4085      *
4086      * @return ScriptIntrinsicLUT
4087      */
4088     static sp<ScriptIntrinsicLUT> create(const sp<RS>& rs, const sp<const Element>& e);
4089     /**
4090      * Invoke the kernel and apply the lookup to each cell of ain and
4091      * copy to aout.
4092      *
4093      * @param[in] ain Input allocation
4094      * @param[in] aout Output allocation
4095      */
4096     void forEach(const sp<Allocation>& ain, const sp<Allocation>& aout);
4097     /**
4098      * Sets entries in LUT for the red channel.
4099      * @param[in] base base of region to update
4100      * @param[in] length length of region to update
4101      * @param[in] lutValues LUT values to use
4102      */
4103     void setRed(unsigned char base, unsigned int length, unsigned char* lutValues);
4104     /**
4105      * Sets entries in LUT for the green channel.
4106      * @param[in] base base of region to update
4107      * @param[in] length length of region to update
4108      * @param[in] lutValues LUT values to use
4109      */
4110     void setGreen(unsigned char base, unsigned int length, unsigned char* lutValues);
4111     /**
4112      * Sets entries in LUT for the blue channel.
4113      * @param[in] base base of region to update
4114      * @param[in] length length of region to update
4115      * @param[in] lutValues LUT values to use
4116      */
4117     void setBlue(unsigned char base, unsigned int length, unsigned char* lutValues);
4118     /**
4119      * Sets entries in LUT for the alpha channel.
4120      * @param[in] base base of region to update
4121      * @param[in] length length of region to update
4122      * @param[in] lutValues LUT values to use
4123      */
4124     void setAlpha(unsigned char base, unsigned int length, unsigned char* lutValues);
4125     virtual ~ScriptIntrinsicLUT();
4126 };
4127 
4128 /**
4129  * Intrinsic for performing a resize of a 2D allocation.
4130  */
4131 class ScriptIntrinsicResize : public ScriptIntrinsic {
4132  private:
4133     sp<Allocation> mInput;
4134     ScriptIntrinsicResize(sp<RS> rs, sp<const Element> e);
4135  public:
4136     /**
4137      * Supported Element types are U8_4. Default lookup table is identity.
4138      * @param[in] rs RenderScript context
4139      * @param[in] e Element
4140      * @return new ScriptIntrinsic
4141      */
4142     static sp<ScriptIntrinsicResize> create(const sp<RS>& rs);
4143 
4144     /**
4145      * Resize copy the input allocation to the output specified. The
4146      * Allocation is rescaled if necessary using bi-cubic
4147      * interpolation.
4148      * @param[in] ain input Allocation
4149      * @param[in] aout output Allocation
4150      */
4151     void forEach_bicubic(const sp<Allocation>& aout);
4152 
4153     /**
4154      * Set the input of the resize.
4155      * @param[in] lut new lookup table
4156      */
4157     void setInput(const sp<Allocation>& ain);
4158 };
4159 
4160 /**
4161  * Intrinsic for converting an Android YUV buffer to RGB.
4162  *
4163  * The input allocation should be supplied in a supported YUV format
4164  * as a YUV element Allocation. The output is RGBA; the alpha channel
4165  * will be set to 255.
4166  */
4167 class ScriptIntrinsicYuvToRGB : public ScriptIntrinsic {
4168  private:
4169     ScriptIntrinsicYuvToRGB(sp<RS> rs, sp<const Element> e);
4170  public:
4171     /**
4172      * Create an intrinsic for converting YUV to RGB.
4173      *
4174      * Supported elements types are U8_4.
4175      *
4176      * @param[in] rs The RenderScript context
4177      * @param[in] e Element type for output
4178      *
4179      * @return ScriptIntrinsicYuvToRGB
4180      */
4181     static sp<ScriptIntrinsicYuvToRGB> create(const sp<RS>& rs, const sp<const Element>& e);
4182     /**
4183      * Set the input YUV allocation.
4184      *
4185      * @param[in] ain The input allocation.
4186      */
4187     void setInput(const sp<Allocation>& in);
4188 
4189     /**
4190      * Convert the image to RGB.
4191      *
4192      * @param[in] aout Output allocation. Must match creation element
4193      *                 type.
4194      */
4195     void forEach(const sp<Allocation>& out);
4196 
4197 };
4198 
4199 /**
4200  * Sampler object that defines how Allocations can be read as textures
4201  * within a kernel. Samplers are used in conjunction with the rsSample
4202  * runtime function to return values from normalized coordinates.
4203  *
4204  * Any Allocation used with a Sampler must have been created with
4205  * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE; using a Sampler on an
4206  * Allocation that was not created with
4207  * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE is undefined.
4208  **/
4209  class Sampler : public BaseObj {
4210  private:
4211     Sampler(sp<RS> rs, void* id);
4212     Sampler(sp<RS> rs, void* id, RsSamplerValue min, RsSamplerValue mag,
4213             RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
4214     RsSamplerValue mMin;
4215     RsSamplerValue mMag;
4216     RsSamplerValue mWrapS;
4217     RsSamplerValue mWrapT;
4218     float mAniso;
4219 
4220  public:
4221     /**
4222      * Creates a non-standard Sampler.
4223      * @param[in] rs RenderScript context
4224      * @param[in] min minification
4225      * @param[in] mag magnification
4226      * @param[in] wrapS S wrapping mode
4227      * @param[in] wrapT T wrapping mode
4228      * @param[in] anisotropy anisotropy setting
4229      */
4230     static sp<Sampler> create(const sp<RS>& rs, RsSamplerValue min, RsSamplerValue mag, RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
4231 
4232     /**
4233      * @return minification setting for the sampler
4234      */
4235     RsSamplerValue getMinification();
4236     /**
4237      * @return magnification setting for the sampler
4238      */
4239     RsSamplerValue getMagnification();
4240     /**
4241      * @return S wrapping mode for the sampler
4242      */
4243     RsSamplerValue getWrapS();
4244     /**
4245      * @return T wrapping mode for the sampler
4246      */
4247     RsSamplerValue getWrapT();
4248     /**
4249      * @return anisotropy setting for the sampler
4250      */
4251     float getAnisotropy();
4252 
4253     /**
4254      * Retrieve a sampler with min and mag set to nearest and wrap modes set to
4255      * clamp.
4256      *
4257      * @param rs Context to which the sampler will belong.
4258      *
4259      * @return Sampler
4260      */
4261     static sp<const Sampler> CLAMP_NEAREST(const sp<RS> &rs);
4262     /**
4263      * Retrieve a sampler with min and mag set to linear and wrap modes set to
4264      * clamp.
4265      *
4266      * @param rs Context to which the sampler will belong.
4267      *
4268      * @return Sampler
4269      */
4270     static sp<const Sampler> CLAMP_LINEAR(const sp<RS> &rs);
4271     /**
4272      * Retrieve a sampler with mag set to linear, min linear mipmap linear, and
4273      * wrap modes set to clamp.
4274      *
4275      * @param rs Context to which the sampler will belong.
4276      *
4277      * @return Sampler
4278      */
4279     static sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR(const sp<RS> &rs);
4280     /**
4281      * Retrieve a sampler with min and mag set to nearest and wrap modes set to
4282      * wrap.
4283      *
4284      * @param rs Context to which the sampler will belong.
4285      *
4286      * @return Sampler
4287      */
4288     static sp<const Sampler> WRAP_NEAREST(const sp<RS> &rs);
4289     /**
4290      * Retrieve a sampler with min and mag set to linear and wrap modes set to
4291      * wrap.
4292      *
4293      * @param rs Context to which the sampler will belong.
4294      *
4295      * @return Sampler
4296      */
4297     static sp<const Sampler> WRAP_LINEAR(const sp<RS> &rs);
4298     /**
4299      * Retrieve a sampler with mag set to linear, min linear mipmap linear, and
4300      * wrap modes set to wrap.
4301      *
4302      * @param rs Context to which the sampler will belong.
4303      *
4304      * @return Sampler
4305      */
4306     static sp<const Sampler> WRAP_LINEAR_MIP_LINEAR(const sp<RS> &rs);
4307     /**
4308      * Retrieve a sampler with min and mag set to nearest and wrap modes set to
4309      * mirrored repeat.
4310      *
4311      * @param rs Context to which the sampler will belong.
4312      *
4313      * @return Sampler
4314      */
4315     static sp<const Sampler> MIRRORED_REPEAT_NEAREST(const sp<RS> &rs);
4316     /**
4317      * Retrieve a sampler with min and mag set to linear and wrap modes set to
4318      * mirrored repeat.
4319      *
4320      * @param rs Context to which the sampler will belong.
4321      *
4322      * @return Sampler
4323      */
4324     static sp<const Sampler> MIRRORED_REPEAT_LINEAR(const sp<RS> &rs);
4325     /**
4326      * Retrieve a sampler with min and mag set to linear and wrap modes set to
4327      * mirrored repeat.
4328      *
4329      * @param rs Context to which the sampler will belong.
4330      *
4331      * @return Sampler
4332      */
4333     static sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR(const sp<RS> &rs);
4334 
4335 };
4336 
4337 } // namespace RSC
4338 
4339 } // namespace android
4340 
4341 #endif
4342