Adelsbach/VSIPL
Core Programming Reference Guide
DD-00016-015
Core

6.1.13 vsip_cmprodj_p - Complex Matrix Product with Conjugate

void vsip_cmprodj_f(const vsip_cmview_f *a, const vsip_cmview_f *b, const vsip_cmview_f *r);
Description

This function computes the product of a complex matrix A with the element-wise conjugate of a complex matrix B, storing the result in complex matrix R. The operation performed is:

r  = ∑︁n a  ·b---
 i,j  k=1 i,k  k,j

for all i and j, where A is an m × n complex matrix, B is an n ×p complex matrix, and R is the resulting m ×p complex matrix. ----
bk,j denotes the complex conjugate of bk,j.

Parameters
Example

vsip_cmview_f *A, *B, *R; 
vsip_length m = 2, n = 3, p = 2; 
 
// Create complex matrices 
A = vsip_cmcreate_f(m, n, VSIP_ROW, VSIP_MEM_NONE); 
B = vsip_cmcreate_f(n, p, VSIP_ROW, VSIP_MEM_NONE); 
R = vsip_cmcreate_f(m, p, VSIP_ROW, VSIP_MEM_NONE); 
 
// Initialize matrices A and B with complex values 
for (vsip_index i = 0; i < m; i++) { 
    for (vsip_index j = 0; j < n; j++) { 
        vsip_cscalar_f val = VSIP_CMPLX_F(i*n + j + 1, -(i*n + j + 1)); 
        vsip_cmput_f(A, i, j, val); 
    } 
} 
 
for (vsip_index i = 0; i < n; i++) { 
    for (vsip_index j = 0; j < p; j++) { 
        vsip_cscalar_f val = VSIP_CMPLX_F(i*p + j + 1, i*p + j + 2); 
        vsip_cmput_f(B, i, j, val); 
    } 
} 
 
// Compute matrix product with conjugate: R = A * conj(B) 
vsip_cmprodj_f(A, B, R); 
 
// Print the result 
printf("Result matrix R = A * conj(B) (%lux%lu):\n", m, p); 
for (vsip_index i = 0; i < m; i++) { 
    for (vsip_index j = 0; j < p; j++) { 
        vsip_cscalar_f val = vsip_cmget_f(R, i, j); 
        printf("(%.2f%+.2fi) ", val.r, val.i); 
    } 
    printf("\n"); 
} 
 
// Clean up 
vsip_cmalldestroy_f(A); 
vsip_cmalldestroy_f(B); 
vsip_cmalldestroy_f(R);
Notes