Rate This Document
Findability
Accuracy
Completeness
Readability

v?sqr

Interface Definition

C interface:

void vssqr(const int len, const float* src, float* dst);

void vdsqr(const int len, const double* src, double* dst);

Fortran interface:

CALL VSSQR(LEN, SRC, DST);

CALL VDSQR(LEN, SRC, 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

src

  • Single-precision floating-point type for vssqr
  • Double-precision floating-point type for vdsqr

Input vector src with length len.

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

Input

dst

  • Single-precision floating-point type for vssqr
  • Double-precision floating-point type for vdsqr

Output vector dst with length len.

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

Output

Return Value

The square of a number is returned for each operation value. The value range is [0, +INF).

Input Value (src)

Output Value (dst)

+inf

+inf

-inf

+inf

nan

nan

Dependencies

C: "kvml.h"

Examples

C interface:

    int i, len = 4; 
    float src[len] ={0.0f, 0.5f, 1.0f, 5.0f]};
    float* dst = (float*)malloc(sizeof(float) * len); 
    if (dst == NULL) { 
        printf("Malloc Failed!\n"); 
        return 0; 
    } 
    vssqr(len, src, dst); 
    /** 
     *  Output dst: 
     *     0.0  0.25  1.0  25.0 
     * 
     */

Fortran interface:

    INTEGER :: LEN = 4 
    REAL(4) SRC(4)  
    REAL(4) DST(4) 
    DATA SRC /1.1, 2.6, 3.2, 4.8/ 
    CALL VSSQR(LEN, SRC, DST) 
    !  
    ! OUTPUT DST: 
    !     1.210000038, 6.759999275, 10.240000725, 23.040000916 
    !