Rate This Document
Findability
Accuracy
Completeness
Readability

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, the system displays a message indicating that the value of len is invalid.

Input

src1

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Input vector src1 with length len.

If the pointer is null, the system prompts a null pointer error.

Input

src2

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Input vector src2 with length len.

If the pointer is null, the system prompts a null pointer error.

Input

scalea

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Scaling constant of src1.

Input

shifta

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Shift constant of src1.

Input

scaleb

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Scaling constant of src2.

Input

shiftb

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Shift constant of src2.

Input

dst

  • Single-precision floating-point type for vslinearfrac
  • Double-precision floating-point type for vdlinearfrac

Output vector dst with length len.

If the pointer is null, the system prompts a null pointer error.

Output

Return Value

The result of the linear fraction transformation is returned.

Dependency

C: "kvml.h"

Examples

C interface:
    #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, scalea : %.3f, shifta : %.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, scalea : -0.200, shifta : -1.100
     *  output:   0.256  -25.000      inf   -2.083
     */