cmfill
Perform filling operations on complex matrices.
The function interface declaration is as follows:
Operations on numbers of the float type:
void (vsip_cmfill_f)(vsip_cscalar_f alpha, const vsip_cmview_f *r);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
alpha |
Complex scalar |
Unlimited |
Input |
r |
Pointer to the destination complex matrix |
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"
void CmfillExample()
{
vsip_cscalar_f alpha = {1.1f, -1.2f};
int32_t row = 4;
int32_t col = 3;
int64_t rowStride = 1;
int64_t colStride = row * rowStride;
uint64_t offset = 0;
int32_t len = 2 * (col * colStride + offset);
float *dst = (float *)malloc(len * sizeof(float));
vsip_cblock_f *block_r = vsip_cblockbind_f(dst, NULL, len, VSIP_MEM_NONE);
vsip_cmview_f *r = vsip_cmbind_f(block_r, offset, colStride, col, rowStride, row);
vsip_cblockadmit_f(block_r, VSIP_TRUE);
vsip_cmfill_f(alpha, r);
vsip_cmalldestroy_f(r);
printf("alpha: %.2f %.2f\n", alpha.r, alpha.i);
printf("dst:\n");
for (int32_t i = 0; i < col; ++i) {
for (int32_t j = 0; j < row; ++j) {
printf("%.2f ", dst[i * row * 2 + j * 2]);
printf("%.2f ", dst[i * row * 2 + j * 2 + 1]);
}
printf("\n");
}
free(dst);
}
int main(void) {
CmfillExample();
return 0;
}
Output:
alpha: 1.10 -1.20 dst: 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20 1.10 -1.20
Parent topic: Matrix Operation Functions