DSPLIB User Guide
DSPLIB_cholesky.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_cholesky_priv.h"
24 
26 {
27  int32_t privBufSize = sizeof(DSPLIB_cholesky_PrivArgs);
28  return privBufSize;
29 }
30 
32  const DSPLIB_bufParams2D_t *bufParamsIn,
33  const DSPLIB_bufParams2D_t *bufParamsOut,
34  const DSPLIB_cholesky_InitArgs *pKerInitArgs)
35 {
36 
37  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
39  if (handle == NULL) {
40  status = DSPLIB_ERR_NULL_POINTER;
41  DSPLIB_DEBUGPRINTFN(0, "NULL pointer status: %d\n", status);
42  }
43 
44  if (status == DSPLIB_SUCCESS) {
45  if ((bufParamsIn->data_type != DSPLIB_FLOAT32) && (bufParamsIn->data_type != DSPLIB_FLOAT64)) {
46  status = DSPLIB_ERR_INVALID_TYPE;
47  DSPLIB_DEBUGPRINTFN(0, "Invalid type status: %d\n", status);
48  }
49  else if ((bufParamsIn->data_type != bufParamsOut->data_type)) {
50  status = DSPLIB_ERR_INVALID_TYPE;
51  DSPLIB_DEBUGPRINTFN(0, "Invalid type status: %d\n", status);
52  }
53  else {
54  /* Nothing to do here */
55  }
56  }
57  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
58  return status;
59 }
60 
62  DSPLIB_bufParams2D_t *bufParamsIn,
63  DSPLIB_bufParams2D_t *bufParamsOut,
64  const DSPLIB_cholesky_InitArgs *pKerInitArgs)
65 {
66 
67  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
69  DSPLIB_cholesky_PrivArgs *pKerPrivArgs = (DSPLIB_cholesky_PrivArgs *) handle;
70 
71  pKerPrivArgs->order = pKerInitArgs->order;
72  pKerPrivArgs->stride = pKerInitArgs->stride;
73  pKerPrivArgs->strideCn = pKerInitArgs->strideCn;
74  pKerPrivArgs->enableTest = pKerInitArgs->enableTest;
75 
77  0, "pKerPrivArgs->order: %d pKerPrivArgs->stride: %d pKerPrivArgs->strideCn: %d pKerPrivArgs->enableTest: %d\n",
78  pKerPrivArgs->order, pKerPrivArgs->stride, pKerPrivArgs->strideCn, pKerPrivArgs->enableTest);
79 
80  if (pKerInitArgs->funcStyle == DSPLIB_FUNCTION_NATC) {
81  if (bufParamsIn->data_type == DSPLIB_FLOAT32) {
83  }
84  else if (bufParamsIn->data_type == DSPLIB_FLOAT64)
85  {
86  pKerPrivArgs->execute =
88  }
89  else {
90  status = DSPLIB_ERR_INVALID_TYPE;
91 
92  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
93  }
94  }
95  else {
96  if (bufParamsIn->data_type == DSPLIB_FLOAT32) {
98  status = DSPLIB_cholesky_init_ci<float>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
99  }
100  else if (bufParamsIn->data_type == DSPLIB_FLOAT64)
101  {
103  status = DSPLIB_cholesky_init_ci<double>(handle, bufParamsIn, bufParamsOut, pKerInitArgs);
104  }
105  else {
106  status = DSPLIB_ERR_INVALID_TYPE;
107  DSPLIB_DEBUGPRINTFN(0, "status: %d\n", status);
108  }
109  }
110  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
111  return status;
112 }
113 
115  const void *restrict pInA,
116  const void *restrict pOutU,
117  const void *restrict pMul)
118 {
119  DSPLIB_STATUS status;
120 
121  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
122  if ((pInA == NULL) || (pOutU == NULL) || (pMul == NULL)) {
123  status = DSPLIB_ERR_NULL_POINTER;
124  DSPLIB_DEBUGPRINTFN(0, "NULL pointer status: %d\n", status);
125  }
126  else {
127  status = DSPLIB_SUCCESS;
128  }
129 
130  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
131  return status;
132 }
133 
135  void *restrict pInA,
136  void *restrict pOutU,
137  void *restrict pMul)
138 {
139  DSPLIB_STATUS status;
140 
141  DSPLIB_DEBUGPRINTFN(0, "%s\n", "Entering function");
142 
143  DSPLIB_cholesky_PrivArgs *pKerPrivArgs = (DSPLIB_cholesky_PrivArgs *) handle;
144 
145  DSPLIB_DEBUGPRINTFN(0,"pKerPrivArgs->enableTest: %d pKerPrivArgs->order: %d\n",
146  pKerPrivArgs->enableTest, pKerPrivArgs->order);
147  DSPLIB_DEBUGPRINTFN(0,"pKerPrivArgs->stride: %d pKerPrivArgs->strideCn: %d\n",
148  pKerPrivArgs->stride,pKerPrivArgs->strideCn);
149 
150 
151  status = pKerPrivArgs->execute(handle, pInA, pOutU, pMul);
152 
153  DSPLIB_DEBUGPRINTFN(0, "Exiting function with return status: %d\n", status);
154  return status;
155 }
156 
157 /* ======================================================================== */
158 /* End of file: DSPLIB_cholesky.cpp */
159 /* ======================================================================== */
template DSPLIB_STATUS DSPLIB_cholesky_exec_ci< float >(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pOutU, void *restrict pMulBuffer)
template DSPLIB_STATUS DSPLIB_cholesky_init_ci< float >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cholesky_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_init_ci< double >(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cholesky_InitArgs *pKerInitArgs)
template DSPLIB_STATUS DSPLIB_cholesky_exec_ci< double >(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pOutU, void *restrict pMulBuffer)
template DSPLIB_STATUS DSPLIB_cholesky_exec_cn< float >(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pOutU, void *restrict multiplierPtr)
template DSPLIB_STATUS DSPLIB_cholesky_exec_cn< double >(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pOutU, void *restrict multiplierPtr)
Header file for kernel's internal use. For the kernel's interface, please see DSPLIB_cholesky.
#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_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_cholesky_exec_checkParams(DSPLIB_kernelHandle handle, const void *restrict pInA, const void *restrict pOutU, const void *restrict pMul)
This function checks the validity of the parameters passed to DSPLIB_cholesky_exec function....
int32_t DSPLIB_cholesky_getHandleSize(DSPLIB_cholesky_InitArgs *pKerInitArgs)
This is a query function to calculate the size of internal handle.
DSPLIB_STATUS DSPLIB_cholesky_init_checkParams(DSPLIB_kernelHandle handle, const DSPLIB_bufParams2D_t *bufParamsIn, const DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cholesky_InitArgs *pKerInitArgs)
This function checks the validity of the parameters passed to DSPLIB_cholesky_init function....
DSPLIB_STATUS DSPLIB_cholesky_exec(DSPLIB_kernelHandle handle, void *restrict pInA, void *restrict pOutU, void *restrict pMul)
This function is the main kernel compute function.
DSPLIB_STATUS DSPLIB_cholesky_init(DSPLIB_kernelHandle handle, DSPLIB_bufParams2D_t *bufParamsIn, DSPLIB_bufParams2D_t *bufParamsOut, const DSPLIB_cholesky_InitArgs *pKerInitArgs)
This function should be called before the DSPLIB_cholesky_exec function is called....
A structure for a 2 dimensional buffer descriptor.
uint32_t data_type
Values are of type DSPLIB_data_type_e.
Structure containing the parameters to initialize the kernel.
int32_t strideCn
stride of output data in cn
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 enable Positive definiteness check.
int32_t order
order of input data
Structure that is reserved for internal use by the kernel.
int32_t order
Order of input buffer for different batches DSPLIB_cholesky_init that will be retrieved and used by D...
pFxnDSPLIB_cholesky_exec execute
Function pointer to point to the right execution variant between DSPLIB_cholesky_exec_cn and DSPLIB_c...