DSPLIB User Guide
DSPLIB_lud_inv.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 
23 #include "DSPLIB_lud_inv_priv.h"
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_lud_inv_PrivArgs);
28 
29  DSPLIB_DEBUGPRINTFN(0, "privBufSize: %d\n", privBufSize);
30 
31  return privBufSize;
32 }
33 
35  const DSPLIB_bufParams2D_t * bufParamsP,
36  const DSPLIB_bufParams2D_t * bufParamsL,
37  const DSPLIB_bufParams2D_t * bufParamsU,
38  const DSPLIB_bufParams2D_t * bufParamsinvA,
39  const DSPLIB_lud_invInitArgs *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 (((bufParamsL->data_type != DSPLIB_FLOAT32) && (bufParamsL->data_type != DSPLIB_FLOAT64)) ||
53  ((bufParamsU->data_type != DSPLIB_FLOAT32) && (bufParamsU->data_type != DSPLIB_FLOAT64)) ||
54  ((bufParamsP->data_type != DSPLIB_UINT16))) {
55  status = DSPLIB_ERR_INVALID_TYPE;
56  }
57  else if (bufParamsL->data_type != bufParamsinvA->data_type || bufParamsU->data_type != bufParamsinvA->data_type) {
58  status = DSPLIB_ERR_INVALID_TYPE;
59  }
60 
61  else if (bufParamsL->dim_x != bufParamsL->dim_y) {
63  }
64  else if (bufParamsU->dim_x != bufParamsU->dim_y) {
66  }
67  else if (bufParamsP->dim_x != bufParamsP->dim_y) {
69  }
70  else {
71  /* Do nothing */
72  }
73  }
74 
75  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
76 
77  return status;
78 }
79 
81  void *restrict pP,
82  void *restrict pL,
83  void *restrict pU,
84  void *restrict pinvA,
85  void *restrict pScratch)
86 {
87  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
88 
89  DSPLIB_STATUS status;
90 
91  if ((pP == NULL) || (pL == NULL) || (pU == NULL) || (pinvA == NULL) || (pScratch == NULL)) {
92  status = DSPLIB_ERR_NULL_POINTER;
93  }
94  else {
95  status = DSPLIB_SUCCESS;
96  }
97 
98  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
99 
100  return status;
101 }
102 
104  const DSPLIB_bufParams2D_t * bufParamsP,
105  const DSPLIB_bufParams2D_t * bufParamsL,
106  const DSPLIB_bufParams2D_t * bufParamsU,
107  const DSPLIB_bufParams2D_t * bufParamsinvA,
108  const DSPLIB_lud_invInitArgs *pKerInitArgs)
109 {
110  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
111 
112  DSPLIB_STATUS status = DSPLIB_SUCCESS;
113  DSPLIB_lud_inv_PrivArgs *pKerPrivArgs = (DSPLIB_lud_inv_PrivArgs *) handle;
114 
115  pKerPrivArgs->order = bufParamsL->dim_x;
116  pKerPrivArgs->strideOrder = bufParamsL->stride_y;
117  pKerPrivArgs->strideP = bufParamsP->stride_y;
118 
119  DSPLIB_DEBUGPRINTFN(0, "pKerInitArgs->funcStyle: %d bufParamsinvA->data_type: %d\n", pKerInitArgs->funcStyle,
120  bufParamsinvA->data_type);
121 
122  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
123  if ((bufParamsL->data_type == DSPLIB_FLOAT32) || (bufParamsU->data_type == DSPLIB_FLOAT32)) {
124  pKerPrivArgs->execute = DSPLIB_lud_inv_exec_cn<float>;
125  status = DSPLIB_lud_inv_init_cn(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsinvA, pKerInitArgs);
126  }
127  else if ((bufParamsL->data_type == DSPLIB_FLOAT64) || (bufParamsU->data_type == DSPLIB_FLOAT64)) {
128  pKerPrivArgs->execute = DSPLIB_lud_inv_exec_cn<double>;
129  status = DSPLIB_lud_inv_init_cn(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsinvA, pKerInitArgs);
130  }
131  else {
132  status = DSPLIB_ERR_INVALID_TYPE;
133  }
134  }
135  else {
136  if ((bufParamsL->data_type == DSPLIB_FLOAT32) || (bufParamsU->data_type == DSPLIB_FLOAT32)) {
137  pKerPrivArgs->execute = DSPLIB_lud_inv_exec_ci<float>;
138  status =
139  DSPLIB_lud_inv_init_ci<float>(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsinvA, pKerInitArgs);
140  }
141  else if ((bufParamsL->data_type == DSPLIB_FLOAT64) || (bufParamsU->data_type == DSPLIB_FLOAT64)) {
142  pKerPrivArgs->execute = DSPLIB_lud_inv_exec_ci<double>;
143  status =
144  DSPLIB_lud_inv_init_ci<double>(handle, bufParamsP, bufParamsL, bufParamsU, bufParamsinvA, pKerInitArgs);
145  }
146  else {
147  status = DSPLIB_ERR_INVALID_TYPE;
148  }
149  }
150  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
151 
152  return status;
153 }
154 
156  void *restrict pP,
157  void *restrict pL,
158  void *restrict pU,
159  void *restrict pinvA,
160  void *restrict pScratch)
161 {
162  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
163 
164  DSPLIB_STATUS status;
165 
166  DSPLIB_lud_inv_PrivArgs *pKerPrivArgs = (DSPLIB_lud_inv_PrivArgs *) handle;
167 
168  DSPLIB_DEBUGPRINTFN(0, "order: %d\n", pKerPrivArgs->order);
169 
170  status = pKerPrivArgs->execute(handle, pP, pL, pU, pinvA, pScratch);
171 
172  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
173 
174  return status;
175 }
176 
177 /* ======================================================================== */
178 /* End of file: DSPLIB_lud_inv.cpp */
179 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_lud_inv_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams2D_t *bufParamsinvA, const DSPLIB_lud_invInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_lud_inv_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinvA, void *restrict pStratch)
template DSPLIB_STATUS DSPLIB_lud_inv_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinvA, void *restrict pStratch)
template DSPLIB_STATUS DSPLIB_lud_inv_init_ci< double >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams2D_t *bufParamsinvA, const DSPLIB_lud_invInitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_lud_inv_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinv_A, void *restrict pStratch)
DSPLIB_STATUS DSPLIB_lud_inv_init_cn(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams2D_t *bufParamsinvA, const DSPLIB_lud_invInitArgs *pKerInitArgs)
This function is the initialization function for the natural C implementation of the kernel....
template DSPLIB_STATUS DSPLIB_lud_inv_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinv_A, void *restrict pStratch)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_lud_inv.
#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_UINT16
@ 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_lud_inv_exec_checkParams(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinvA, void *restrict pScratch)
This function checks the validity of the parameters passed to DSPLIB_lud_inv_exec function....
DSPLIB_STATUS DSPLIB_lud_inv_init(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams2D_t *bufParamsinvA, const DSPLIB_lud_invInitArgs *pKerInitArgs)
This function should be called before the DSPLIB_lud_inv_exec function is called. This function takes...
DSPLIB_STATUS DSPLIB_lud_inv_exec(DSPLIB_kernelHandle handle, void *restrict pP, void *restrict pL, void *restrict pU, void *restrict pinvA, void *restrict pScratch)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_lud_inv_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsP, const DSPLIB_bufParams2D_t *bufParamsL, const DSPLIB_bufParams2D_t *bufParamsU, const DSPLIB_bufParams2D_t *bufParamsinvA, const DSPLIB_lud_invInitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_lud_inv_init function....
int32_t DSPLIB_lud_inv_getHandleSize(DSPLIB_lud_invInitArgs *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.
pFxnDSPLIB_lud_inv_exec execute
Function pointer to point to the right execution variant between DSPLIB_lud_inv_exec_cn and DSPLIB_lu...
int32_t strideOrder
Stride between rows of input and output data matrix
int32_t order
Size of input buffer for different batches DSPLIB_lud_inv_init that will be retrieved and used by DSP...
int32_t strideP
Stride between rows of output data matrix P