alibAdjoint
Returns the adjoint (conjugate transpose) of a matrix. Besides the
complex data-types,
real data-types are also supported, providing a more compact API for the
real transpose than that provided by
n-dimensional
alibTranspose. The PV-WAVE API for this routine is the
ADJOINT Function.
Prototypes
void alibAdjointb( wvlong m, wvlong n, UCHAR *p, UCHAR *q )
void alibAdjoints( wvlong m, wvlong n, short *p, short *q )
void alibAdjointi( wvlong m, wvlong n, int *p, int *q )
void alibAdjointl( wvlong m, wvlong n, wvlong *p, wvlong *q )
void alibAdjointf( wvlong m, wvlong n, float *p, float *q )
void alibAdjointd( wvlong m, wvlong n, double *p, double *q )
void alibAdjointc( wvlong m, wvlong n, COMPLEX *p, COMPLEX *q )
void alibAdjointz( wvlong m, wvlong n, DCOMPLEX *p, DCOMPLEX *q )
Parameters
m — (Input) The first dimension of the matrix.
n — (Input) The second dimension of the matrix.
*p — (Input) The source array, i.e., (m,n) matrix.
*q — (Input/Output) The destination array. On return, array q contains the (n,m) matrix which is the conjugate transpose of the input matrix. For real inputs, this is just the transpose of the input.
Example
Here we show a basic example with complex data, and then for real data we show how to rotate a matrix by 90 degree increments.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "alib.h"
void main() {
/* input and output arrays to be used in all the examples */
UCHAR b0[6], b[6], b1[6];
COMPLEX c0[6], c[6];
/* initialize the data */
alibinit( NULL, NULL, NULL, NULL );
alibIndexb( 6, 0, 1, b0 );
alibIndexc( 6, cmplxflt(0,0), cmplxflt(1,-1), c0 );
printf( "\n\n print (2,3) matrix c0 and its adjoint" );
alibPrintArrayc( 1, 1, 2, 3, c0, NULL );
alibAdjointc( 2, 3, c0, c );
alibPrintArrayc( 1, 1, 3, 2, c, NULL );
printf( "\n\n print (2,3) matrix b0 and then rotate it by 90 degrees" );
alibPrintArrayb( 1, 1, 2, 3, b0, NULL );
alibAdjointb( 2, 3, b0, b1 );
alibFlipDimb( 0, 3, 2, b1, b );
alibPrintArrayb( 1, 1, 3, 2, b, NULL );
printf( "\n\n print (2,3) matrix b0 and then rotate it by 180 degrees" );
alibPrintArrayb( 1, 1, 2, 3, b0, NULL );
alibFlipDimb( 0, 2, 3, b0, b1 );
alibFlipDimb( 1, 2, 3, b1, b );
alibPrintArrayb( 1, 1, 2, 3, b, NULL );
printf( "\n\n print (2,3) matrix b0 and then rotate it by -90 degrees" );
alibPrintArrayb( 1, 1, 2, 3, b0, NULL );
alibAdjointb( 2, 3, b0, b1 );
alibFlipDimb( 1, 3, 2, b1, b );
alibPrintArrayb( 1, 1, 3, 2, b, NULL );
}
Output:
print (2,3) matrix c0 and its adjoint
( 0.000e+00, 0.000e+00) ( 1.000e+00, -1.000e+00) ( 2.000e+00, -2.000e+00)
( 3.000e+00, -3.000e+00) ( 4.000e+00, -4.000e+00) ( 5.000e+00, -5.000e+00)
( 0.000e+00, -0.000e+00) ( 3.000e+00, 3.000e+00)
( 1.000e+00, 1.000e+00) ( 4.000e+00, 4.000e+00)
( 2.000e+00, 2.000e+00) ( 5.000e+00, 5.000e+00)
print (2,3) matrix b0 and then rotate it by 90 degrees
0 1 2
3 4 5
2 5
1 4
0 3
print (2,3) matrix b0 and then rotate it by 180 degrees
0 1 2
3 4 5
5 4 3
2 1 0
print (2,3) matrix b0 and then rotate it by -90 degrees
0 1 2
3 4 5
3 0
4 1
5 2
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.