184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray/*
289daad6bae798779e57f252e9da4fe4e62337124Tim Murray * Copyright (C) 2013 The Android Open Source Project
384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray *
484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * Licensed under the Apache License, Version 2.0 (the "License");
584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * you may not use this file except in compliance with the License.
684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * You may obtain a copy of the License at
784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray *
884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray *      http://www.apache.org/licenses/LICENSE-2.0
984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray *
1084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * Unless required by applicable law or agreed to in writing, software
1184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * distributed under the License is distributed on an "AS IS" BASIS,
1284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * See the License for the specific language governing permissions and
1484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray * limitations under the License.
1584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray */
1684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
1784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray#ifndef ANDROID_RSCPPSTRUCTS_H
1884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray#define ANDROID_RSCPPSTRUCTS_H
1984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
2089daad6bae798779e57f252e9da4fe4e62337124Tim Murray#include "rsDefines.h"
2189daad6bae798779e57f252e9da4fe4e62337124Tim Murray#include "util/RefBase.h"
22a423096c0d49e5cfe13a400b4323a76f89c6885cTim Murray
238c24cd62187fb963cb1b76d2e91ae8c247c7f6fbTim Murray#include <pthread.h>
2489daad6bae798779e57f252e9da4fe4e62337124Tim Murray
2509d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
2675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
2775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * Every row in an RS allocation is guaranteed to be aligned by this amount, and
2875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * every row in a user-backed allocation must be aligned by this amount.
2975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
3096267c2ff0133c20cc5643419a3ed3b1e75fe568Tim Murray#define RS_CPU_ALLOCATION_ALIGNMENT 16
3196267c2ff0133c20cc5643419a3ed3b1e75fe568Tim Murray
3266f0a168c4227d4e302f4ffb21ec7e9d7b9ca828Jason Samsstruct dispatchTable;
3366f0a168c4227d4e302f4ffb21ec7e9d7b9ca828Jason Sams
3484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraynamespace android {
3509d2dd26af70a16de928e7450ef500a61c5b810aMiao Wangclass Surface;
3609d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
379eb7f4b90120ebe4be74343856e86b46495f72dfTim Murraynamespace RSC {
3884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
3966f0a168c4227d4e302f4ffb21ec7e9d7b9ca828Jason Sams
4084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraytypedef void (*ErrorHandlerFunc_t)(uint32_t errorNum, const char *errorText);
4184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraytypedef void (*MessageHandlerFunc_t)(uint32_t msgNum, const void *msgData, size_t msgLen);
4284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
4384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass RS;
4484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass BaseObj;
4584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Element;
4684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Type;
4784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Allocation;
4884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Script;
4984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass ScriptC;
50729b6fe58aff47c4f666b22bbb7a6d6114ddefa9Tim Murrayclass Sampler;
5184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
5275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
5375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * Possible error codes used by RenderScript. Once a status other than RS_SUCCESS
5475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * is returned, the RenderScript context is considered dead and cannot perform any
5575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * additional work.
5675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
5721fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray enum RSError {
5875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_SUCCESS = 0,                 ///< No error
5975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_ERROR_INVALID_PARAMETER = 1, ///< An invalid parameter was passed to a function
6075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_ERROR_RUNTIME_ERROR = 2,     ///< The RenderScript driver returned an error; this is
6175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray                                     ///< often indicative of a kernel that crashed
6275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_ERROR_INVALID_ELEMENT = 3,   ///< An invalid Element was passed to a function
6321fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray     RS_ERROR_MAX = 9999
6421fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray
6521fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray };
6621fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray
6775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray /**
6875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * Flags that can control RenderScript behavior on a per-context level.
6975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  */
7084e3dea053bea25c1cec44ffb298f8b5b9b9141aTim Murray enum RSInitFlags {
7175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_INIT_SYNCHRONOUS = 1, ///< All RenderScript calls will be synchronous. May reduce latency.
7275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     RS_INIT_LOW_LATENCY = 2, ///< Prefer low latency devices over potentially higher throughput devices.
73d5164d537c84867880694327727b5f22b0a3ccbdStephen McGroarty     // Bitflag 4 is reserved for the context flag low power
74d5164d537c84867880694327727b5f22b0a3ccbdStephen McGroarty     RS_INIT_WAIT_FOR_ATTACH = 8,   ///< Kernel execution will hold to give time for a debugger to be attached
7515c1d06c654c246b8e8047f64f781add32483576Stephen McGroarty     RS_INIT_MAX = 16
7684e3dea053bea25c1cec44ffb298f8b5b9b9141aTim Murray };
7784e3dea053bea25c1cec44ffb298f8b5b9b9141aTim Murray
7884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
7949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Byte2 {
8084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray public:
8149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int8_t x, y;
8284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
8349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte2(int8_t initX, int8_t initY)
8449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
8549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte2() : x(0), y(0) {}
8649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
8775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
8849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Byte3 {
8949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
9049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int8_t x, y, z;
9184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
9249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte3(int8_t initX, int8_t initY, int8_t initZ)
9349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
9449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte3() : x(0), y(0), z(0) {}
9549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
9675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
9749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Byte4 {
9849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
9949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int8_t x, y, z, w;
10084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
10149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte4(int8_t initX, int8_t initY, int8_t initZ, int8_t initW)
10249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
10349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Byte4() : x(0), y(0), z(0), w(0) {}
10449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
10584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
10649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UByte2 {
10749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
10849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint8_t x, y;
109baca6c3c3d79a324c7976ba873afdded0b6bcfb5Tim Murray
11049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte2(uint8_t initX, uint8_t initY)
11149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
11249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte2() : x(0), y(0) {}
11349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
11475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
11549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UByte3 {
11649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
11749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint8_t x, y, z;
118a423096c0d49e5cfe13a400b4323a76f89c6885cTim Murray
11949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte3(uint8_t initX, uint8_t initY, uint8_t initZ)
12049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
12149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte3() : x(0), y(0), z(0) {}
12249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
123a423096c0d49e5cfe13a400b4323a76f89c6885cTim Murray
12449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UByte4 {
12549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
12649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint8_t x, y, z, w;
12784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
12849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte4(uint8_t initX, uint8_t initY, uint8_t initZ, uint8_t initW)
12949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
13049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UByte4() : x(0), y(0), z(0), w(0) {}
13149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
13284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
13349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Short2 {
13449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
13549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  short x, y;
13684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
13749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short2(short initX, short initY)
13849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
13949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short2() : x(0), y(0) {}
14049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
14184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
14249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Short3 {
14349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
14449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  short x, y, z;
14584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
14649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short3(short initX, short initY, short initZ)
14749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
14849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short3() : x(0), y(0), z(0) {}
14949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
150caf4126512b2152ea5f6573ce5d9ca29767b9678Tim Murray
15149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Short4 {
15249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
15349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  short x, y, z, w;
15489daad6bae798779e57f252e9da4fe4e62337124Tim Murray
15549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short4(short initX, short initY, short initZ, short initW)
15649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
15749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Short4() : x(0), y(0), z(0), w(0) {}
15849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
15989daad6bae798779e57f252e9da4fe4e62337124Tim Murray
16049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UShort2 {
16149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
16249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint16_t x, y;
16389daad6bae798779e57f252e9da4fe4e62337124Tim Murray
16449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort2(uint16_t initX, uint16_t initY)
16549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
16649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort2() : x(0), y(0) {}
16749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
16889daad6bae798779e57f252e9da4fe4e62337124Tim Murray
16949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UShort3 {
17049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
17149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint16_t x, y, z;
17284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
17349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort3(uint16_t initX, uint16_t initY, uint16_t initZ)
17449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
17549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort3() : x(0), y(0), z(0) {}
17684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
17784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
17849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UShort4 {
17949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
18049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint16_t x, y, z, w;
18184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
18249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort4(uint16_t initX, uint16_t initY, uint16_t initZ, uint16_t initW)
18349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
18449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UShort4() : x(0), y(0), z(0), w(0) {}
18549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
18684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
18749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Int2 {
18849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
18949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int x, y;
19084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
19149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int2(int initX, int initY)
19249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
19349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int2() : x(0), y(0) {}
19484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
19584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
19649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Int3 {
19749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
19849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int x, y, z;
19984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
20049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int3(int initX, int initY, int initZ)
20149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
20249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int3() : x(0), y(0), z(0) {}
20349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
20484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
20549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Int4 {
20649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
20749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int x, y, z, w;
20884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
20949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int4(int initX, int initY, int initZ, int initW)
21049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
21149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Int4() : x(0), y(0), z(0), w(0) {}
21249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
21384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
21449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UInt2 {
21549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
21649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint32_t x, y;
21784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
21849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt2(uint32_t initX, uint32_t initY)
21949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
22049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt2() : x(0), y(0) {}
22149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
22284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
22349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UInt3 {
22449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
22549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint32_t x, y, z;
22684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
22749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt3(uint32_t initX, uint32_t initY, uint32_t initZ)
22849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
22949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt3() : x(0), y(0), z(0) {}
23049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
23184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
23249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass UInt4 {
23349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
23449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint32_t x, y, z, w;
23549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
23649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt4(uint32_t initX, uint32_t initY, uint32_t initZ, uint32_t initW)
23749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
23849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  UInt4() : x(0), y(0), z(0), w(0) {}
23949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
24049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
24149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Long2 {
24249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
24349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int64_t x, y;
24449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
24549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long2(int64_t initX, int64_t initY)
24649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
24749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long2() : x(0), y(0) {}
24849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
24949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
25049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Long3 {
25149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
25249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int64_t x, y, z;
25349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
25449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long3(int64_t initX, int64_t initY, int64_t initZ)
25549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
25649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long3() : x(0), y(0), z(0) {}
25749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
25849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
25949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Long4 {
26049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
26149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  int64_t x, y, z, w;
26249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
26349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long4(int64_t initX, int64_t initY, int64_t initZ, int64_t initW)
26449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
26549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Long4() : x(0), y(0), z(0), w(0) {}
26649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
26749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
26849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ULong2 {
26949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
27049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint64_t x, y;
27149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
27249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong2(uint64_t initX, uint64_t initY)
27349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
27449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong2() : x(0), y(0) {}
27549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
27649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
27749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ULong3 {
27849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
27949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint64_t x, y, z;
28049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
28149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong3(uint64_t initX, uint64_t initY, uint64_t initZ)
28249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
28349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong3() : x(0), y(0), z(0) {}
28449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
28549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
28649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ULong4 {
28749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
28849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  uint64_t x, y, z, w;
28949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
29049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong4(uint64_t initX, uint64_t initY, uint64_t initZ, uint64_t initW)
29149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
29249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  ULong4() : x(0), y(0), z(0), w(0) {}
29349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
29449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
29549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Float2 {
29649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
29749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  float x, y;
29849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
29949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float2(float initX, float initY)
30049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
30149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float2() : x(0), y(0) {}
30249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
30349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
30449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Float3 {
30549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
30649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  float x, y, z;
30749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
30849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float3(float initX, float initY, float initZ)
30949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
31049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float3() : x(0.f), y(0.f), z(0.f) {}
31149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
31249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
31349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Float4 {
31449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
31549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  float x, y, z, w;
31649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
31749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float4(float initX, float initY, float initZ, float initW)
31849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
31949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Float4() : x(0.f), y(0.f), z(0.f), w(0.f) {}
32049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
32149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
32249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Double2 {
32349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
32449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  double x, y;
32549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
32649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double2(double initX, double initY)
32749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY) {}
32849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double2() : x(0), y(0) {}
32949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
33049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
33149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Double3 {
33249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
33349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  double x, y, z;
33449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
33549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double3(double initX, double initY, double initZ)
33649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ) {}
33749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double3() : x(0), y(0), z(0) {}
33849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
33949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
34049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Double4 {
34149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
34249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  double x, y, z, w;
34349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
34449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double4(double initX, double initY, double initZ, double initW)
34549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    : x(initX), y(initY), z(initZ), w(initW) {}
34649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  Double4() : x(0), y(0), z(0), w(0) {}
34749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
34849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
34949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang /**
35049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * The RenderScript context. This class controls initialization, resource management, and teardown.
35149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  */
35249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang class RS : public android::RSC::LightRefBase<RS> {
35349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
35449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang public:
35549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RS();
35649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual ~RS();
35775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
35875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
35949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Initializes a RenderScript context. A context must be initialized before it can be used.
36049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] name Directory name to be used by this context. This should be equivalent to
36149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Context.getCacheDir().
36249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] flags Optional flags for this context.
36349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return true on success
36475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
365fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang    bool init(const char * name, uint32_t flags = 0);
366fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang
367fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang    /**
368fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * Initializes a RenderScript context. A context must be initialized before it can be used.
369fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * @param[in] name Directory name to be used by this context. This should be equivalent to
370fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * Context.getCacheDir().
371fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * @param[in] flags Flags for this context.
372fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * @param[in] targetApi Target RS API level.
373fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     * @return true on success
374fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang     */
375fda559674cb1bd16b885f97951bda775cdc3af5cMiao Wang    bool init(const char * name, uint32_t flags, int targetApi);
37684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
37775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
37849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets the error handler function for this context. This error handler is
37949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * called whenever an error is set.
380e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     *
38149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] func Error handler function
382e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     */
38349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setErrorHandler(ErrorHandlerFunc_t func);
384e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang
385e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    /**
38649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Returns the current error handler function for this context.
38749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
38849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return pointer to current error handler function or NULL if not set
38975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
39049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ErrorHandlerFunc_t getErrorHandler() { return mErrorFunc; }
39109d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
39209d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang    /**
39349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets the message handler function for this context. This message handler
39449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * is called whenever a message is sent from a RenderScript kernel.
39549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
39649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *  @param[in] func Message handler function
39709d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     */
39849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setMessageHandler(MessageHandlerFunc_t func);
39909d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
40009d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang    /**
40149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Returns the current message handler function for this context.
40249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
40349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return pointer to current message handler function or NULL if not set
40409d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     */
40549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    MessageHandlerFunc_t getMessageHandler() { return mMessageFunc; }
40684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
40709d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang    /**
40849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Returns current status for the context.
40949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
41049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return current error
41109d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     */
41249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RSError getError();
41309d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
41409d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang    /**
41549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Waits for any currently running asynchronous operations to finish. This
41649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * should only be used for performance testing and timing.
41749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
41849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void finish();
41949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
42049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsContext getContext() { return mContext; }
42149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void throwError(RSError error, const char *errMsg);
42249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
42349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static dispatchTable* dispatch;
42449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
42549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
42649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static bool usingNative;
42749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static bool initDispatch(int targetApi);
42849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
42949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static void * threadProc(void *);
43049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
43149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static bool gInitialized;
43249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static pthread_mutex_t gInitMutex;
43349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
43449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    pthread_t mMessageThreadId;
43549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    pid_t mNativeMessageThreadId;
43649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mMessageRun;
43749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
43849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsContext mContext;
43949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RSError mCurrentError;
44049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
44149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ErrorHandlerFunc_t mErrorFunc;
44249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    MessageHandlerFunc_t mMessageFunc;
44349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mInit;
44449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
44549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    char mCacheDir[PATH_MAX+1];
44649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mCacheDirLen;
44749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
44849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    struct {
44949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U8;
45049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U8_2;
45149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U8_3;
45249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U8_4;
45349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I8;
45449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I8_2;
45549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I8_3;
45649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I8_4;
45749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U16;
45849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U16_2;
45949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U16_3;
46049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U16_4;
46149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I16;
46249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I16_2;
46349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I16_3;
46449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I16_4;
46549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U32;
46649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U32_2;
46749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U32_3;
46849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U32_4;
46949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I32;
47049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I32_2;
47149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I32_3;
47249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I32_4;
47349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U64;
47449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U64_2;
47549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U64_3;
47649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> U64_4;
47749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I64;
47849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I64_2;
47949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I64_3;
48049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> I64_4;
4811f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar        sp<const Element> F16;
4821f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar        sp<const Element> F16_2;
4831f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar        sp<const Element> F16_3;
4841f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar        sp<const Element> F16_4;
48549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F32;
48649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F32_2;
48749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F32_3;
48849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F32_4;
48949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F64;
49049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F64_2;
49149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F64_3;
49249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> F64_4;
49349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> BOOLEAN;
49449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
49549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> ELEMENT;
49649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> TYPE;
49749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> ALLOCATION;
49849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> SAMPLER;
49949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> SCRIPT;
50049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> MESH;
50149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> PROGRAM_FRAGMENT;
50249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> PROGRAM_VERTEX;
50349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> PROGRAM_RASTER;
50449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> PROGRAM_STORE;
50549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
50649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> A_8;
50749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> RGB_565;
50849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> RGB_888;
50949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> RGBA_5551;
51049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> RGBA_4444;
51149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> RGBA_8888;
51249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
51349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> YUV;
51449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
51549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> MATRIX_4X4;
51649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> MATRIX_3X3;
51749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Element> MATRIX_2X2;
51849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    } mElements;
51949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
52049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    struct {
52149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> CLAMP_NEAREST;
52249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> CLAMP_LINEAR;
52349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR;
52449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> WRAP_NEAREST;
52549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> WRAP_LINEAR;
52649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> WRAP_LINEAR_MIP_LINEAR;
52749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> MIRRORED_REPEAT_NEAREST;
52849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> MIRRORED_REPEAT_LINEAR;
52949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR;
53049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    } mSamplers;
53149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    friend class Sampler;
53249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    friend class Element;
53349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    friend class ScriptC;
53449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
53549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
53649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang /**
53749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * Base class for all RenderScript objects. Not for direct use by developers.
53849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  */
53949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass BaseObj : public android::RSC::LightRefBase<BaseObj> {
54049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangpublic:
54149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void * getID() const;
54249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual ~BaseObj();
54349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual void updateFromNative();
54449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual bool equals(sp<const BaseObj> obj);
54549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
54649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangprotected:
54749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void *mID;
54849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RS* mRS;
54949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    const char * mName;
55049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
55149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    BaseObj(void *id, sp<RS> rs);
55249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void checkValid();
55349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
55449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static void * getObjID(sp<const BaseObj> o);
55549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
55649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang};
55749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
55849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang /**
55949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * This class provides the primary method through which data is passed to and
56049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * from RenderScript kernels. An Allocation provides the backing store for a
56149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * given Type.
56249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  *
56349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * An Allocation also contains a set of usage flags that denote how the
56449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * Allocation could be used. For example, an Allocation may have usage flags
56549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * specifying that it can be used from a script as well as input to a
56649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * Sampler. A developer must synchronize across these different usages using
56749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * syncAll(int) in order to ensure that different users of the Allocation have
56849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * a consistent view of memory. For example, in the case where an Allocation is
56949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * used as the output of one kernel and as Sampler input in a later kernel, a
57049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * developer must call syncAll(RS_ALLOCATION_USAGE_SCRIPT) prior to launching the
57149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  * second kernel to ensure correctness.
57249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang  */
57349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass Allocation : public BaseObj {
57449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangprotected:
57549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<const Type> mType;
57649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mUsage;
57749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<Allocation> mAdaptedAllocation;
57849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
57949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mConstrainedLOD;
58049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mConstrainedFace;
58149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mConstrainedY;
58249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mConstrainedZ;
58349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mReadAllowed;
58449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mWriteAllowed;
58549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mAutoPadding;
58649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mSelectedY;
58749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mSelectedZ;
58849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mSelectedLOD;
58949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsAllocationCubemapFace mSelectedFace;
59049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
59149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mCurrentDimX;
59249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mCurrentDimY;
59349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mCurrentDimZ;
59449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    uint32_t mCurrentCount;
59549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
59649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void * getIDSafe() const;
59749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void updateCacheInfo(sp<const Type> t);
59849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
59949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    Allocation(void *id, sp<RS> rs, sp<const Type> t, uint32_t usage);
60049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
60149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsInt64();
60249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsInt32();
60349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsInt16();
60449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsInt8();
60549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsFloat32();
60649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsFloat64();
60749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validateIsObject();
60849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
60949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual void updateFromNative();
61049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
61149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validate2DRange(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h);
61249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void validate3DRange(uint32_t xoff, uint32_t yoff, uint32_t zoff,
61349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                         uint32_t w, uint32_t h, uint32_t d);
61449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
61549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangpublic:
61649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
61749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
61849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Return Type for the allocation.
61949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return pointer to underlying Type
62049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
62149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<const Type> getType() const {
62249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        return mType;
62349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    }
62449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
62549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
62649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Enable/Disable AutoPadding for Vec3 elements.
62749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
62849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param useAutoPadding True: enable AutoPadding; flase: disable AutoPadding
62949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
63049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
63149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setAutoPadding(bool useAutoPadding) {
63249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang        mAutoPadding = useAutoPadding;
63349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    }
63449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
63549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
63649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Propagate changes from one usage of the Allocation to other usages of the Allocation.
63749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] srcLocation source location with changes to propagate elsewhere
63849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
63949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void syncAll(RsAllocationUsageType srcLocation);
64049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
64149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
64249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Send a buffer to the output stream.  The contents of the Allocation will
64349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * be undefined after this operation. This operation is only valid if
64449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * USAGE_IO_OUTPUT is set on the Allocation.
64549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
64649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ioSendOutput();
64749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
64849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
64949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Receive the latest input into the Allocation. This operation
65049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * is only valid if USAGE_IO_INPUT is set on the Allocation.
65149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
65249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ioGetInput();
65349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
65449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB)
65549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
65649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Returns the handle to a raw buffer that is being managed by the screen
65749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * compositor. This operation is only valid for Allocations with USAGE_IO_INPUT.
65849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Surface associated with allocation
65949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
66049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<Surface> getSurface();
66149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
66249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
66349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Associate a Surface with this Allocation. This
66409d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     * operation is only valid for Allocations with USAGE_IO_OUTPUT.
66509d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     * @param[in] s Surface to associate with allocation
66609d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang     */
66709d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang    void setSurface(sp<Surface> s);
66809d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang#endif
66909d2dd26af70a16de928e7450ef500a61c5b810aMiao Wang
67075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
67175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Generate a mipmap chain. This is only valid if the Type of the Allocation
67275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * includes mipmaps. This function will generate a complete set of mipmaps
67375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * from the top level LOD and place them into the script memory space. If
67475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * the Allocation is also using other memory spaces, a call to
67575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * syncAll(Allocation.USAGE_SCRIPT) is required.
67675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
67784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void generateMipmaps();
678509ea5c832a865bc9083d53f1f058377a689bab3Tim Murray
67975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
68075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy an array into part of this Allocation.
68175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] off offset of first Element to be overwritten
68275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] count number of Elements to copy
68375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data array from which to copy
68475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
6850b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray    void copy1DRangeFrom(uint32_t off, size_t count, const void *data);
68675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
68775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
68875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy part of an Allocation into part of this Allocation.
68975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] off offset of first Element to be overwritten
69075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] count number of Elements to copy
69175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data Allocation from which to copy
69275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataOff offset of first Element in data to copy
69375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
694a4cbc2b0cf0f6fbdb21e84a3e17585eda1885e3eTim Murray    void copy1DRangeFrom(uint32_t off, size_t count, sp<const Allocation> data, uint32_t dataOff);
69584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
69675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
69775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy an array into part of this Allocation.
69875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] off offset of first Element to be overwritten
69975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] count number of Elements to copy
70075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data array from which to copy
70175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
7020b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray    void copy1DRangeTo(uint32_t off, size_t count, void *data);
703a4cbc2b0cf0f6fbdb21e84a3e17585eda1885e3eTim Murray
70475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
70575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy entire array to an Allocation.
70675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data array from which to copy
70775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
7080b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray    void copy1DFrom(const void* data);
70975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
71075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
71175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy entire Allocation to an array.
71275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data destination array
71375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
7140b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray    void copy1DTo(void* data);
7150b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray
71675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
71775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from an array into a rectangular region in this Allocation. The
71875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * array is assumed to be tightly packed.
71975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
72075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
72175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
72275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
72375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data Array from which to copy
72475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
7250b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray    void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
7260b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray                         const void *data);
7277b3e3093f745134345dadf89498ad16e1f9c0e71Tim Murray
72875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
72975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from this Allocation into a rectangular region in an array. The
73075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * array is assumed to be tightly packed.
73175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to copy from this Allocation
73275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to copy from this Allocation
73375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
73475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
73575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data destination array
73675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
7377b3e3093f745134345dadf89498ad16e1f9c0e71Tim Murray    void copy2DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
7387b3e3093f745134345dadf89498ad16e1f9c0e71Tim Murray                       void *data);
7397b3e3093f745134345dadf89498ad16e1f9c0e71Tim Murray
74075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
74175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from an Allocation into a rectangular region in this Allocation.
74275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
74375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
74475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
74575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
74675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data Allocation from which to copy
74775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataXoff X offset of region to copy from in data
74875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataYoff Y offset of region to copy from in data
74975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
75084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void copy2DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
7510b93e30c8c64fb2f985218adfaceff777f62a42fTim Murray                         sp<const Allocation> data, uint32_t dataXoff, uint32_t dataYoff);
75284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
75375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
75475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from a strided array into a rectangular region in this Allocation.
75575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
75675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
75775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
75875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
75975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data array from which to copy
76075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] stride stride of data in bytes
76175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
762358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray    void copy2DStridedFrom(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
763358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray                           const void *data, size_t stride);
76475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
76575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
76675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from a strided array into this Allocation.
76775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data array from which to copy
76875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] stride stride of data in bytes
76975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
770358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray    void copy2DStridedFrom(const void *data, size_t stride);
771358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray
77275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
77375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from a rectangular region in this Allocation into a strided array.
77475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
77575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
77675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
77775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
77875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data destination array
77975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] stride stride of data in bytes
78075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
781358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray    void copy2DStridedTo(uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
782358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray                         void *data, size_t stride);
78375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
78475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
78575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy this Allocation into a strided array.
78675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data destination array
78775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] stride stride of data in bytes
78875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
789358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray    void copy2DStridedTo(void *data, size_t stride);
790358747a3118301c5faeee73c98dd5f839bbfb54aTim Murray
79175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
79275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
79375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from an array into a 3D region in this Allocation. The
79475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * array is assumed to be tightly packed.
79575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
79675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
79775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] zoff Z offset of region to update in this Allocation
79875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
79975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
80075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] d Depth of region to update
80175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data Array from which to copy
80275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
8039d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray    void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
8049d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray                         uint32_t h, uint32_t d, const void* data);
8059d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray
80675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
80775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Copy from an Allocation into a 3D region in this Allocation.
80875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] xoff X offset of region to update in this Allocation
80975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] yoff Y offset of region to update in this Allocation
81075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] zoff Z offset of region to update in this Allocation
81175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] w Width of region to update
81275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] h Height of region to update
81375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] d Depth of region to update
81475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] data Allocation from which to copy
81575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataXoff X offset of region in data to copy from
81675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataYoff Y offset of region in data to copy from
81775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dataZoff Z offset of region in data to copy from
81875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
8199d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray    void copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff,
8209d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray                         uint32_t w, uint32_t h, uint32_t d,
8219d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray                         sp<const Allocation> data,
8229d24ae621bdfdaf09406b099a2ae055e33d1089aTim Murray                         uint32_t dataXoff, uint32_t dataYoff, uint32_t dataZoff);
82384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
82475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
825e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * Copy a 3D region in this Allocation into an array. The
826e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * array is assumed to be tightly packed.
827e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] xoff X offset of region to update in this Allocation
828e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] yoff Y offset of region to update in this Allocation
829e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] zoff Z offset of region to update in this Allocation
830e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] w Width of region to update
831e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] h Height of region to update
832e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] d Depth of region to update
833e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     * @param[in] data Array from which to copy
834e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     */
835e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    void copy3DRangeTo(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
836e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang                         uint32_t h, uint32_t d, void* data);
837e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang
838e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    /**
83975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates an Allocation for use by scripts with a given Type.
84075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs Context to which the Allocation will belong
84175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] type Type of the Allocation
8428f615d682f9e7e2cd4de2e4478e0e76fc359922cStephen Hines     * @param[in] mipmaps desired mipmap behavior for the Allocation
84375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] usage usage for the Allocation
84475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Allocation
84575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
84684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
8478f615d682f9e7e2cd4de2e4478e0e76fc359922cStephen Hines                                   RsAllocationMipmapControl mipmaps, uint32_t usage);
84875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
84975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
85075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates an Allocation for use by scripts with a given Type and a backing pointer. For use
85175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * with RS_ALLOCATION_USAGE_SHARED.
85275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs Context to which the Allocation will belong
85375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] type Type of the Allocation
8548f615d682f9e7e2cd4de2e4478e0e76fc359922cStephen Hines     * @param[in] mipmaps desired mipmap behavior for the Allocation
85575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] usage usage for the Allocation
85675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] pointer existing backing store to use for this Allocation if possible
85775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Allocation
85875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
85984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
8608f615d682f9e7e2cd4de2e4478e0e76fc359922cStephen Hines                                   RsAllocationMipmapControl mipmaps, uint32_t usage, void * pointer);
86184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
86275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
86375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates an Allocation for use by scripts with a given Type with no mipmaps.
86475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs Context to which the Allocation will belong
86575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] type Type of the Allocation
86675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] usage usage for the Allocation
86775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Allocation
86875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
86984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<Allocation> createTyped(sp<RS> rs, sp<const Type> type,
87084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray                                   uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
87175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
87275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates an Allocation with a specified number of given elements.
87375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs Context to which the Allocation will belong
87475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] e Element used in the Allocation
87575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] count Number of elements of the Allocation
87675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] usage usage for the Allocation
87775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Allocation
87875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
87984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<Allocation> createSized(sp<RS> rs, sp<const Element> e, size_t count,
88084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray                                   uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
88175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
88275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
88375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates a 2D Allocation with a specified number of given elements.
88475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs Context to which the Allocation will belong
88575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] e Element used in the Allocation
88675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] x Width in Elements of the Allocation
88775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] y Height of the Allocation
88875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] usage usage for the Allocation
88975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Allocation
89075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
891684726cbbd177ee4ee9000e9422058547acd237fTim Murray    static sp<Allocation> createSized2D(sp<RS> rs, sp<const Element> e,
892684726cbbd177ee4ee9000e9422058547acd237fTim Murray                                        size_t x, size_t y,
893684726cbbd177ee4ee9000e9422058547acd237fTim Murray                                        uint32_t usage = RS_ALLOCATION_USAGE_SCRIPT);
894684726cbbd177ee4ee9000e9422058547acd237fTim Murray
89584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
896b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams    /**
897b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams     * Get the backing pointer for a USAGE_SHARED allocation.
898b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams     * @param[in] stride optional parameter. when non-NULL, will contain
899b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams     *   stride in bytes of a 2D Allocation
900b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams     * @return pointer to data
901b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams     */
902b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4Jason Sams    void * getPointer(size_t *stride = NULL);
90384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
90484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
90575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray /**
90675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * An Element represents one item within an Allocation. An Element is roughly
90775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * equivalent to a C type in a RenderScript kernel. Elements may be basic
90875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * or complex. Some basic elements are:
90975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
91075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * - A single float value (equivalent to a float in a kernel)
91175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * - A four-element float vector (equivalent to a float4 in a kernel)
91275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * - An unsigned 32-bit integer (equivalent to an unsigned int in a kernel)
91375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * - A single signed 8-bit integer (equivalent to a char in a kernel)
91475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
91575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * Basic Elements are comprised of a Element.DataType and a
91675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * Element.DataKind. The DataType encodes C type information of an Element,
91775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * while the DataKind encodes how that Element should be interpreted by a
91875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * Sampler. Note that Allocation objects with DataKind USER cannot be used as
91975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * input for a Sampler. In general, Allocation objects that are intended for
92075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * use with a Sampler should use bitmap-derived Elements such as
92175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray  * Element::RGBA_8888.
92275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
92375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
92475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
92584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Element : public BaseObj {
92684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraypublic:
92784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool isComplex();
92875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
92975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
93075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Elements could be simple, such as an int or a float, or a structure with
93175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * multiple sub-elements, such as a collection of floats, float2,
93275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * float4. This function returns zero for simple elements or the number of
93375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * sub-elements otherwise.
93475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return number of sub-elements
93575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
93684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t getSubElementCount() {
937bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        return mVisibleElementMapSize;
93884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
93984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
94075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
94175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * For complex Elements, this returns the sub-element at a given index.
94275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] index index of sub-element
94375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return sub-element
94475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
94584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    sp<const Element> getSubElement(uint32_t index);
94675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
94775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
94875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * For complex Elements, this returns the name of the sub-element at a given
94975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * index.
95075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] index index of sub-element
95175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return name of sub-element
95275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
95384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    const char * getSubElementName(uint32_t index);
95475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
95575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
95675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * For complex Elements, this returns the size of the sub-element at a given
95775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * index.
95875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] index index of sub-element
95975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return size of sub-element
96075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
96184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t getSubElementArraySize(uint32_t index);
96275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
96375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
96475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the location of a sub-element within a complex Element.
96575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] index index of sub-element
96675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return offset in bytes
96775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
96884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t getSubElementOffsetBytes(uint32_t index);
96975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
97075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
97175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the data type used for the Element.
97275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return data type
97375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
97484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    RsDataType getDataType() const {
97584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mType;
97684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
97784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
97875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
97975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the data kind used for the Element.
98075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return data kind
98175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
98284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    RsDataKind getDataKind() const {
98384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mKind;
98484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
98584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
98675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
98775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the size in bytes of the Element.
98875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return size in bytes
98975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
99084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t getSizeBytes() const {
99184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mSizeBytes;
99284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
99384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
99475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
99575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the number of vector components for this Element.
99675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return number of vector components
99775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
99810913a5c37ba119bef335320d3e8be25212c05adTim Murray    uint32_t getVectorSize() const {
99910913a5c37ba119bef335320d3e8be25212c05adTim Murray        return mVectorSize;
100010913a5c37ba119bef335320d3e8be25212c05adTim Murray    }
100110913a5c37ba119bef335320d3e8be25212c05adTim Murray
100275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
100375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single bool.
100475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
100575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
100675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
100784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> BOOLEAN(sp<RS> rs);
100875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
100975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single unsigned char.
101075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
101175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
101275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
101384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U8(sp<RS> rs);
101475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
101575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single signed char.
101675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
101775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
101875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
101984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I8(sp<RS> rs);
102075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
102175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single unsigned short.
102275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
102375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
102475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
102584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U16(sp<RS> rs);
102675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
102775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single signed short.
102875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
102975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
103075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
103184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I16(sp<RS> rs);
103275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
103375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single unsigned int.
103475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
103575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
103675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
103784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U32(sp<RS> rs);
103875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
103975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single signed int.
104075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
104175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
104275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
104384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I32(sp<RS> rs);
104475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
104575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single unsigned long long.
104675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
104775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
104875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
104984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U64(sp<RS> rs);
105075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
105175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single signed long long.
105275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
105375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
105475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
105584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I64(sp<RS> rs);
105675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
10571f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * Utility function for returning an Element containing a single half.
10581f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @param[in] rs RenderScript context
10591f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @return Element
10601f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     */
10611f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    static sp<const Element> F16(sp<RS> rs);
10621f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    /**
106375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single float.
106475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
106575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
106675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
106784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F32(sp<RS> rs);
106875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
106975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single double.
107075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
107175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
107275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
107384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F64(sp<RS> rs);
107475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
107575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single Element.
107675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
107775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
107875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
107984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> ELEMENT(sp<RS> rs);
108075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
108175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single Type.
108275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
108375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
108475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
108584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> TYPE(sp<RS> rs);
108675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
108775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single Allocation.
108875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
108975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
109075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
109184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> ALLOCATION(sp<RS> rs);
109275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
109375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single Sampler.
109475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
109575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
109675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
109784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> SAMPLER(sp<RS> rs);
109875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
109975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a single Script.
110075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
110175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
110275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
110384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> SCRIPT(sp<RS> rs);
110475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
110575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an ALPHA_8 pixel.
110675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
110775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
110875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
110984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> A_8(sp<RS> rs);
111075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
111175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an RGB_565 pixel.
111275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
111375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
111475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
111584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> RGB_565(sp<RS> rs);
111675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
111775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an RGB_888 pixel.
111875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
111975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
112075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
112184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> RGB_888(sp<RS> rs);
112275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
112375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an RGBA_5551 pixel.
112475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
112575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
112675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
112784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> RGBA_5551(sp<RS> rs);
112875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
112975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an RGBA_4444 pixel.
113075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
113175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
113275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
113384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> RGBA_4444(sp<RS> rs);
113475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
113575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an RGBA_8888 pixel.
113675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
113775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
113875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
113984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> RGBA_8888(sp<RS> rs);
114084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
114175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
11421f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * Utility function for returning an Element containing a half2.
11431f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @param[in] rs RenderScript context
11441f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @return Element
11451f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     */
11461f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    static sp<const Element> F16_2(sp<RS> rs);
11471f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    /**
11481f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * Utility function for returning an Element containing a half3.
11491f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @param[in] rs RenderScript context
11501f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @return Element
11511f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     */
11521f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    static sp<const Element> F16_3(sp<RS> rs);
11531f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    /**
11541f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * Utility function for returning an Element containing a half4.
11551f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @param[in] rs RenderScript context
11561f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     * @return Element
11571f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar     */
11581f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    static sp<const Element> F16_4(sp<RS> rs);
11591f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar
11601f6041ddc7658e252797626faae38db759413edcPirama Arumuga Nainar    /**
116175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a float2.
116275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
116375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
116475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
116584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F32_2(sp<RS> rs);
116675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
116775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a float3.
116875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
116975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
117075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
117184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F32_3(sp<RS> rs);
117275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
117375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a float4.
117475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
117575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
117675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
117784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F32_4(sp<RS> rs);
117875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
117975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a double2.
118075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
118175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
118275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
118384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F64_2(sp<RS> rs);
118475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
118575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a double3.
118675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
118775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
118875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
118984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F64_3(sp<RS> rs);
119075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
119175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a double4.
119275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
119375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
119475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
119584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> F64_4(sp<RS> rs);
119675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
119775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uchar2.
119875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
119975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
120075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
120184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U8_2(sp<RS> rs);
120275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
120375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uchar3.
120475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
120575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
120675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
120784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U8_3(sp<RS> rs);
120875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
120975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uchar4.
121075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
121175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
121275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
121384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U8_4(sp<RS> rs);
121475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
121575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a char2.
121675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
121775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
121875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
121984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I8_2(sp<RS> rs);
122075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
122175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a char3.
122275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
122375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
122475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
122584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I8_3(sp<RS> rs);
122675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
122775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a char4.
122875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
122975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
123075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
123184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I8_4(sp<RS> rs);
123275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
123375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ushort2.
123475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
123575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
123675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
123784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U16_2(sp<RS> rs);
123875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
123975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ushort3.
124075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
124175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
124275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
124384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U16_3(sp<RS> rs);
124475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
124575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ushort4.
124675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
124775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
124875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
124984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U16_4(sp<RS> rs);
125075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
125175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a short2.
125275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
125375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
125475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
125584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I16_2(sp<RS> rs);
125675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
125775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a short3.
125875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
125975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
126075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
126184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I16_3(sp<RS> rs);
126275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
126375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a short4.
126475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
126575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
126675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
126784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I16_4(sp<RS> rs);
126875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
126975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uint2.
127075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
127175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
127275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
127384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U32_2(sp<RS> rs);
127475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
127575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uint3.
127675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
127775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
127875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
127984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U32_3(sp<RS> rs);
128075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
128175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a uint4.
128275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
128375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
128475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
128584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U32_4(sp<RS> rs);
128675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
128775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an int2.
128875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
128975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
129075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
129184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I32_2(sp<RS> rs);
129275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
129375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an int3.
129475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
129575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
129675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
129784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I32_3(sp<RS> rs);
129875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
129975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an int4.
130075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
130175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
130275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
130384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I32_4(sp<RS> rs);
130475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
130575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ulong2.
130675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
130775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
130875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
130984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U64_2(sp<RS> rs);
131075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
131175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ulong3.
131275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
131375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
131475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
131584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U64_3(sp<RS> rs);
131675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
131775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a ulong4.
131875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
131975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
132075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
132184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> U64_4(sp<RS> rs);
132275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
132375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a long2.
132475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
132575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
132675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
132784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I64_2(sp<RS> rs);
132875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
132975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a long3.
133075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
133175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
133275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
133384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I64_3(sp<RS> rs);
133475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
133575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a long4.
133675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
133775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
133875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
133984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> I64_4(sp<RS> rs);
134075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
134175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing a YUV pixel.
134275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
134375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
134475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
1345eb4426dfb63983559cf903b2ea984569e990c4fdTim Murray    static sp<const Element> YUV(sp<RS> rs);
134675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
134775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an rs_matrix_4x4.
134875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
134975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
135075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
135184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> MATRIX_4X4(sp<RS> rs);
135275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
135375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an rs_matrix_3x3.
135475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
135575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
135675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
135784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> MATRIX_3X3(sp<RS> rs);
135875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
135975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Utility function for returning an Element containing an rs_matrix_2x2.
136075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
136175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
136275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
136384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> MATRIX_2X2(sp<RS> rs);
136484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
136584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void updateFromNative();
136675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
136775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
136875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Create an Element with a given DataType.
136975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
137075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dt data type
137175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
137275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
137384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> createUser(sp<RS> rs, RsDataType dt);
137475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
137575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Create a vector Element with the given DataType
137675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript
137775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dt DataType
137875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] size vector size
137975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
138075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
138184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> createVector(sp<RS> rs, RsDataType dt, uint32_t size);
138275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
138375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Create an Element with a given DataType and DataKind.
138475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
138575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dt DataType
138675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dk DataKind
138775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Element
138875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
138984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    static sp<const Element> createPixel(sp<RS> rs, RsDataType dt, RsDataKind dk);
139075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
139175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
139275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns true if the Element can interoperate with this Element.
139375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] e Element to compare
139475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return true if Elements can interoperate
139575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
139610913a5c37ba119bef335320d3e8be25212c05adTim Murray    bool isCompatible(sp<const Element>e) const;
139784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
139875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
139975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Builder class for producing complex elements with matching field and name
140075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * pairs. The builder starts empty. The order in which elements are added is
140175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * retained for the layout in memory.
140275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
140384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    class Builder {
140484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    private:
14053560907fa9b1624eefbd6db5e9c3ccc25ab23b92Tim Murray        RS* mRS;
1406bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        size_t mElementsCount;
1407bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        size_t mElementsVecSize;
1408bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        sp<const Element> * mElements;
1409bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        char ** mElementNames;
1410bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        size_t * mElementNameLengths;
1411bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        uint32_t * mArraySizes;
141284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        bool mSkipPadding;
141384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
141484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    public:
141584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        Builder(sp<RS> rs);
141684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        ~Builder();
1417bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang        void add(sp<const Element> e, const char * name, uint32_t arraySize = 1);
141884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Element> create();
141984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    };
142084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
14217d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hinesprotected:
142270d8995254ee38173129e4ae4c9372f43716eb4eMiao Wang    friend class Type;
14237d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines    Element(void *id, sp<RS> rs,
1424bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang            sp<const Element> * elements,
1425bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang            size_t elementCount,
1426bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang            const char ** elementNames,
1427bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang            size_t * elementNameLengths,
1428bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang            uint32_t * arraySizes);
14297d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines    Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size);
143070d8995254ee38173129e4ae4c9372f43716eb4eMiao Wang    Element(void *id, sp<RS> rs);
14317d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines    Element(sp<RS> rs);
14327d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines    virtual ~Element();
14337d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines
143484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayprivate:
143584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void updateVisibleSubElements();
143684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
1437bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    size_t mElementsCount;
1438bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    size_t mVisibleElementMapSize;
1439bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang
1440bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    sp<const Element> * mElements;
1441bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    char ** mElementNames;
1442bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    size_t * mElementNameLengths;
1443bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    uint32_t * mArraySizes;
1444bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    uint32_t * mVisibleElementMap;
1445bc10dff26207bb8c02051b28326bb134a8f28eb3Miao Wang    uint32_t * mOffsetInBytes;
144684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
144784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    RsDataType mType;
144884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    RsDataKind mKind;
144984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool mNormalized;
145084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t mSizeBytes;
145184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t mVectorSize;
145284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
145384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
14542c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hinesclass FieldPacker {
14552c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hinesprotected:
14562c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    unsigned char* mData;
14572c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    size_t mPos;
14582c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    size_t mLen;
14592c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14602c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hinespublic:
14612c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    FieldPacker(size_t len)
146289daad6bae798779e57f252e9da4fe4e62337124Tim Murray        : mPos(0), mLen(len) {
146389daad6bae798779e57f252e9da4fe4e62337124Tim Murray            mData = new unsigned char[len];
146489daad6bae798779e57f252e9da4fe4e62337124Tim Murray        }
14652c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14662c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    virtual ~FieldPacker() {
14672c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        delete [] mData;
14682c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
14692c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14702c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    void align(size_t v) {
14712c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        if ((v & (v - 1)) != 0) {
1472ab71636b50db242cead6a3787620d6340156684cTim Murray            //            ALOGE("Non-power-of-two alignment: %zu", v);
14732c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            return;
14742c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        }
14752c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14762c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        while ((mPos & (v - 1)) != 0) {
14772c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            mData[mPos++] = 0;
14782c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        }
14792c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
14802c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14812c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    void reset() {
14822c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        mPos = 0;
14832c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
14842c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14852c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    void reset(size_t i) {
14862c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        if (i >= mLen) {
1487ab71636b50db242cead6a3787620d6340156684cTim Murray            //            ALOGE("Out of bounds: i (%zu) >= len (%zu)", i, mLen);
14882c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            return;
14892c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        }
14902c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        mPos = i;
14912c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
14922c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
14932c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    void skip(size_t i) {
14942c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        size_t res = mPos + i;
14952c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        if (res > mLen) {
1496ab71636b50db242cead6a3787620d6340156684cTim Murray            //            ALOGE("Exceeded buffer length: i (%zu) > len (%zu)", i, mLen);
14972c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            return;
14982c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        }
14992c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        mPos = res;
15002c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
15012c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
15022c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    void* getData() const {
15032c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        return mData;
15042c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
15052c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
15062c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    size_t getLength() const {
15072c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        return mLen;
15082c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
15092c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
15102c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    template <typename T>
151189daad6bae798779e57f252e9da4fe4e62337124Tim Murray        void add(T t) {
15122c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        align(sizeof(t));
15132c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        if (mPos + sizeof(t) <= mLen) {
15142c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            memcpy(&mData[mPos], &t, sizeof(t));
15152c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines            mPos += sizeof(t);
15162c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines        }
15172c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines    }
151843514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines
151943514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines    /*
152089daad6bae798779e57f252e9da4fe4e62337124Tim Murray      void add(rs_matrix4x4 m) {
152189daad6bae798779e57f252e9da4fe4e62337124Tim Murray      for (size_t i = 0; i < 16; i++) {
152289daad6bae798779e57f252e9da4fe4e62337124Tim Murray      add(m.m[i]);
152389daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
152489daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
152589daad6bae798779e57f252e9da4fe4e62337124Tim Murray
152689daad6bae798779e57f252e9da4fe4e62337124Tim Murray      void add(rs_matrix3x3 m) {
152789daad6bae798779e57f252e9da4fe4e62337124Tim Murray      for (size_t i = 0; i < 9; i++) {
152889daad6bae798779e57f252e9da4fe4e62337124Tim Murray      add(m.m[i]);
152989daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
153089daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
153189daad6bae798779e57f252e9da4fe4e62337124Tim Murray
153289daad6bae798779e57f252e9da4fe4e62337124Tim Murray      void add(rs_matrix2x2 m) {
153389daad6bae798779e57f252e9da4fe4e62337124Tim Murray      for (size_t i = 0; i < 4; i++) {
153489daad6bae798779e57f252e9da4fe4e62337124Tim Murray      add(m.m[i]);
153589daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
153689daad6bae798779e57f252e9da4fe4e62337124Tim Murray      }
153743514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines    */
153843514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines
153989daad6bae798779e57f252e9da4fe4e62337124Tim Murray    void add(sp<BaseObj> obj) {
154043514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines        if (obj != NULL) {
154143514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines            add((uint32_t) (uintptr_t) obj->getID());
154243514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines        } else {
154343514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines            add((uint32_t) 0);
154443514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines        }
154543514cde7e9b4869ffba6ba759d1e31f22d936f7Stephen Hines    }
15462c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines};
15472c7206e7e19c23fdaa2dd5843f0597624a5e7341Stephen Hines
154875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
154975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * A Type describes the Element and dimensions used for an Allocation or a
155075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * parallel operation.
155175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray *
155275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * A Type always includes an Element and an X dimension. A Type may be
155375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * multidimensional, up to three dimensions. A nonzero value in the Y or Z
155475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * dimensions indicates that the dimension is present. Note that a Type with
155575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * only a given X dimension and a Type with the same X dimension but Y = 1 are
155675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * not equivalent.
155775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray *
155875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * A Type also supports inclusion of level of detail (LOD) or cube map
155975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * faces. LOD and cube map faces are booleans to indicate present or not
156075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * present.
156175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray *
156275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * A Type also supports YUV format information to support an Allocation in a YUV
1563c6f437422fe6b0093b5b32df2f145c5ce23e5a13Pirama Arumuga Nainar * format. The YUV formats supported are RS_YUV_YV12 and RS_YUV_NV21.
156475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
156584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Type : public BaseObj {
156684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayprotected:
156784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    friend class Allocation;
156884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
156984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t mDimX;
157084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t mDimY;
157184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t mDimZ;
1572c6f437422fe6b0093b5b32df2f145c5ce23e5a13Pirama Arumuga Nainar    RsYuvFormat mYuvFormat;
157384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool mDimMipmaps;
157484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool mDimFaces;
157584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t mElementCount;
157684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    sp<const Element> mElement;
157784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
15787d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines    Type(void *id, sp<RS> rs);
15797d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines
158084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void calcElementCount();
158184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    virtual void updateFromNative();
158284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
158384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraypublic:
158484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
158575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
158675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the YUV format.
158775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return YUV format of the Allocation
158875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
1589c6f437422fe6b0093b5b32df2f145c5ce23e5a13Pirama Arumuga Nainar    RsYuvFormat getYuvFormat() const {
1590eb4426dfb63983559cf903b2ea984569e990c4fdTim Murray        return mYuvFormat;
1591eb4426dfb63983559cf903b2ea984569e990c4fdTim Murray    }
1592eb4426dfb63983559cf903b2ea984569e990c4fdTim Murray
159375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
159475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the Element of the Allocation.
159575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return YUV format of the Allocation
159675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
159784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    sp<const Element> getElement() const {
159884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mElement;
159984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
160084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
160175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
160275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the X dimension of the Allocation.
160375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return X dimension of the allocation
160475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
160584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t getX() const {
160684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mDimX;
160784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
160884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
160975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
161075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the Y dimension of the Allocation.
161175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Y dimension of the allocation
161275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
161384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t getY() const {
161484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mDimY;
161584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
161684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
161775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
161875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns the Z dimension of the Allocation.
161975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return Z dimension of the allocation
162075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
162184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    uint32_t getZ() const {
162284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mDimZ;
162384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
162484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
162575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
162675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns true if the Allocation has mipmaps.
162775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return true if the Allocation has mipmaps
162875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
162984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool hasMipmaps() const {
163084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mDimMipmaps;
163184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
163284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
163375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
163475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns true if the Allocation is a cube map
163575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return true if the Allocation is a cube map
163675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
163784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    bool hasFaces() const {
163884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mDimFaces;
163984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
164084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
164175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
164275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns number of accessible Elements in the Allocation
164375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return number of accessible Elements in the Allocation
164475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
164584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t getCount() const {
164684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mElementCount;
164784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
164884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
164975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
165075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Returns size in bytes of all Elements in the Allocation
165175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return size in bytes of all Elements in the Allocation
165275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
165384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    size_t getSizeBytes() const {
165484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        return mElementCount * mElement->getSizeBytes();
165584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
165684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
165775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
165875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Creates a new Type with the given Element and dimensions.
165975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
166075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] e Element
166175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dimX X dimension
166275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dimY Y dimension
166375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] dimZ Z dimension
166475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new Type
166575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
166696267c2ff0133c20cc5643419a3ed3b1e75fe568Tim Murray    static sp<const Type> create(sp<RS> rs, sp<const Element> e, uint32_t dimX, uint32_t dimY, uint32_t dimZ);
166784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
166884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    class Builder {
166984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    protected:
16703560907fa9b1624eefbd6db5e9c3ccc25ab23b92Tim Murray        RS* mRS;
167184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        uint32_t mDimX;
167284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        uint32_t mDimY;
167384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        uint32_t mDimZ;
1674c6f437422fe6b0093b5b32df2f145c5ce23e5a13Pirama Arumuga Nainar        RsYuvFormat mYuvFormat;
167584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        bool mDimMipmaps;
167684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        bool mDimFaces;
167784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Element> mElement;
167884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
167984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    public:
168084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        Builder(sp<RS> rs, sp<const Element> e);
168184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
168284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        void setX(uint32_t value);
16837d1b757c0be2622b72b3d3a10826752adb3e5182Stephen Hines        void setY(uint32_t value);
1684eb4426dfb63983559cf903b2ea984569e990c4fdTim Murray        void setZ(uint32_t value);
1685c6f437422fe6b0093b5b32df2f145c5ce23e5a13Pirama Arumuga Nainar        void setYuvFormat(RsYuvFormat format);
168684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        void setMipmaps(bool value);
168784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        void setFaces(bool value);
168884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Type> create();
168984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    };
169084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
169184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
169284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
169375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
169475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * The parent class for all executable Scripts. This should not be used by applications.
169575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
169684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass Script : public BaseObj {
169784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayprivate:
169884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
169984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayprotected:
170084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    Script(void *id, sp<RS> rs);
170184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void forEach(uint32_t slot, sp<const Allocation> in, sp<const Allocation> out,
170284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            const void *v, size_t) const;
170384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void bindAllocation(sp<Allocation> va, uint32_t slot) const;
170484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, const void *, size_t len) const;
170584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, sp<const BaseObj> o) const;
170684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void invoke(uint32_t slot, const void *v, size_t len) const;
170784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
170884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
170984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void invoke(uint32_t slot) const {
171084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        invoke(slot, NULL, 0);
171184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
171284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, float v) const {
171384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        setVar(index, &v, sizeof(v));
171484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
171584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, double v) const {
171684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        setVar(index, &v, sizeof(v));
171784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
171884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, int32_t v) const {
171984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        setVar(index, &v, sizeof(v));
172084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
1721b05c850a493a769c88b58be2a6721a9bb06b3a0aJon Parr    void setVar(uint32_t index, uint32_t v) const {
1722b05c850a493a769c88b58be2a6721a9bb06b3a0aJon Parr        setVar(index, &v, sizeof(v));
1723b05c850a493a769c88b58be2a6721a9bb06b3a0aJon Parr    }
172484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, int64_t v) const {
172584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        setVar(index, &v, sizeof(v));
172684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
172784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    void setVar(uint32_t index, bool v) const {
172884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        setVar(index, &v, sizeof(v));
172984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    }
173084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
173184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murraypublic:
173284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    class FieldBase {
173384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    protected:
173484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Element> mElement;
173584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<Allocation> mAllocation;
173684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
173784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        void init(sp<RS> rs, uint32_t dimx, uint32_t usages = 0);
173884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
173984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    public:
174084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Element> getElement() {
174184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            return mElement;
174284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        }
174384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
174484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Type> getType() {
174584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            return mAllocation->getType();
174684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        }
174784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
174884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        sp<const Allocation> getAllocation() {
174984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            return mAllocation;
175084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        }
175184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
175284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray        //void updateAllocation();
175384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    };
175484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
175584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
175675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
175775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * The parent class for all user-defined scripts. This is intended to be used by auto-generated code only.
175875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
175984bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayclass ScriptC : public Script {
176084bf2b877024aaa154b66e0f2338d54bdabd855aTim Murrayprotected:
176184bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray    ScriptC(sp<RS> rs,
176284bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            const void *codeTxt, size_t codeLength,
176384bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            const char *cachedName, size_t cachedNameLength,
176484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray            const char *cacheDir, size_t cacheDirLength);
176584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
176684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray};
176784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
176875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
176975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * The parent class for all script intrinsics. Intrinsics provide highly optimized implementations of
177075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * basic functions. This is not intended to be used directly.
177175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
17727f0d56899840f071c81bbbcbebfbd880ac31c043Tim Murrayclass ScriptIntrinsic : public Script {
17737f0d56899840f071c81bbbcbebfbd880ac31c043Tim Murray protected:
177410913a5c37ba119bef335320d3e8be25212c05adTim Murray    sp<const Element> mElement;
17753cd44af22622898d3000b2b3c4c408cede294152Tim Murray    ScriptIntrinsic(sp<RS> rs, int id, sp<const Element> e);
1776b27b18130d0772203799ba0f2d27783b640dc891Tim Murray    virtual ~ScriptIntrinsic();
17777f0d56899840f071c81bbbcbebfbd880ac31c043Tim Murray};
17787f0d56899840f071c81bbbcbebfbd880ac31c043Tim Murray
177975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
178075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * Intrinsic for converting RGB to RGBA by using a 3D lookup table. The incoming
178175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * r,g,b values are use as normalized x,y,z coordinates into a 3D
178275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * allocation. The 8 nearest values are sampled and linearly interpolated. The
178375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray * result is placed in the output.
178475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray */
178589daad6bae798779e57f252e9da4fe4e62337124Tim Murrayclass ScriptIntrinsic3DLUT : public ScriptIntrinsic {
178621fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray private:
178789daad6bae798779e57f252e9da4fe4e62337124Tim Murray    ScriptIntrinsic3DLUT(sp<RS> rs, sp<const Element> e);
178821fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray public:
178975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
179075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Supported Element types are U8_4. Default lookup table is identity.
179175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] rs RenderScript context
179275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] e Element
179375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @return new ScriptIntrinsic
179475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
179521fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray    static sp<ScriptIntrinsic3DLUT> create(sp<RS> rs, sp<const Element> e);
179675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
179775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
179875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Launch the intrinsic.
179975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] ain input Allocation
180075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] aout output Allocation
180175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
180289daad6bae798779e57f252e9da4fe4e62337124Tim Murray    void forEach(sp<Allocation> ain, sp<Allocation> aout);
180375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
180475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
180575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * Sets the lookup table. The lookup table must use the same Element as the
180675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * intrinsic.
180775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     * @param[in] lut new lookup table
180875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
180989daad6bae798779e57f252e9da4fe4e62337124Tim Murray    void setLUT(sp<Allocation> lut);
181089daad6bae798779e57f252e9da4fe4e62337124Tim Murray};
181189daad6bae798779e57f252e9da4fe4e62337124Tim Murray
181249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
181375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray/**
181449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic kernel provides high performance RenderScript APIs to BLAS.
181549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang *
181649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard
181749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * building blocks for performing basic vector and matrix operations.
181849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang *
181949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * For detailed description of BLAS, please refer to http://www.netlib.org/blas/
182049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang *
182149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang **/
182249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicBLAS : public ScriptIntrinsic {
182321fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray private:
182449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicBLAS(sp<RS> rs, sp<const Element> e);
182521fa7a0a23eddab88ff261017f6d7a2548b4d89aTim Murray public:
182675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
182749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Create an intrinsic to access BLAS subroutines.
182849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
182949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs The RenderScript context
183049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return ScriptIntrinsicBLAS
183175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
183249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicBLAS> create(sp<RS> rs);
183349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
183475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
183549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SGEMV performs one of the matrix-vector operations
183649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
183749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
183849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d58/sgemv_8f.html
183949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
184049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
184149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
184249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
184349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
184449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
184549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
184649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
184749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
184849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
184949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SGEMV(RsBlasTranspose TransA,
185049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               float alpha, sp<Allocation> A, sp<Allocation> X, int incX,
185149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               float beta, sp<Allocation> Y, int incY);
185249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
185349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
185449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DGEMV performs one of the matrix-vector operations
185549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
185649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
185749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f.html
185849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
185949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
186049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
186149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
186249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
186349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
186449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
186549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
186649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
186749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
186849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DGEMV(RsBlasTranspose TransA,
186949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double alpha, sp<Allocation> A, sp<Allocation> X, int incX,
187049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double beta, sp<Allocation> Y, int incY);
187149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
187249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
187349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CGEMV performs one of the matrix-vector operations
187449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
187549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
187649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/d8a/cgemv_8f.html
187749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
187849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
187949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
188049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
188149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
188249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
188349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
188449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
188549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
188649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
188749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CGEMV(RsBlasTranspose TransA,
188849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Float2 alpha, sp<Allocation> A, sp<Allocation> X, int incX,
188949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Float2 beta, sp<Allocation> Y, int incY);
189049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
189149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
189249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZGEMV performs one of the matrix-vector operations
189349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
189449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
189549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d40/zgemv_8f.html
189649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
189749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
189849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
189949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
190049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
190149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
190249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
190349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
190449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
190549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
190649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZGEMV(RsBlasTranspose TransA,
190749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Double2 alpha, sp<Allocation> A, sp<Allocation> X, int incX,
190849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Double2 beta, sp<Allocation> Y, int incY);
190949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
191049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
191149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SGBMV performs one of the matrix-vector operations
191249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
191349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
191449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d46/sgbmv_8f.html
191549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
191649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
191749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
191849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
191949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, m):
192049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
192149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i+kl] = a[i, j]
192249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
192349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
192449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KL The number of sub-diagonals of the matrix A.
192549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KU The number of super-diagonals of the matrix A.
192649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
192749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32}.
192849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
192949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
193049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
193149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
193249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
193349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
193449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SGBMV(RsBlasTranspose TransA,
193549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int KL, int KU, float alpha, sp<Allocation> A, sp<Allocation> X, int incX,
193649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               float beta, sp<Allocation> Y, int incY);
193749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
193849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
193949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DGBMV performs one of the matrix-vector operations
194049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y
194149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
194249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d3f/dgbmv_8f.html
194349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
194449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
194549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
194649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
194749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, m):
194849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
194949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i+kl] = a[i, j]
195049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
195149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
195249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KL The number of sub-diagonals of the matrix A.
195349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KU The number of super-diagonals of the matrix A.
195449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
195549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64}.
195649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
195749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
195849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
195949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
196049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
196149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
196249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DGBMV(RsBlasTranspose TransA,
196349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int KL, int KU, double alpha, sp<Allocation> A, sp<Allocation> X,
196449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, double beta, sp<Allocation> Y, int incY);
196549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
196649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
196749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CGBMV performs one of the matrix-vector operations
196849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
196949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
197049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d75/cgbmv_8f.html
197149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
197249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
197349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
197449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
197549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, m):
197649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
197749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i+kl] = a[i, j]
197849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
197949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
198049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KL The number of sub-diagonals of the matrix A.
198149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KU The number of super-diagonals of the matrix A.
198249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
198349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains the band matrix A, supported elements type: {Element#F32_2}.
198449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
198549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
198649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
198749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
198849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
198949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
199049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CGBMV(RsBlasTranspose TransA,
199149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int KL, int KU, Float2 alpha, sp<Allocation> A, sp<Allocation> X,
199249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Float2 beta, sp<Allocation> Y, int incY);
199349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
199449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
199549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZGBMV performs one of the matrix-vector operations
199649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y   or   y := alpha*A**T*x + beta*y   or   y := alpha*A**H*x + beta*y
199749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
199849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d9/d46/zgbmv_8f.html
199949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
200049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a M*N matrix, the input Allocation should also be of size M*N (dimY = M, dimX = N),
200149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region M*(KL+KU+1) will be referenced. The following subroutine can is an
200249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert the original matrix 'a' to row-based band matrix 'b'.
200349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, m):
200449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(max(0, i-kl), min(i+ku+1, n)):
200549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i+kl] = a[i, j]
200649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
200749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
200849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KL The number of sub-diagonals of the matrix A.
200949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param KU The number of super-diagonals of the matrix A.
201049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
201149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains the band matrix A, supported elements type: {Element#F64_2}.
201249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
201349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
201449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
201549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
201649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
201749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
201849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZGBMV(RsBlasTranspose TransA,
201949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int KL, int KU, Double2 alpha, sp<Allocation> A, sp<Allocation> X, int incX,
202049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Double2 beta, sp<Allocation> Y, int incY);
202149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
202249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
202349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STRMV performs one of the matrix-vector operations
202449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
202549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
202649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d45/strmv_8f.html
202749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
202849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
202949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
203049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
203149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
203249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
203349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
203475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
203549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
203649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
203749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
203875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
203949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTRMV performs one of the matrix-vector operations
204049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
204149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
204249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dc/d7e/dtrmv_8f.html
204349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
204449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
204549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
204649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
204749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
204849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
204949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
205075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
205149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
205249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
205349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
205475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
205549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTRMV performs one of the matrix-vector operations
205649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
205749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
205849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d78/ctrmv_8f.html
205949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
206049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
206149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
206249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
206349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
206449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
206549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
206675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
206749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
206849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
206949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
207075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
207149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTRMV performs one of the matrix-vector operations
207249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
207349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
207449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/dd1/ztrmv_8f.html
207549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
207649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
207749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
207849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
207949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
208049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
208149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
208275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
208349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTRMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
208449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
208549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
208675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
208749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STBMV performs one of the matrix-vector operations
208849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
208949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
209049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d7d/stbmv_8f.html
209149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
209249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
209349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
209449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
209549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
209649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
209749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
209849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
209949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
210049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
210149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
210249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
210349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
210449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
210549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
210675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
210749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
210849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
210949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
211075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
211149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTBMV performs one of the matrix-vector operations
211249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
211349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
211449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d29/dtbmv_8f.html
211549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
211649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
211749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
211849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
211949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
212049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
212149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
212249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
212349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
212449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
212549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
212649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
212749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
212849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
212949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
213075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
213149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
213249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
213349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
213475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
213549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTBMV performs one of the matrix-vector operations
213649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
213749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
213849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/dcd/ctbmv_8f.html
213949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
214049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
214149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
214249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
214349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
214449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
214549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
214649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
214749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
214849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
214949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
215049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
215149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
215249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
215349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
215475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
215549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
215649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
215749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
215875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
215949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTBMV performs one of the matrix-vector operations
216049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
216149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
216249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d39/ztbmv_8f.html
216349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
216449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
216549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
216649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
216749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
216849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
216949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
217049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
217149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
217249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
217349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
217449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
217549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
217649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
217749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
217875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
217949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTBMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
218049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
218149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
218275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
218349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STPMV performs one of the matrix-vector operations
218449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
218549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
218649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/db1/stpmv_8f.html
218749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
218849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
218949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
219049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
219149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
219249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
219349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
219449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
219549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
219649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
219749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
219849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
219949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}.
220049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
220149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
220275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
220349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
220449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
220549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
220675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
220749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTPMV performs one of the matrix-vector operations
220849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x
220949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
221049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dc/dcd/dtpmv_8f.html
221149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
221249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
221349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
221449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
221549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
221649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
221749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
221849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
221949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
222049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
222149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
222249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
222349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}.
222449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
222549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
222675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
222749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
222849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
222949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
223075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
223149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTPMV performs one of the matrix-vector operations
223249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
223349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
223449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/dbb/ctpmv_8f.html
223549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
223649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
223749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
223849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
223949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
224049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
224149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
224249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
224349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
224449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
224549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
224649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
224749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}.
224849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
224949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
225075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
225149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
225249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
225349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
225475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
225549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTPMV performs one of the matrix-vector operations
225649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * x := A*x   or   x := A**T*x   or   x := A**H*x
225749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
225849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d9e/ztpmv_8f.html
225949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
226049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
226149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
226249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
226349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
226449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
226549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
226649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
226749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
226849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
226949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
227049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
227149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}.
227249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
227349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
227475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
227549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTPMV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
227649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
227749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
227875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
227949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STRSV solves one of the systems of equations
228049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
228149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
228249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d2a/strsv_8f.html
228349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
228449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
228549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
228649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
228749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
228849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
228949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
229075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
229149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
229249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
229349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
229475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
229549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTRSV solves one of the systems of equations
229649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
229749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
229849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d96/dtrsv_8f.html
229949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
230049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
230149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
230249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
230349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
230449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
230549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
230675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
230749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
230849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
230949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
231075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
231149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTRSV solves one of the systems of equations
231249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
231349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
231449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/dc8/ctrsv_8f.html
231549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
231649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
231749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
231849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
231949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
232049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
232149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
232275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
232349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
232449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
232584bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
232675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
232749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTRSV solves one of the systems of equations
232849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
232949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
233049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d1/d2f/ztrsv_8f.html
233149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
233249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
233349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
233449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
233549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
233649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
233749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
233875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
233949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTRSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
234049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, sp<Allocation> X, int incX);
234149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
234275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
234349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STBSV solves one of the systems of equations
234449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
234549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
234649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d1f/stbsv_8f.html
234749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
234849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
234949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
235049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
235149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
235249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
235349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
235449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
235549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
235649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
235749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
235849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
235949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
236049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
236149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
236275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
236349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
236449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
236549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
236675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
236749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTBSV solves one of the systems of equations
236849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
236949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
237049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/dcf/dtbsv_8f.html
237149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
237249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
237349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
237449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
237549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
237649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
237749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
237849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
237949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
238049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
238149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
238249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
238349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
238449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
238549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
238675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
238749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
238849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
238949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
239075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
239149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTBSV solves one of the systems of equations
239249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
239349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
239449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d9/d5f/ctbsv_8f.html
239549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
239649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
239749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
239849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
239949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
240049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
240149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
240249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
240349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
240449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
240549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
240649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
240749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
240849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
240949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
241075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
241149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
241249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
24138f1e60c42e0a819f389594f5d2f38fb2e024c9c9Tim Murray
241475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
241549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTBSV solves one of the systems of equations
241649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
241749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
241849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/d5a/ztbsv_8f.html
241949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
242049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
242149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
242249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
242349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
242449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
242549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
242649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
242749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
242849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
242949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
243049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
243149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
243249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
243349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
243475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
243549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTBSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
243649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int K, sp<Allocation> A, sp<Allocation> X, int incX);
243749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
243875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
243949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STPSV solves one of the systems of equations
244049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
244149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
244249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d7c/stpsv_8f.html
244349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
244449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
244549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
244649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
244749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
244849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
244949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
245049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
245149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
245249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
245349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
245449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
245549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32}.
245649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
245749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
245875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
245949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
246049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
246149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
246275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
246349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTPSV solves one of the systems of equations
246449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b
246549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
246649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d9/d84/dtpsv_8f.html
246749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
246849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
246949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
247049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
247149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
247249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
247349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
247449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
247549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
247649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
247749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
247849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
247949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64}.
248049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
248149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
248275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
248349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
248449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
248575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
248675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
248749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTPSV solves one of the systems of equations
248849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
248975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
249049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/d56/ctpsv_8f.html
249149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
249249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
249349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
249449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
249549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
249649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
249749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
249849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
249949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
250049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
250149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
250249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
250349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F32_2}.
250449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
250549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
250675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
250749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
250849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
250949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
251075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
251149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTPSV solves one of the systems of equations
251249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A*x = b   or   A**T*x = b   or   A**H*x = b
251375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
251449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/da/d57/ztpsv_8f.html
251549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
251649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
251749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
251849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
251949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
252049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
252149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
252249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
252349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
252449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the matrix is an upper or lower triangular matrix.
252549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
252649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
252749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains packed matrix A, supported elements type: {Element#F64_2}.
252849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
252949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
253075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
253149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTPSV(RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
253249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Ap, sp<Allocation> X, int incX);
253349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
253475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
253549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYMV performs the matrix-vector operation
253649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
253749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
253849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d94/ssymv_8f.html
253949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
254049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
254149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
254249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
254349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
254449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
254549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
254649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
254749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
254875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
254949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYMV(RsBlasUplo Uplo, float alpha, sp<Allocation> A, sp<Allocation> X,
255049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, float beta, sp<Allocation> Y, int incY);
255149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
255275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
255349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSBMV performs the matrix-vector operation
255449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
255549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
255649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/da1/ssbmv_8f.html
255749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
255849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
255949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
256049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
256149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
256249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
256349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
256449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
256549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
256649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
256749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
256849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
256949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
257049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
257149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
257249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
257349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
257449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
257549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSBMV(RsBlasUplo Uplo, int K, float alpha, sp<Allocation> A, sp<Allocation> X,
257649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, float beta, sp<Allocation> Y, int incY);
257749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
257849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
257949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSPMV performs the matrix-vector operation
258049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
258149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
258249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/d68/sspmv_8f.html
258349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
258449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
258549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
258649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
258749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
258849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
258949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
259049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
259149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
259249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
259349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
259449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
259549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
259649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
259749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
259849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
259949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
260075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
260149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSPMV(RsBlasUplo Uplo, float alpha, sp<Allocation> Ap, sp<Allocation> X,
260249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, float beta, sp<Allocation> Y, int incY);
260349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
260475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
260549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SGER performs the rank 1 operation
260649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + A
260749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
260849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d5c/sger_8f.html
260949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
261049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
261149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
261249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
261349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
261449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
261549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
261675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
261749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SGER(float alpha, sp<Allocation> X, int incX, sp<Allocation> Y, int incY, sp<Allocation> A);
261889daad6bae798779e57f252e9da4fe4e62337124Tim Murray
261975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
262049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYR performs the rank 1 operation
262149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**T + A
262249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
262349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/dac/ssyr_8f.html
262449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
262549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
262649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
262749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
262849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
262949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
263075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
263149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> A);
263249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
263375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
263449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSPR performs the rank 1 operation
263549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**T + A
263649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
263749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d9b/sspr_8f.html
263849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
263949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
264049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
264149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
264249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
264349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
264449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
264549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
264649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
264749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
264849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
264949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
265049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
265149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
265275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
265349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSPR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> Ap);
265449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
265575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
265649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYR2 performs the symmetric rank 2 operation
265749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + alpha*y*x**T + A
265849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
265949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d99/ssyr2_8f.html
266049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
266149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
266249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
266349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
266449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
266549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
266649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
266749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
266875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
266949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYR2(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX,
267049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
267149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
267275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
267349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSPR2 performs the symmetric rank 2 operation
267449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + alpha*y*x**T + A
267549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
267649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d3e/sspr2_8f.html
267749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
267849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
267949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
268049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
268149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
268249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
268349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
268449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
268549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
268649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
268749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
268849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32}.
268949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
269049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32}.
269149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
269249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32}.
269375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
269449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSPR2(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX,
269549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> Ap);
269689daad6bae798779e57f252e9da4fe4e62337124Tim Murray
269775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
269849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYMV performs the matrix-vector operation
269949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
270049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
270149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/dbe/dsymv_8f.html
270249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
270349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
270449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
270549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
270649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
270749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
270849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
270949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
271049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
271175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
271249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYMV(RsBlasUplo Uplo, double alpha, sp<Allocation> A, sp<Allocation> X, int incX,
271349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double beta, sp<Allocation> Y, int incY);
271449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
271575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
271649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSBMV performs the matrix-vector operation
271749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
271849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
271949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/d1e/dsbmv_8f.html
272049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
272149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
272249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
272349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
272449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
272549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
272649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
272749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
272849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
272949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
273049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
273149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
273249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
273349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
273449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
273549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
273649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
273749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
273849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSBMV(RsBlasUplo Uplo, int K, double alpha, sp<Allocation> A, sp<Allocation> X, int incX,
273949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double beta, sp<Allocation> Y, int incY);
274049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
274149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
274249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSPMV performs the matrix-vector operation
274349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
274449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
274549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/d85/dspmv_8f.html
274649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
274749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
274849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
274949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
275049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
275149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
275249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
275349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
275449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
275549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
275649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
275749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
275849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
275949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
276049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
276149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
276249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
276375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
276449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSPMV(RsBlasUplo Uplo, double alpha, sp<Allocation> Ap, sp<Allocation> X, int incX,
276549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double beta, sp<Allocation> Y, int incY);
276649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
276775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
276849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DGER performs the rank 1 operation
276949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + A
277049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
277149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dc/da8/dger_8f.html
277249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
277349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
277449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
277549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
277649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
277749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
277849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
277975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
278049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DGER(double alpha, sp<Allocation> X, int incX, sp<Allocation> Y, int incY, sp<Allocation> A);
278149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
278275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
278349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYR performs the rank 1 operation
278449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**T + A
278549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
278649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f.html
278749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
278849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
278949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
279049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
279149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
279249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
279375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
279449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> A);
279589daad6bae798779e57f252e9da4fe4e62337124Tim Murray
279675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
279749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSPR performs the rank 1 operation
279849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**T + A
279975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
280049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dd/dba/dspr_8f.html
280175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
280249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
280349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
280449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
280549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
280649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
280749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
280849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
280975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
281049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
281149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
281249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
281349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
281449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
281575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
281649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSPR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> Ap);
281749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
281875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
281949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYR2 performs the symmetric rank 2 operation
282049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + alpha*y*x**T + A
282175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
282249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d41/dsyr2_8f.html
282349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
282449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
282549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
282649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
282749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
282849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
282949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
283049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
283175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
283249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYR2(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX,
283349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
283449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
283575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
283649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSPR2 performs the symmetric rank 2 operation
283749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + alpha*y*x**T + A
283875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
283949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dd/d9e/dspr2_8f.html
284075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
284149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
284249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
284349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
284449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
284549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
284649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
284749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
284849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
284949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
285049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
285149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64}.
285249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
285349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64}.
285449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
285549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64}.
285675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
285749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSPR2(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX,
285849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> Ap);
285949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
286075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
286149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHEMV performs the matrix-vector operation
286249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
286375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
286449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/d51/chemv_8f.html
286575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
286649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
286749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
286849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
286949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
287049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
287149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
287249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
287349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
287475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
287549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHEMV(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A, sp<Allocation> X,
287649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Float2 beta, sp<Allocation> Y, int incY);
287749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
287875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
287949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHBMV performs the matrix-vector operation
288049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
288175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
288249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/dc2/chbmv_8f.html
288375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
288449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
288549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
288649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
288749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
288849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
288949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
289049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
289149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
289249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
289349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
289449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
289549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
289649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
289749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
289849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
289949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
290049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
290149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHBMV(RsBlasUplo Uplo, int K, Float2 alpha, sp<Allocation> A, sp<Allocation> X,
290249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Float2 beta, sp<Allocation> Y, int incY);
290349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
290449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
290549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHPMV performs the matrix-vector operation
290649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
290749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
290849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d06/chpmv_8f.html
290949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
291049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
291149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
291249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
291349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
291449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
291549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
291649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
291749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
291849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
291949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
292049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
292149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
292249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
292349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
292449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
292549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
292675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
292749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHPMV(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> Ap, sp<Allocation> X,
292849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Float2 beta, sp<Allocation> Y, int incY);
2929b27b18130d0772203799ba0f2d27783b640dc891Tim Murray
293049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
293149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CGERU performs the rank 1 operation
293249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + A
293349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
293449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d5f/cgeru_8f.html
293549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
293649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
293749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
293849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
293949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
294049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
294149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
294249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
294349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CGERU(Float2 alpha, sp<Allocation> X, int incX,
294449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
2945b27b18130d0772203799ba0f2d27783b640dc891Tim Murray
294675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
294749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CGERC performs the rank 1 operation
294849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + A
294975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
295049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dd/d84/cgerc_8f.html
295175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
295249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
295349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
295449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
295549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
295649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
295749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
295849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
295949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CGERC(Float2 alpha, sp<Allocation> X, int incX,
296049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
296149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
296249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
296349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHER performs the rank 1 operation
296449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**H + A
296575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
296649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d6d/cher_8f.html
296749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
296849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
296949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
297049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
297149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
297249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
297375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
297449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHER(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> A);
297549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
297675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
297749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHPR performs the rank 1 operation
297849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**H + A
297975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
298049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/dcd/chpr_8f.html
298149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
298249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
298349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
298449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
298549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
298649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
298749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
298849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
298949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
299049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
299149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
299249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
299349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
299449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
299575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
299649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHPR(RsBlasUplo Uplo, float alpha, sp<Allocation> X, int incX, sp<Allocation> Ap);
299749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
299875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
299949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHER2 performs the symmetric rank 2 operation
300049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + alpha*y*x**H + A
300149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
300249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d87/cher2_8f.html
300349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
300449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
300549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
300649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
300749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
300849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
300949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
301049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
301175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
301249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHER2(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> X, int incX,
301349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
301449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
301575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
301649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHPR2 performs the symmetric rank 2 operation
301749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + alpha*y*x**H + A
301849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
301949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d44/chpr2_8f.html
302049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
302149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
302249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
302349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
302449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
302549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
302649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
302749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
302849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
302949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
303049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
303149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F32_2}.
303249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
303349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F32_2}.
303449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
303549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F32_2}.
303675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
303749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHPR2(RsBlasUplo Uplo, Float2 alpha, sp<Allocation> X, int incX,
303849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> Ap);
303949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
304075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
304149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHEMV performs the matrix-vector operation
304249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
304349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
304449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/ddd/zhemv_8f.html
304549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
304649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
304749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
304849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
304949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
305049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
305149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
305249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
305349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
305475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
305549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHEMV(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A, sp<Allocation> X,
305649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Double2 beta, sp<Allocation> Y, int incY);
305749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
305875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
305949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHBMV performs the matrix-vector operation
306049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
306149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
306249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d1a/zhbmv_8f.html
306349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
306449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should also be of size N*N (dimY = N, dimX = N),
306549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       but only the region N*(K+1) will be referenced. The following subroutine can is an
306649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       example showing how to convert a UPPER trianglar matrix 'a' to row-based band matrix 'b'.
306749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
306849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, min(i+k+1, n)):
306949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[i, j-i] = a[i, j]
307049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
307149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the band matrix A is being supplied.
307249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param K The number of off-diagonals of the matrix A
307349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
307449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
307549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
307649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
307749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
307849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
307949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
308049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
308149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHBMV(RsBlasUplo Uplo, int K, Double2 alpha, sp<Allocation> A, sp<Allocation> X,
308249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Double2 beta, sp<Allocation> Y, int incY);
308349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
308449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
308549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHPMV performs the matrix-vector operation
308649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * y := alpha*A*x + beta*y
308749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
308849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d60/zhpmv_8f.html
308949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
309049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
309149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
309249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
309349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
309449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
309549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
309649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
309749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
309849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of the matrix A is supplied in packed form.
309949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
310049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
310149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
310249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
310349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
310449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
310549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
310675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
310749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHPMV(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> Ap, sp<Allocation> X,
310849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               int incX, Double2 beta, sp<Allocation> Y, int incY);
3109b27b18130d0772203799ba0f2d27783b640dc891Tim Murray
3110e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    /**
311149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZGERU performs the rank 1 operation
311249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**T + A
311349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
311449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/d12/zgeru_8f.html
311549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
311649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
311749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
311849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
311949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
312049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
312149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3122e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     */
312349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZGERU(Double2 alpha, sp<Allocation> X, int incX,
312449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
3125e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang
3126e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    /**
312749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZGERC performs the rank 1 operation
312849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + A
312949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
313049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/dad/zgerc_8f.html
313149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
313249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
313349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
313449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
313549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
313649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
313749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3138e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     */
313949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZGERC(Double2 alpha, sp<Allocation> X, int incX,
314049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
3141e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang
3142e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang    /**
314349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHER performs the rank 1 operation
314449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**H + A
314549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
314649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d0e/zher_8f.html
314749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
314849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
314949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
315049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
315149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
315249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
3153e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang     */
315449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHER(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> A);
3155e5428e661ce6f9d24f838cab0a8fb0fa8c76dbcaMiao Wang
315675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
315749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHPR performs the rank 1 operation
315849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*x**H + A
315975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
316049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/de1/zhpr_8f.html
316175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
316249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
316349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
316449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
316549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
316649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
316749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
316849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
316975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
317049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
317149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
317249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
317349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
317449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
317575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
317649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHPR(RsBlasUplo Uplo, double alpha, sp<Allocation> X, int incX, sp<Allocation> Ap);
317749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
317875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
317949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHER2 performs the symmetric rank 2 operation
318049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + alpha*y*x**H + A
318175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
318249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/da/d8a/zher2_8f.html
318349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
318449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
318549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
318649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
318749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
318849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
318949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
319049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
319175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
319249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHER2(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> X, int incX,
319349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> A);
319475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray
319575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
319649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHPR2 performs the symmetric rank 2 operation
319749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * A := alpha*x*y**H + alpha*y*x**H + A
319875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
319949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d5/d52/zhpr2_8f.html
320049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
320149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Note: For a N*N matrix, the input Allocation should be a 1D allocation of size dimX = N*(N+1)/2,
320249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       The following subroutine can is an example showing how to convert a UPPER trianglar matrix
320349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *       'a' to packed matrix 'b'.
320449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           k = 0
320549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *           for i in range(0, n):
320649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *              for j in range(i, n):
320749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                  b[k++] = a[i, j]
320849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
320949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be supplied in the packed form.
321049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
321149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param X The input allocation contains vector x, supported elements type: {Element#F64_2}.
321249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incX The increment for the elements of vector x, must be larger than zero.
321349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Y The input allocation contains vector y, supported elements type: {Element#F64_2}.
321449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param incY The increment for the elements of vector y, must be larger than zero.
321549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Ap The input allocation contains matrix A, supported elements type: {Element#F64_2}.
321675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
321749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHPR2(RsBlasUplo Uplo, Double2 alpha, sp<Allocation> X, int incX,
321849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> Y, int incY, sp<Allocation> Ap);
321989daad6bae798779e57f252e9da4fe4e62337124Tim Murray
322049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
322149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SGEMM performs one of the matrix-matrix operations
322249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
322349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
322449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/de2/sgemm_8f.html
322549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
322649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
322749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransB The type of transpose applied to matrix B.
322849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
322949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
323049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
323149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
323249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
323349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
323449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, float alpha, sp<Allocation> A,
323549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, float beta, sp<Allocation> C);
3236b27b18130d0772203799ba0f2d27783b640dc891Tim Murray
3237729b6fe58aff47c4f666b22bbb7a6d6114ddefa9Tim Murray
323875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
323949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DGEMM performs one of the matrix-matrix operations
324049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*op(A)*op(B) + beta*C   where op(X) is one of op(X) = X  or  op(X) = X**T
324149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
324249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f.html
324349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
324449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
324549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransB The type of transpose applied to matrix B.
324649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
324749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
324849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
324949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
325049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
325175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
325249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, double alpha, sp<Allocation> A,
325349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, double beta, sp<Allocation> C);
3254729b6fe58aff47c4f666b22bbb7a6d6114ddefa9Tim Murray
325575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
325649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CGEMM performs one of the matrix-matrix operations
325749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 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
325849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
325949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d5b/cgemm_8f.html
326049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
326149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
326249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransB The type of transpose applied to matrix B.
326349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
326449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
326549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
326649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
326749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
326875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
326949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Float2 alpha, sp<Allocation> A,
327049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, Float2 beta, sp<Allocation> C);
327149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
327275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
327349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZGEMM performs one of the matrix-matrix operations
327449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 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
327549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
327649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/d76/zgemm_8f.html
327749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
327849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
327949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransB The type of transpose applied to matrix B.
328049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
328149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2
328249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2
328349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
328449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2
328575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
328649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZGEMM(RsBlasTranspose TransA, RsBlasTranspose TransB, Double2 alpha, sp<Allocation> A,
328749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, Double2 beta, sp<Allocation> C);
328849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
328975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
329049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYMM performs one of the matrix-matrix operations
329149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
329249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
329349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/d42/ssymm_8f.html
329449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
329549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
329649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
329749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
329849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
329949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
330049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
330149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
330275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
330349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYMM(RsBlasSide Side, RsBlasUplo Uplo, float alpha, sp<Allocation> A,
330449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, float beta, sp<Allocation> C);
330549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
330675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
330749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYMM performs one of the matrix-matrix operations
330849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
330949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
331049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/db0/dsymm_8f.html
331149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
331249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
331349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
331449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
331549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
331649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
331749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
331849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
331975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
332049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYMM(RsBlasSide Side, RsBlasUplo Uplo, double alpha, sp<Allocation> A,
332149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, double beta, sp<Allocation> C);
332249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
332375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
332449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CSYMM performs one of the matrix-matrix operations
332549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
332649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
332749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/db/d59/csymm_8f.html
332849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
332949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
333049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
333149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
333249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
333349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
333449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
333549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
333675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
333749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CSYMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A,
333849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, Float2 beta, sp<Allocation> C);
3339729b6fe58aff47c4f666b22bbb7a6d6114ddefa9Tim Murray
334075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
334149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZSYMM performs one of the matrix-matrix operations
334249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
334375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
334449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d51/zsymm_8f.html
334575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
334649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
334749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
334849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
334949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
335049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
335149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
335249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
335375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
335449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZSYMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A,
335549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                      sp<Allocation> B, Double2 beta, sp<Allocation> C);
335649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
335775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
335849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYRK performs one of the symmetric rank k operations
335949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
336075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
336149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d0/d40/ssyrk_8f.html
336275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
336349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
336449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
336549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
336649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
336749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
336849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
336975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
337049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha,
337149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, float beta, sp<Allocation> C);
337249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
337375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
337449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYRK performs one of the symmetric rank k operations
337549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
337675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
337749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f.html
337875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
337949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
338049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
338149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
338249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
338349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
338449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
338575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
338649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha,
338749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, double beta, sp<Allocation> C);
338849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
338975e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
339049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CSYRK performs one of the symmetric rank k operations
339149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
339275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
339349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d6a/csyrk_8f.html
339475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
339549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
339649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
339749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
339849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
339949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
340049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
340175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
340249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha,
340349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, Float2 beta, sp<Allocation> C);
340449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
340575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
340649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZSYRK performs one of the symmetric rank k operations
340749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**T + beta*C   or   C := alpha*A**T*A + beta*C
340875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
340949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d54/zsyrk_8f.html
341075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
341149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
341249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
341349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
341449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
341549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
341649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
341775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
341849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZSYRK(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha,
341949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> A, Double2 beta, sp<Allocation> C);
342049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
342175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
342249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * SSYR2K performs one of the symmetric rank 2k operations
342349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
342475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
342549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d3d/ssyr2k_8f.html
342675e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
342749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
342849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
342949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
343049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
343149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
343249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
343349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32}.
343475e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
343549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void SSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha,
343649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> A, sp<Allocation> B, float beta, sp<Allocation> C);
343749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
343875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
343949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DSYR2K performs one of the symmetric rank 2k operations
344049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
344175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
344249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d1/dec/dsyr2k_8f.html
344375e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
344449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
344549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
344649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
344749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
344849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
344949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
345049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64}.
345175e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
345249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha,
345349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> A, sp<Allocation> B, double beta, sp<Allocation> C);
345449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
345575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
345649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CSYR2K performs one of the symmetric rank 2k operations
345749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
345875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
345949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d7e/csyr2k_8f.html
346075e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
346149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
346249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
346349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
346449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
346549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
346649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
346749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
346875e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
346949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha,
347049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> A, sp<Allocation> B, Float2 beta, sp<Allocation> C);
347149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
347275e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray    /**
347349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZSYR2K performs one of the symmetric rank 2k operations
347449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B**T + alpha*B*A**T + beta*C   or   C := alpha*A**T*B + alpha*B**T*A + beta*C
347575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
347649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d20/zsyr2k_8f.html
347775e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     *
347849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
347949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
348049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
348149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
348249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
348349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
348449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
348575e877d157f9429eb6d8fb1b09c75c5472db161aTim Murray     */
348649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZSYR2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha,
348749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> A, sp<Allocation> B, Double2 beta, sp<Allocation> C);
3488d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
348949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
349049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STRMM performs one of the matrix-matrix operations
349149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
349249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T
349349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
349449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/df/d01/strmm_8f.html
349549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
349649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
349749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
349849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
349949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
350049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
350149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
350249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
350349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
350449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA,
350549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               RsBlasDiag Diag, float alpha, sp<Allocation> A, sp<Allocation> B);
3506d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
350749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
350849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTRMM performs one of the matrix-matrix operations
350949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
351049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T
351149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
351249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/dd/d19/dtrmm_8f.html
351349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
351449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
351549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
351649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
351749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
351849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
351949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
352049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
352149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
352249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
352349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double alpha, sp<Allocation> A, sp<Allocation> B);
3524d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
352549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
352649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTRMM performs one of the matrix-matrix operations
352749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
352849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
352949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
353049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d4/d9b/ctrmm_8f.html
353149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
353249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
353349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
353449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
353549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
353649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
353749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
353849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
353949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
354049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
354149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Float2 alpha, sp<Allocation> A, sp<Allocation> B);
3542d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
354349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
354449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTRMM performs one of the matrix-matrix operations
354549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * B := alpha*op(A)*B   or   B := alpha*B*op(A)
354649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
354749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
354849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/de1/ztrmm_8f.html
354949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
355049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
355149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
355249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
355349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
355449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
355549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
355649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
355749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
355849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTRMM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
355949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Double2 alpha, sp<Allocation> A, sp<Allocation> B);
3560d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
356149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
356249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * STRSM solves one of the matrix equations
356349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
356449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T
356549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
356649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d2/d8b/strsm_8f.html
356749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
356849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
356949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
357049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
357149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
357249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
357349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32}.
357449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32}.
357549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
357649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void STRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
357749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               float alpha, sp<Allocation> A, sp<Allocation> B);
3578d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
357949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
358049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * DTRSM solves one of the matrix equations
358149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
358249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T
358349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
358449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/da7/dtrsm_8f.html
358549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
358649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
358749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
358849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
358949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
359049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
359149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64}.
359249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64}.
359349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
359449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void DTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
359549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double alpha, sp<Allocation> A, sp<Allocation> B);
3596d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
359749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
359849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CTRSM solves one of the matrix equations
359949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
360049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
360149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
360249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/de/d30/ctrsm_8f.html
360349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
360449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
360549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
360649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
360749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
360849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
360949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
361049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
361149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
361249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
361349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Float2 alpha, sp<Allocation> A, sp<Allocation> B);
3614d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
361549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
361649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZTRSM solves one of the matrix equations
361749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A)*X := alpha*B   or   X*op(A) := alpha*B
361849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * op(A) is one of  op(A) = A  or  op(A) = A**T  or  op(A) = A**H
361949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
362049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d1/d39/ztrsm_8f.html
362149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
362249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
362349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether matrix A is upper or lower triangular.
362449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param TransA The type of transpose applied to matrix A.
362549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Diag Specifies whether or not A is unit triangular.
362649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
362749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
362849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
362949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
363049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZTRSM(RsBlasSide Side, RsBlasUplo Uplo, RsBlasTranspose TransA, RsBlasDiag Diag,
363149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               Double2 alpha, sp<Allocation> A, sp<Allocation> B);
3632d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
363349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
363449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHEMM performs one of the matrix-matrix operations
363549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
363649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
363749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d3/d66/chemm_8f.html
363849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
363949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
364049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
364149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
364249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
364349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
364449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
364549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
364649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
364749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHEMM(RsBlasSide Side, RsBlasUplo Uplo, Float2 alpha, sp<Allocation> A,
364849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> B, Float2 beta, sp<Allocation> C);
3649d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
365049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
365149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHEMM performs one of the matrix-matrix operations
365249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*B + beta*C   or   C := alpha*B*A + beta*C
365349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
365449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d6/d3e/zhemm_8f.html
365549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
365649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Side Specifies whether the symmetric matrix A appears on the left or right.
365749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part is to be referenced.
365849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
365949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
366049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
366149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
366249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
366349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
366449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHEMM(RsBlasSide Side, RsBlasUplo Uplo, Double2 alpha, sp<Allocation> A,
366549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               sp<Allocation> B, Double2 beta, sp<Allocation> C);
3666d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
366749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
366849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHERK performs one of the hermitian rank k operations
366949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
367049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
367149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d8/d52/cherk_8f.html
367249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
367349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
367449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
367549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
367649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
367749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
367849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
367949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
368049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, float alpha, sp<Allocation> A,
368149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               float beta, sp<Allocation> C);
3682d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
368349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
368449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHERK performs one of the hermitian rank k operations
368549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * C := alpha*A*A**H + beta*C   or   C := alpha*A**H*A + beta*C
368649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
368749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d1/db1/zherk_8f.html
368849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
368949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
369049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
369149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
369249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
369349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
369449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
369549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
369649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHERK(RsBlasUplo Uplo, RsBlasTranspose Trans, double alpha, sp<Allocation> A,
369749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang               double beta, sp<Allocation> C);
3698d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
369949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
370049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * CHER2K performs one of the hermitian rank 2k operations
370149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 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
370249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
370349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d1/d82/cher2k_8f.html
370449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
370549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
370649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
370749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
370849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F32_2}.
370949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F32_2}.
371049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
371149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F32_2}.
371249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
371349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void CHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Float2 alpha, sp<Allocation> A,
371449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> B, float beta, sp<Allocation> C);
3715d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
371649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
371749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * ZHER2K performs one of the hermitian rank 2k operations
371849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 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
371949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
372049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Details: http://www.netlib.org/lapack/explore-html/d7/dfa/zher2k_8f.html
372149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
372249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Uplo Specifies whether the upper or lower triangular part of C is to be referenced.
372349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param Trans The type of transpose applied to the operation.
372449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param alpha The scalar alpha.
372549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#F64_2}.
372649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#F64_2}.
372749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param beta The scalar beta.
372849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#F64_2}.
372949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
373049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void ZHER2K(RsBlasUplo Uplo, RsBlasTranspose Trans, Double2 alpha, sp<Allocation> A,
373149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang                sp<Allocation> B, double beta, sp<Allocation> C);
373249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang
373349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
373449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 8-bit GEMM-like operation for neural networks: C = A * Transpose(B)
373549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Calculations are done in 1.10.21 fixed-point format for the final output,
373649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * just before there's a shift down to drop the fractional parts. The output
373749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * values are gated to 0 to 255 to fit in a byte, but the 10-bit format
373849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * gives some headroom to avoid wrapping around on small overflows.
373949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
374049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param A The input allocation contains matrix A, supported elements type: {Element#U8}.
374149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @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.
374249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param B The input allocation contains matrix B, supported elements type: {Element#U8}.
374349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @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.
374449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param C The input allocation contains matrix C, supported elements type: {Element#U8}.
374549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param c_offset The offset for all values in matrix C.
374649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param c_mult The multiplier for all values in matrix C, e.g C[i,j] = (C[i,j] + c_offset) * c_mult.
374749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     **/
374849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void BNNM(sp<Allocation> A, int a_offset, sp<Allocation> B, int b_offset, sp<Allocation> C,
374949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang              int c_offset, int c_mult);
3750d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
3751d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
375249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
375349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic kernel for blending two Allocations.
375449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
375549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicBlend : public ScriptIntrinsic {
375649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
375749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicBlend(sp<RS> rs, sp<const Element> e);
3758d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
375949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
376049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported Element types are U8_4.
376149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
376249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element
376349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsicBlend
376449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
376549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicBlend> create(sp<RS> rs, sp<const Element> e);
376649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
376749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * sets dst = {0, 0, 0, 0}
376849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
376949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
377049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
377149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachClear(sp<Allocation> in, sp<Allocation> out);
377249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
377349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = src
377449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
377549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
377649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
377749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSrc(sp<Allocation> in, sp<Allocation> out);
377849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
377949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = dst (NOP)
378049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
378149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
378249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
378349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachDst(sp<Allocation> in, sp<Allocation> out);
378449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
378549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = src + dst * (1.0 - src.a)
378649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
378749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
378849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
378949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSrcOver(sp<Allocation> in, sp<Allocation> out);
379049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
379149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = dst + src * (1.0 - dst.a)
379249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
379349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
379449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
379549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachDstOver(sp<Allocation> in, sp<Allocation> out);
379649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
379749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = src * dst.a
379849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
379949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
380049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
380149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSrcIn(sp<Allocation> in, sp<Allocation> out);
380249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
380349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = dst * src.a
380449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
380549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
380649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
380749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachDstIn(sp<Allocation> in, sp<Allocation> out);
380849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
380949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = src * (1.0 - dst.a)
381049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
381149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
381249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
381349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSrcOut(sp<Allocation> in, sp<Allocation> out);
381449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
381549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = dst * (1.0 - src.a)
381649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
381749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
381849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
381949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachDstOut(sp<Allocation> in, sp<Allocation> out);
382049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
382149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst.rgb = src.rgb * dst.a + (1.0 - src.a) * dst.rgb
382249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
382349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
382449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
382549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSrcAtop(sp<Allocation> in, sp<Allocation> out);
382649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
382749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst.rgb = dst.rgb * src.a + (1.0 - dst.a) * src.rgb
382849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
382949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
383049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
383149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachDstAtop(sp<Allocation> in, sp<Allocation> out);
383249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
383349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = {src.r ^ dst.r, src.g ^ dst.g, src.b ^ dst.b, src.a ^ dst.a}
383449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
383549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
383649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
383749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachXor(sp<Allocation> in, sp<Allocation> out);
383849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
383949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = src * dst
384049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
384149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
384249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
384349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachMultiply(sp<Allocation> in, sp<Allocation> out);
384449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
384549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = min(src + dst, 1.0)
384649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
384749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
384849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
384949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachAdd(sp<Allocation> in, sp<Allocation> out);
385049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
385149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets dst = max(dst - src, 0.0)
385249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
385349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
385449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
385549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEachSubtract(sp<Allocation> in, sp<Allocation> out);
3856d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
3857d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
385849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
385949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic Gausian blur filter. Applies a Gaussian blur of the specified
386049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * radius to all elements of an Allocation.
386149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
386249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicBlur : public ScriptIntrinsic {
386349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
386449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicBlur(sp<RS> rs, sp<const Element> e);
3865d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
386649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
386749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported Element types are U8 and U8_4.
386849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
386949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element
387049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsicBlur
387149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
387249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicBlur> create(sp<RS> rs, sp<const Element> e);
387349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
387449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets the input of the blur.
387549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
387649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
387749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setInput(sp<Allocation> in);
387849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
387949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Runs the intrinsic.
388049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] output Allocation
388149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
388249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> out);
388349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
388449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets the radius of the blur. The supported range is 0 < radius <= 25.
388549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] radius radius of the blur
388649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
388749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setRadius(float radius);
3888d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
3889d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
389049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
389149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for applying a color matrix to allocations. This has the
389249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * same effect as loading each element and converting it to a
389349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * F32_N, multiplying the result by the 4x4 color matrix
389449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * as performed by rsMatrixMultiply() and writing it to the output
389549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * after conversion back to U8_N or F32_N.
389649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
389749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicColorMatrix : public ScriptIntrinsic {
389849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
389949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicColorMatrix(sp<RS> rs, sp<const Element> e);
3900d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
390149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
390249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Creates a new intrinsic.
390349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
390449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsicColorMatrix
390549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
390649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicColorMatrix> create(sp<RS> rs);
390749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
390849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Applies the color matrix. Supported types are U8 and F32 with
390949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * vector lengths between 1 and 4.
391049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
391149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[out] out output Allocation
391249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
391349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> in, sp<Allocation> out);
391449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
391549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the value to be added after the color matrix has been
391649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * applied. The default value is {0, 0, 0, 0}.
391749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] add float[4] of values
391849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
391949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setAdd(float* add);
3920d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
392149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
392249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the color matrix which will be applied to each cell of the
392349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * image. The alpha channel will be copied.
392449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
392549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] m float[9] of values
392649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
392749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setColorMatrix3(float* m);
392849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
392949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the color matrix which will be applied to each cell of the
393049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * image.
393149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
393249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] m float[16] of values
393349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
393449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setColorMatrix4(float* m);
393549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
393649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set a color matrix to convert from RGB to luminance. The alpha
393749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * channel will be a copy.
393849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
393949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setGreyscale();
394049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
394149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the matrix to convert from RGB to YUV with a direct copy of
394249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * the 4th channel.
394349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
394449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setRGBtoYUV();
394549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
394649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the matrix to convert from YUV to RGB with a direct copy of
394749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * the 4th channel.
394849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
394949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setYUVtoRGB();
3950d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
3951d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
395249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
395349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for applying a 3x3 convolve to an allocation.
395449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
395549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicConvolve3x3 : public ScriptIntrinsic {
395649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
395749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicConvolve3x3(sp<RS> rs, sp<const Element> e);
3958d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
395949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
396049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported types U8 and F32 with vector lengths between 1 and
396149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 4. The default convolution kernel is the identity.
396249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
396349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element
396449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsicConvolve3x3
396549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
396649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicConvolve3x3> create(sp<RS> rs, sp<const Element> e);
396749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
396849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets input for intrinsic.
396949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
397049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
397149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setInput(sp<Allocation> in);
397249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
397349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Launches the intrinsic.
397449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
397549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
397649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> out);
397749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
397849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets convolution kernel.
397949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] v float[9] of values
398049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
398149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setCoefficients(float* v);
3982d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
3983d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
398449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
398549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for applying a 5x5 convolve to an allocation.
398649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
398749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicConvolve5x5 : public ScriptIntrinsic {
398849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
398949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicConvolve5x5(sp<RS> rs, sp<const Element> e);
3990d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
399149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
399249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported types U8 and F32 with vector lengths between 1 and
399349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 4. The default convolution kernel is the identity.
399449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
399549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element
399649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsicConvolve5x5
399749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
399849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicConvolve5x5> create(sp<RS> rs, sp<const Element> e);
399949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
400049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets input for intrinsic.
400149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] in input Allocation
400249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
400349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setInput(sp<Allocation> in);
400449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
400549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Launches the intrinsic.
400649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] out output Allocation
400749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
400849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> out);
400949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
401049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets convolution kernel.
401149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] v float[25] of values
401249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
401349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setCoefficients(float* v);
4014d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4015d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
401649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
401749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for computing a histogram.
401849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
401949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicHistogram : public ScriptIntrinsic {
402049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
402149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicHistogram(sp<RS> rs, sp<const Element> e);
402249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<Allocation> mOut;
4023d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
402449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
402549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Create an intrinsic for calculating the histogram of an uchar
402649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * or uchar4 image.
402749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
402849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported elements types are U8_4, U8_3, U8_2, and U8.
402949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
403049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs The RenderScript context
403149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element type for inputs
403249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
403349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return ScriptIntrinsicHistogram
403449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
403549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicHistogram> create(sp<RS> rs, sp<const Element> e);
403649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
403749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the output of the histogram.  32 bit integer types are
403849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * supported.
403949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
404049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] aout The output allocation
404149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
404249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setOutput(sp<Allocation> aout);
404349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
404449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the coefficients used for the dot product calculation. The
404549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * default is {0.299f, 0.587f, 0.114f, 0.f}.
404649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
404749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Coefficients must be >= 0 and sum to 1.0 or less.
404849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
404949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] r Red coefficient
405049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] g Green coefficient
405149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] b Blue coefficient
405249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] a Alpha coefficient
405349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
405449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setDotCoefficients(float r, float g, float b, float a);
405549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
405649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Process an input buffer and place the histogram into the output
405749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * allocation. The output allocation may be a narrower vector size
405849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * than the input. In this case the vector size of the output is
405949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * used to determine how many of the input channels are used in
406049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * the computation. This is useful if you have an RGBA input
406149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * buffer but only want the histogram for RGB.
406249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
406349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 1D and 2D input allocations are supported.
406449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
406549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] ain The input image
406649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
406749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> ain);
406849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
406949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Process an input buffer and place the histogram into the output
407049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * allocation. The dot product of the input channel and the
407149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * coefficients from 'setDotCoefficients' are used to calculate
407249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * the output values.
407349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
407449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * 1D and 2D input allocations are supported.
407549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
407649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param ain The input image
407749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
407849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach_dot(sp<Allocation> ain);
4079d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4080d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
408149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
408249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for applying a per-channel lookup table. Each channel of
408349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * the input has an independant lookup table. The tables are 256
408449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * entries in size and can cover the full value range of U8_4.
408549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang **/
408649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicLUT : public ScriptIntrinsic {
408749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
408849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<Allocation> LUT;
408949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    bool mDirty;
409049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    unsigned char mCache[1024];
409149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setTable(unsigned int offset, unsigned char base, unsigned int length, unsigned char* lutValues);
409249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicLUT(sp<RS> rs, sp<const Element> e);
4093d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
4094d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
409549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
409649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported elements types are U8_4.
409749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
409849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * The defaults tables are identity.
409949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
410049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs The RenderScript context
410149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element type for intputs and outputs
410249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
410349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return ScriptIntrinsicLUT
410449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
410549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicLUT> create(sp<RS> rs, sp<const Element> e);
410649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
410749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Invoke the kernel and apply the lookup to each cell of ain and
410849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * copy to aout.
410949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
411049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] ain Input allocation
411149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] aout Output allocation
411249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
411349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> ain, sp<Allocation> aout);
411449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
411549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets entries in LUT for the red channel.
411649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] base base of region to update
411749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] length length of region to update
411849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] lutValues LUT values to use
411949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
412049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setRed(unsigned char base, unsigned int length, unsigned char* lutValues);
412149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
412249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets entries in LUT for the green channel.
412349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] base base of region to update
412449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] length length of region to update
412549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] lutValues LUT values to use
412649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
412749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setGreen(unsigned char base, unsigned int length, unsigned char* lutValues);
412849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
412949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets entries in LUT for the blue channel.
413049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] base base of region to update
413149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] length length of region to update
413249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] lutValues LUT values to use
413349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
413449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setBlue(unsigned char base, unsigned int length, unsigned char* lutValues);
413549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
413649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Sets entries in LUT for the alpha channel.
413749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] base base of region to update
413849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] length length of region to update
413949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] lutValues LUT values to use
414049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
414149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setAlpha(unsigned char base, unsigned int length, unsigned char* lutValues);
414249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    virtual ~ScriptIntrinsicLUT();
4143d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4144d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
414549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
414649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for performing a resize of a 2D allocation.
414749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
414849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicResize : public ScriptIntrinsic {
414949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
415049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    sp<Allocation> mInput;
415149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicResize(sp<RS> rs, sp<const Element> e);
4152d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
415349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
415449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported Element types are U8_4. Default lookup table is identity.
415549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
415649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element
415749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return new ScriptIntrinsic
415849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
415949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicResize> create(sp<RS> rs);
4160d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
416149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
416249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Resize copy the input allocation to the output specified. The
416349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Allocation is rescaled if necessary using bi-cubic
416449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * interpolation.
416549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] ain input Allocation
416649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] aout output Allocation
416749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
416849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach_bicubic(sp<Allocation> aout);
4169d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
417049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
417149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the input of the resize.
417249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] lut new lookup table
417349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
417449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setInput(sp<Allocation> ain);
4175d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4176d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
417749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
417849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Intrinsic for converting an Android YUV buffer to RGB.
417949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang *
418049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * The input allocation should be supplied in a supported YUV format
418149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * as a YUV element Allocation. The output is RGBA; the alpha channel
418249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * will be set to 255.
418349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang */
418449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wangclass ScriptIntrinsicYuvToRGB : public ScriptIntrinsic {
418549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
418649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    ScriptIntrinsicYuvToRGB(sp<RS> rs, sp<const Element> e);
4187d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
418849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
418949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Create an intrinsic for converting YUV to RGB.
419049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
419149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Supported elements types are U8_4.
419249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
419349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs The RenderScript context
419449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] e Element type for output
419549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
419649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return ScriptIntrinsicYuvToRGB
419749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
419849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<ScriptIntrinsicYuvToRGB> create(sp<RS> rs, sp<const Element> e);
419949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
420049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Set the input YUV allocation.
420149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
420249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] ain The input allocation.
420349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
420449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void setInput(sp<Allocation> in);
4205d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
420649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
420749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Convert the image to RGB.
420849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
420949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] aout Output allocation. Must match creation element
421049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *                 type.
421149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
421249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    void forEach(sp<Allocation> out);
4213d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
4214d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4215d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
421649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang/**
421749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Sampler object that defines how Allocations can be read as textures
421849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * within a kernel. Samplers are used in conjunction with the rsSample
421949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * runtime function to return values from normalized coordinates.
422049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang *
422149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Any Allocation used with a Sampler must have been created with
422249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE; using a Sampler on an
422349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * Allocation that was not created with
422449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang * RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE is undefined.
422549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang **/
422649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang class Sampler : public BaseObj {
422749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang private:
422849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    Sampler(sp<RS> rs, void* id);
422949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    Sampler(sp<RS> rs, void* id, RsSamplerValue min, RsSamplerValue mag,
423049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang            RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
423149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue mMin;
423249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue mMag;
423349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue mWrapS;
423449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue mWrapT;
423549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    float mAniso;
4236d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
4237d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines public:
423849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
423949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Creates a non-standard Sampler.
424049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] rs RenderScript context
424149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] min minification
424249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] mag magnification
424349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] wrapS S wrapping mode
424449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] wrapT T wrapping mode
424549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param[in] anisotropy anisotropy setting
424649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
424749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<Sampler> create(sp<RS> rs, RsSamplerValue min, RsSamplerValue mag, RsSamplerValue wrapS, RsSamplerValue wrapT, float anisotropy);
4248d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
424949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
425049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return minification setting for the sampler
425149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
425249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue getMinification();
425349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
425449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return magnification setting for the sampler
425549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
425649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue getMagnification();
425749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
425849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return S wrapping mode for the sampler
425949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
426049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue getWrapS();
426149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
426249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return T wrapping mode for the sampler
426349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
426449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    RsSamplerValue getWrapT();
426549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
426649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return anisotropy setting for the sampler
426749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
426849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    float getAnisotropy();
4269d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
427049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
427149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to nearest and wrap modes set to
427249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * clamp.
427349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
427449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
427549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
427649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
427749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
427849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> CLAMP_NEAREST(sp<RS> rs);
427949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
428049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to linear and wrap modes set to
428149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * clamp.
428249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
428349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
428449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
428549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
428649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
428749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> CLAMP_LINEAR(sp<RS> rs);
428849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
428949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with mag set to linear, min linear mipmap linear, and
429049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * wrap modes set to clamp.
429149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
429249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
429349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
429449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
429549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
429649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> CLAMP_LINEAR_MIP_LINEAR(sp<RS> rs);
429749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
429849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to nearest and wrap modes set to
429949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * wrap.
430049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
430149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
430249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
430349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
430449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
430549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> WRAP_NEAREST(sp<RS> rs);
430649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
430749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to linear and wrap modes set to
430849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * wrap.
430949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
431049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
431149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
431249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
431349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
431449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> WRAP_LINEAR(sp<RS> rs);
431549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
431649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with mag set to linear, min linear mipmap linear, and
431749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * wrap modes set to wrap.
431849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
431949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
432049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
432149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
432249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
432349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> WRAP_LINEAR_MIP_LINEAR(sp<RS> rs);
432449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
432549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to nearest and wrap modes set to
432649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * mirrored repeat.
432749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
432849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
432949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
433049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
433149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
433249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> MIRRORED_REPEAT_NEAREST(sp<RS> rs);
433349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
433449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to linear and wrap modes set to
433549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * mirrored repeat.
433649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
433749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
433849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
433949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
434049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
434149b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> MIRRORED_REPEAT_LINEAR(sp<RS> rs);
434249b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    /**
434349b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * Retrieve a sampler with min and mag set to linear and wrap modes set to
434449b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * mirrored repeat.
434549b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
434649b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @param rs Context to which the sampler will belong.
434749b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     *
434849b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     * @return Sampler
434949b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang     */
435049b1226e8399f2ad4a9fd4482ece95dab2ad53b8Miao Wang    static sp<const Sampler> MIRRORED_REPEAT_LINEAR_MIP_LINEAR(sp<RS> rs);
4351d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
4352d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines};
4353d10412f903f2aab730fa9bcbead471db4d7c2393Stephen Hines
435484bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray}
43557f0d56899840f071c81bbbcbebfbd880ac31c043Tim Murray
435684bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray}
435784bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray
435884bf2b877024aaa154b66e0f2338d54bdabd855aTim Murray#endif
4359