vfill
Perform filling operations on real-number vectors.
The function interface declaration is as follows:
Operations on numbers of the float type:
void (vsip_vfill_f)(float alpha, const vsip_vview_f *r);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
alpha |
Real-number scalar |
Unlimited |
Input |
r |
Pointer to the destination vector |
The value cannot be NULL. |
Output |
Abnormal Input
When a null pointer is input, the function directly returns a result.
Example
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "kvsip.h"
#include "vsip.h"
#include "vsip_type.h"
#define BUFFER_SIZE_T 10
void VfillExample()
{
float alpha = 1.32f;
float dst[BUFFER_SIZE_T];
int64_t stride = 1;
uint64_t offset = 0;
vsip_block_f *block_r = vsip_blockbind_f(dst, BUFFER_SIZE_T, VSIP_MEM_NONE);
vsip_vview_f *r = vsip_vbind_f(block_r, offset, stride, BUFFER_SIZE_T);
vsip_blockadmit_f(block_r, VSIP_TRUE);
vsip_vfill_f(alpha, r);
vsip_valldestroy_f(r);
printf("alpha: %.2f\n", alpha);
printf("dst:\n");
for (int32_t i = 0; i < BUFFER_SIZE_T; ++i) {
printf("%.2f ", dst[i]);
}
printf("\n");
}
int main(void) {
VfillExample();
return 0;
}
Output:
alpha: 1.32 dst: 1.32 1.32 1.32 1.32 1.32 1.32 1.32 1.32 1.32 1.32
Parent topic: Vector Operation Functions