v?linearfrac
Perform linear fraction transformation of vectors src1 and src2 with scalar parameters scale and shift.

Interface Definition
C interface:
void vslinearfrac(const int len, const float *src1, const float *src2, const float scalea, const float shifta, const float scaleb, const float shiftb, float *dst);
void vdlinearfrac(const int len, const double *src1, const double *src2, const double scalea, const double shifta, const double scaleb, const double shiftb, double *dst);
Parameters
|
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
|
len |
Integer |
Number of elements in the input vector. If len ≤ 0, an invalid parameter error is reported and the function returns. |
Input |
|
src1 |
|
Input vector src1 with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
|
src2 |
|
Input vector src2 with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
|
scalea |
|
Scaling constant of src1. |
Input |
|
shifta |
|
Shift constant of src1. |
Input |
|
scaleb |
|
Scaling constant of src2. |
Input |
|
shiftb |
|
Shift constant of src2. |
Input |
|
dst |
|
Output vector dst with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Output |
Return Value
The result of the linear fraction transformation
is returned.
Dependencies
C: "kvml.h"
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#define N 4 const float src1[N] = {-8.0f, 25.0f, +INFINITY, -0.0f}; const float src2[N] = {6.2f, -4.3f, -192.4, -3.1f}; const float scalea = 0.2f; const float shifta = 1.0f; const float scaleb = -0.2f; const float shiftb = -1.1f; float dst[N] = {0}; vslinearfrac(N, src1, src2, scalea, shifta, scaleb, shiftb, dst); printFArr("input1:", N, src1); printFArr("input2:", N, src2); printf("scalea : %.3f, shifta : %.3f, scaleb : %.3f, shiftb : %.3f\n", scalea, shifta, scaleb, shiftb); printFArr("output:", N, dst); /** * input1: -8.000 25.000 inf -0.000 * input2: 6.200 -4.300 -192.400 -3.100 * scalea : 0.200, shifta : 1.000, scaleb : -0.200, shiftb : -1.100 * output: 0.256 -25.000 inf -2.083 */ |