DSPLIB User Guide
DSPLIB_qrd_inverse.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * *
3  * module name :DSPLIB *
4  * *
5  * module descripton :Digital Signal Processing Library module for C7x+MMA *
6  * *
7  * Copyright (C) 2017-2018 Texas Instruments Incorporated - https://www.ti.com/ *
8  * ALL RIGHTS RESERVED *
9  * *
10  ******************************************************************************/
11 
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_qrd_inverse_PrivArgs);
28 
29  DSPLIB_DEBUGPRINTFN(0, "privBufSize: %d\n", privBufSize);
30 
31  return privBufSize;
32 }
33 
35  DSPLIB_bufParams2D_t *bufParamsQ,
36  DSPLIB_bufParams2D_t *bufParamsR,
37  DSPLIB_bufParams2D_t *bufParamsInvA,
38  DSPLIB_bufParams2D_t *bufParamsInvAFinal,
39  const DSPLIB_qrdInvInitArgs *pKerInitArgs)
40 {
41  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering Function");
42 
44 
45  if (handle == NULL) {
46  status = DSPLIB_ERR_NULL_POINTER;
47  }
48 
49  if (status == DSPLIB_SUCCESS) {
50 
51  /* Condition change */
52  if (((bufParamsQ->data_type != DSPLIB_FLOAT32) && (bufParamsQ->data_type != DSPLIB_FLOAT64)) ||
53  ((bufParamsR->data_type != DSPLIB_FLOAT32) && (bufParamsR->data_type != DSPLIB_FLOAT64))) {
54  status = DSPLIB_ERR_INVALID_TYPE;
55  }
56  else if (bufParamsQ->data_type != bufParamsInvA->data_type || bufParamsR->data_type != bufParamsInvA->data_type) {
57  status = DSPLIB_ERR_INVALID_TYPE;
58  }
59 
60  else {
61  /* Do nothing */
62  }
63  }
64  if (status == DSPLIB_SUCCESS)
65 
66  {
67  if ((bufParamsR->dim_x != bufParamsR->dim_y) || (bufParamsQ->dim_x != bufParamsQ->dim_y)) {
69  }
70  }
71 
72  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
73 
74  return status;
75 }
76 
79  void *restrict pQ,
80  void *restrict pR,
81  void *restrict pInvA,
82  void *restrict pInvAScratch,
83  void *restrict pScratch)
84 {
85  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
86 
88 
89  if ((pQ == NULL) || (pR == NULL) || (pInvA == NULL) || (pInvAScratch == NULL) || (pScratch == NULL)) {
90  status = DSPLIB_ERR_NULL_POINTER;
91  }
92  else {
93  status = DSPLIB_SUCCESS;
94  }
95  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
96 
97  return status;
98 }
99 
101  DSPLIB_bufParams2D_t *bufParamsQ,
102  DSPLIB_bufParams2D_t *bufParamsR,
103  DSPLIB_bufParams2D_t *bufParamsInvA,
104  DSPLIB_bufParams2D_t *bufParamsInvAFinal,
105  const DSPLIB_qrdInvInitArgs *pKerInitArgs)
106 {
107  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
108 
109  DSPLIB_STATUS status = DSPLIB_SUCCESS;
110  DSPLIB_qrd_inverse_PrivArgs *pKerPrivArgs = (DSPLIB_qrd_inverse_PrivArgs *) handle;
111 
112  pKerPrivArgs->widthR = bufParamsR->dim_x;
113  pKerPrivArgs->heightR = bufParamsR->dim_y;
114  pKerPrivArgs->strideQ = bufParamsQ->stride_y;
115  pKerPrivArgs->strideR = bufParamsR->stride_y;
116  pKerPrivArgs->strideInvA = bufParamsInvA->stride_y;
117 
118  DSPLIB_DEBUGPRINTFN(0, "pKerInitArgs->funcStyle: %d bufParamsOut->data_type: %d\n", pKerInitArgs->funcStyle,
119  bufParamsInvA->data_type);
120 
121  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
122  if ((bufParamsQ->data_type == DSPLIB_FLOAT32) || (bufParamsR->data_type == DSPLIB_FLOAT32)) {
124  status = DSPLIB_qrd_inverse_init_cn<float>(handle, bufParamsQ, bufParamsR, bufParamsInvA, bufParamsInvAFinal,
125  pKerInitArgs);
126  }
127  else if ((bufParamsQ->data_type == DSPLIB_FLOAT64) || (bufParamsR->data_type == DSPLIB_FLOAT64)) {
129  status = DSPLIB_qrd_inverse_init_cn<double>(handle, bufParamsQ, bufParamsR, bufParamsInvA, bufParamsInvAFinal,
130  pKerInitArgs);
131  }
132 
133  else {
134  status = DSPLIB_ERR_INVALID_TYPE;
135  }
136  }
137  else {
138  if ((bufParamsQ->data_type == DSPLIB_FLOAT32) || (bufParamsR->data_type == DSPLIB_FLOAT32)) {
140  status = DSPLIB_qrd_inverse_init_ci<float>(handle, bufParamsQ, bufParamsR, bufParamsInvA, bufParamsInvAFinal,
141  pKerInitArgs);
142  }
143  else if ((bufParamsQ->data_type == DSPLIB_FLOAT64) || (bufParamsR->data_type == DSPLIB_FLOAT64)) {
145  status = DSPLIB_qrd_inverse_init_ci<double>(handle, bufParamsQ, bufParamsR, bufParamsInvA, bufParamsInvAFinal,
146  pKerInitArgs);
147  }
148  else {
149  status = DSPLIB_ERR_INVALID_TYPE;
150  }
151  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
152  }
153  return status;
154 }
155 
158  void *restrict pQ,
159  void *restrict pR,
160  void *restrict pInvA,
161  void *restrict pInvAScratch,
162  void *restrict pScratch)
163 {
164  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
165 
166  DSPLIB_STATUS status;
167 
168  DSPLIB_qrd_inverse_PrivArgs *pKerPrivArgs = (DSPLIB_qrd_inverse_PrivArgs *) handle;
169 
170  DSPLIB_DEBUGPRINTFN(0, "widthR: %d heightR: %d strideQ: %d strideR: %d strideInvA: %d\n", pKerPrivArgs->widthR,
171  pKerPrivArgs->heightR, pKerPrivArgs->strideQ, pKerPrivArgs->strideR, pKerPrivArgs->strideInvA);
172 
173  status = pKerPrivArgs->execute(handle, pQ, pR, pInvA, pInvAScratch, pScratch);
174 
175  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
176 
177  return status;
178 }
179 /* ======================================================================== */
180 /* End of file: DSPLIB_qrd_inverse.cpp */
181 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_qrd_inverse_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pInvScratch, void *restrict pScratch)
template DSPLIB_STATUS DSPLIB_qrd_inverse_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pInvScratch, void *restrict pScratch)
template DSPLIB_STATUS DSPLIB_qrd_inverse_init_ci< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_inverse_init_ci< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_inverse_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pLocalInvAScracth, void *restrict pScratch)
template DSPLIB_STATUS DSPLIB_qrd_inverse_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pLocalInvAScracth, void *restrict pScratch)
template DSPLIB_STATUS DSPLIB_qrd_inverse_init_cn< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_qrd_inverse_init_cn< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_qrd_inverse.
#define DSPLIB_DEBUGPRINTFN(N, fmt,...)
Definition: DSPLIB_types.h:83
DSPLIB_STATUS_NAME
The enumeration of all status codes.
Definition: DSPLIB_types.h:151
void * DSPLIB_kernelHandle
Handle type for DSPLIB operations.
Definition: DSPLIB_types.h:172
@ DSPLIB_FUNCTION_NATC
Definition: DSPLIB_types.h:176
@ DSPLIB_FLOAT32
@ DSPLIB_FLOAT64
@ DSPLIB_ERR_INVALID_DIMENSION
Definition: DSPLIB_types.h:156
@ DSPLIB_SUCCESS
Definition: DSPLIB_types.h:152
@ DSPLIB_ERR_NULL_POINTER
Definition: DSPLIB_types.h:157
@ DSPLIB_ERR_INVALID_TYPE
Definition: DSPLIB_types.h:155
DSPLIB_STATUS DSPLIB_qrd_inverse_init_checkParams(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_qrd_inverse_init function....
DSPLIB_STATUS DSPLIB_qrd_inverse_exec_checkParams(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pInvAScratch, void *restrict pScratch)
This function checks the validity of the parameters passed to DSPLIB_qrd_inverse_exec function....
DSPLIB_STATUS DSPLIB_qrd_inverse_exec(DSPLIB_kernelHandle handle, void *restrict pQ, void *restrict pR, void *restrict pInvA, void *restrict pInvAScratch, void *restrict pScratch)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_qrd_inverse_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsQ, DSPLIB_bufParams2D_t *bufParamsR, DSPLIB_bufParams2D_t *bufParamsInvA, DSPLIB_bufParams2D_t *bufParamsInvAFinal, const DSPLIB_qrdInvInitArgs *pKerInitArgs)
This function should be called before the DSPLIB_qrd_inverse_exec function is called....
int32_t DSPLIB_qrd_inverse_getHandleSize(DSPLIB_qrdInvInitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
int32_t stride_y
Stride in Y dimension in bytes.
uint32_t dim_x
Width of buffer in X dimension in elements.
uint32_t dim_y
Height of buffer in Y dimension in elements.
Structure containing the parameters to initialize the kernel.
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
Structure that is reserved for internal use by the kernel.
uint32_t heightR
Height of input data matrix
int32_t strideR
Stride between rows of R output data matrix
uint32_t widthR
Size of input buffer for different batches DSPLIB_qrd_inverse_init that will be retrieved and used by...
int32_t strideInvA
Stride between rows of input data matrix
pFxnDSPLIB_qrd_inverse_exec execute
Function pointer to point to the right execution variant between DSPLIB_qrd_inverse_exec_cn and DSPLI...
int32_t strideQ
Stride between rows of Q output data matrix