## Ultrasound Library - Level 1 (L1)
The level 1 of Vitis Ultrasound Library contains the aie kernels. For more details information, please reference to L1 User Guide in the document for usage and design information.
## Overview of APIs
The L1 APIs is a set of APIs which are created to create a closest mapping possible between *NumPy* and the *C++* SIMD APIs of the AI Engine. The APIs resulted are a more comprehensive and easy interface for the user to create its own application using numpy-like interfaces.
The APIs can be divided in two main groups:
1. Element-wise operations between vectors and matrices. Those operations varies between basic operations (i.e. sum, multiplication etc...) to more complex ones (i.e. reciprocal, sign etc...);
2. Vector managing and creation. Those operations are intended to be used by the user to create or modify the dimension of the vectorial operands. Two example of those operations are *Tile* and *Ones*.
Follow the details of L1 kernel available in the library:
### Kernel name: absV
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM>
void absV(adf::input_buffer<T>& __restrict in, adf::output_buffer<T>& __restrict out);
```
Element-Wise absolute values of a vector.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: elements of the vector to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: cosV
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM>
void cosV(adf::input_buffer<T>& __restrict in1, adf::output_buffer<T>& __restrict out);
```
Element-Wise cosine values of a vector. Elements must be expressed in radians with the range [0...2k$\pi$]
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: elements of the vector to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: diffMV
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM>
void diffMV(adf::input_buffer<T>& __restrict in1, adf::input_buffer<T>& __restrict in2, adf::output_buffer<T>& __restrict out);
```
Element-Wise difference between the of the row of a matrix and the values of a vector. The number of the column of the matrix and the entry of the vector must have the same size.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: elements of the first matrix to be passed to the kernel.
- `in2`: elements of the array to be passed to the kernel.
- `out`: elements of the result of the operation (matrix) to be passed from the kernel.
### Kernel name: diffSV
```c++
template<typename T, const unsigned int LEN, const unsigned int INCREMENT, const unsigned VECDIM>
void diffSV(adf::input_buffer<T>& __restrict in1, adf::input_buffer<T>& __restrict in2, adf::output_buffer<T>& __restrict out);
```
Element-Wise difference between a scalar and the values of a vector. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: scalar element to be passed to the kernel.
- `in2`: elements of the array to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: diffVS
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM>
void diffVS(adf::input_buffer<T>& __restrict in1, adf::input_buffer<T>& __restrict in2, adf::output_buffer<T>& __restrict out);
```
Element-Wise difference between the values of a vector and a scalar. For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: elements of the array to be passed to the kernel.
- `in2`: scalar element to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: divVS
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM>
void divVSSpeedOfSound(adf::input_buffer<T>& in1, adf::output_buffer<T>& out);
```
Element-Wise division between the values of a vector and a scalar (SpeedOfSound). For every iteration (expressed by `LEN`) we need to pass 4 times the scalar value to the stream of the scalar value.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- **Function params**:
- `in1`: elements of the array to be passed to the kernel.
- `in2`: scalar element to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: equalS
```c++
template<typename T, const unsigned LEN, const unsigned INCREMENT, const unsigned VECDIM, const unsigned SCALAR>
void equalS(adf::input_buffer<T>& __restrict in1, adf::output_buffer<T>& __restrict out);
```
Check whether the element of an array are equal to a specific number. An array of 0s or 1s is returned. 1 means that the element at that specific position is equal to the scalar, otherwise 0 is returned.
- **Template params**:
- `T`: type of the operation;
- `LEN`: number of elements to be processed in the kernel per iteration;
- `INCREMENT`: parameter which indicates how much iterations have been performed by the SIMD with respect to the intended total length;
- `VECDIM`: dimension of the SIMD to be performed. Addressed in the Xilinx UG1076, it depends on the type chosen;
- `SCALAR`: scalar to which the elements of the array are compared to;
- **Function params**:
- `in1`: elements of the vector to be passed to the kernel.
- `out`: elements of the result of the operation (vector) to be passed from the kernel.
### Kernel name: lessOrEqualThanS
```c++
templat