DSPLIB User Guide
DSPLIB_cholesky_inplace.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_cholesky_inplace_PrivArgs);
28  return privBufSize;
29 }
30 
32  DSPLIB_bufParams2D_t *bufParamsA,
33  DSPLIB_bufParams1D_t *bufParamsMul,
34  const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
35 {
36  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
38  if (handle == NULL) {
39  status = DSPLIB_ERR_NULL_POINTER;
40  }
41 
42  if (status == DSPLIB_SUCCESS) {
43  if ((bufParamsA->data_type != DSPLIB_FLOAT32) && (bufParamsA->data_type != DSPLIB_FLOAT64)) {
44  status = DSPLIB_ERR_INVALID_TYPE;
45  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
46  }
47  else if (bufParamsA->dim_x != bufParamsA->dim_y) {
49  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
50  }
51  else if (bufParamsMul->dim_x != bufParamsA->dim_x) {
53  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
54  }
55  else {
56  /* Nothing to do here */
57  }
58  }
59 
60  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
61  return status;
62 }
63 
65  DSPLIB_bufParams2D_t *bufParamsA,
66  DSPLIB_bufParams1D_t *bufParamsMul,
67  const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
68 {
69  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
72 
73  pKerPrivArgs->order = pKerInitArgs->order;
74  pKerPrivArgs->stride = pKerInitArgs->stride;
75  pKerPrivArgs->enableTest = pKerInitArgs->enableTest;
76 
77  DSPLIB_DEBUGPRINTFN(0, "pKerPrivArgs->order: %d pKerPrivArgs->stride: %d pKerPrivArgs->enableTest: %d\n",
78  pKerPrivArgs->order, pKerPrivArgs->stride, pKerPrivArgs->enableTest);
79 
80  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
81  if (bufParamsA->data_type == DSPLIB_FLOAT32) {
83  }
84  else if (bufParamsA->data_type == DSPLIB_FLOAT64) {
86  }
87  else {
88  status = DSPLIB_ERR_INVALID_TYPE;
89  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
90  }
91  }
92  else {
93  if (bufParamsA->data_type == DSPLIB_FLOAT32) {
95  status = DSPLIB_cholesky_inplace_init_ci<float>(handle, bufParamsA, bufParamsMul, pKerInitArgs);
96  }
97  else if (bufParamsA->data_type == DSPLIB_FLOAT64)
98  {
100  status = DSPLIB_cholesky_inplace_init_ci<double>(handle, bufParamsA,
101  bufParamsMul, pKerInitArgs);
102  }
103  else {
104  status = DSPLIB_ERR_INVALID_TYPE;
105  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
106  }
107  }
108  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
109  return status;
110 }
111 
113 DSPLIB_cholesky_inplace_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pA, const void *restrict pMul)
114 {
115  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
116  DSPLIB_STATUS status;
117 
118  if ((pA == NULL) || (pMul == NULL)) {
119  status = DSPLIB_ERR_NULL_POINTER;
120  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
121  }
122  else {
123  status = DSPLIB_SUCCESS;
124  }
125 
126  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
127  return status;
128 }
129 
130 DSPLIB_STATUS DSPLIB_cholesky_inplace_exec(DSPLIB_kernelHandle handle, void *restrict pA, void *restrict pMul)
131 {
132  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
133  DSPLIB_STATUS status;
134 
136 
137  DSPLIB_DEBUGPRINTFN(0,"pKerPrivArgs->enableTest: %d pKerPrivArgs->order: %d\n",
138  pKerPrivArgs->enableTest, pKerPrivArgs->order);
139  DSPLIB_DEBUGPRINTFN(0,"pKerPrivArgs->stride: %d\n", pKerPrivArgs->stride);
140 
141  status = pKerPrivArgs->execute(handle, pA, pMul);
142 
143  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
144  return status;
145 }
146 /* ======================================================================== */
147 /* End of file: DSPLIB_cholesky_inplace.cpp */
148 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_cholesky_inplace_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pA, void *restrict pMul)
template DSPLIB_STATUS DSPLIB_cholesky_inplace_init_ci< double >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsA, DSPLIB_bufParams1D_t *bufParamsMul, const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_inplace_init_ci< float >(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsA, DSPLIB_bufParams1D_t *bufParamsMul, const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_inplace_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pA, void *restrict pMul)
template DSPLIB_STATUS DSPLIB_cholesky_inplace_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pMul)
template DSPLIB_STATUS DSPLIB_cholesky_inplace_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pA, void *restrict pMul)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_cholesky_inplace...
#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
int32_t DSPLIB_cholesky_inplace_getHandleSize(DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
DSPLIB_STATUS DSPLIB_cholesky_inplace_init_checkParams(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsA, DSPLIB_bufParams1D_t *bufParamsMul, const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_cholesky_inplace_init function....
DSPLIB_STATUS DSPLIB_cholesky_inplace_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsA, DSPLIB_bufParams1D_t *bufParamsMul, const DSPLIB_cholesky_inplace_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_cholesky_inplace_exec function is called....
DSPLIB_STATUS DSPLIB_cholesky_inplace_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pA, const void *restrict pMul)
This function checks the validity of the parameters passed to DSPLIB_cholesky_inplace_exec function....
DSPLIB_STATUS DSPLIB_cholesky_inplace_exec(DSPLIB_kernelHandle handle, void *restrict pA, void *restrict pMul)
This function is the main kernel compute function.
A structure for a 1 dimensional buffer descriptor.
uint32_t dim_x
Width of buffer in X dimension in elements.
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
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.
int32_t stride
stride of input/output data in ci
int8_t funcStyle
Variant of the function refer to DSPLIB_FUNCTION_STYLE
int32_t enableTest
flag to check for positive definiteness of input matrix
Structure that is reserved for internal use by the kernel.
int32_t order
Order of input buffer for different batches DSPLIB_cholesky_inplace_init that will be retrieved and u...
pFxnDSPLIB_cholesky_inplace_exec execute
Function pointer to point to the right execution variant between DSPLIB_cholesky_inplace_exec_cn and ...