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

6.1.12 vsip_cmprodh_p - Complex Matrix Product with Hermitian Transpose

void vsip_cmprodh_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 Hermitian transpose 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  j,k

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

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(p, n, 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 < p; i++) { 
    for (vsip_index j = 0; j < n; j++) { 
        vsip_cscalar_f val = VSIP_CMPLX_F(i*n + j + 1, i*n + j + 2); 
        vsip_cmput_f(B, i, j, val); 
    } 
} 
 
// Compute matrix product with Hermitian transpose: R = A * B^H 
vsip_cmprodh_f(A, B, R); 
 
// Print the result 
printf("Result matrix R = A * B^H (%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