PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
core_slarfx_tbrd.c File Reference
#include <lapacke.h>
#include "common.h"
Include dependency graph for core_slarfx_tbrd.c:

Go to the source code of this file.

Functions

int CORE_slarfx2 (PLASMA_enum side, int N, float V, float TAU, float *C1, int LDC1, float *C2, int LDC2)
int CORE_slarfx2c (PLASMA_enum uplo, float V, float TAU, float *C1, float *C2, float *C3)
int CORE_slarfx2ce (PLASMA_enum uplo, float *V, float *TAU, float *C1, float *C2, float *C3)

Detailed Description

PLASMA core_blas kernel PLASMA is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver

Version:
2.4.5
Author:
Azzam Haidar
Date:
2011-05-15 s Tue Nov 22 14:35:22 2011

Definition in file core_slarfx_tbrd.c.


Function Documentation

int CORE_slarfx2 ( PLASMA_enum  side,
int  N,
float  V,
float  TAU,
float *  C1,
int  LDC1,
float *  C2,
int  LDC2 
)

Purpose

CORE_slarfx2 applies a complex elementary reflector H to a complex m by n matrix C, from either the left or the right. H is represented in the form

  H = I - tau * v * v'

where tau is a complex scalar and v is a complex vector.

If tau = 0, then H is taken to be the unit matrix

This version uses inline code if H has order < 11.

Arguments

Parameters:
[in]side
  • PlasmaLeft : form H * C
  • PlasmaRight: form C * H
[in]NThe number of columns of C1 and C2 if side = PlasmaLeft. The number of rows of C1 and C2 if side = PlasmaRight.
[in]VThe float complex V in the representation of H.
[in]TAUThe value tau in the representation of H.
[in,out]C1dimension (LDC1,N), if side = PlasmaLeft dimension (LDC1,1), if side = PlasmaRight On entry, the m by n matrix C1. On exit, C1 is overwritten by the matrix H * C1 if SIDE = PlasmaLeft, or C1 * H if SIDE = PlasmaRight.
[in]LDC1The leading dimension of the array C1. LDC1 >= max(1,N), if side == PlasmaRight. LDC1 >= 1, otherwise.
[in,out]C2dimension (LDC2,N), if side = PlasmaLeft dimension (LDC2,1), if side = PlasmaRight On entry, the m by n matrix C2. On exit, C2 is overwritten by the matrix H * C2 if SIDE = PlasmaLeft, or C2 * H if SIDE = PlasmaRight.
[in]LDC2The leading dimension of the array C2. LDC2 >= max(1,N), if side == PlasmaRight. LDC2 >= 1, otherwise.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit
<0if -i, the i-th argument had an illegal value

Definition at line 86 of file core_slarfx_tbrd.c.

References PLASMA_SUCCESS, PlasmaLeft, T2, TAU, and V.

{
float V2, T2, SUM;
int j;
if (TAU == (float)0.0)
/*
* Special code for 2 x 2 Householder where V1 = I
*/
V2 = (V);
T2 = TAU*(V2);
for (j = 0; j < N ; j++, C1+=LDC1 ) {
SUM = *C1 + V2 * (*C2);
*C1 = *C1 - SUM*TAU;
*C2 = *C2 - SUM*T2;
C2 += LDC2;
}
}
else {
V2 = V;
T2 = TAU*(V2);
for (j = 0; j < N ; j++, C1++){
SUM = *C1 + V2 * (*C2);
*C1 = *C1 - SUM*TAU;
*C2 = *C2 - SUM*T2;
C2++;
}
}
}

Here is the caller graph for this function:

int CORE_slarfx2c ( PLASMA_enum  uplo,
float  V,
float  TAU,
float *  C1,
float *  C2,
float *  C3 
)

Purpose

CORE_slarfx2c applies a complex elementary reflector H to a diagonal corner C=[C1, C2, C3], from both the left and the right side. C = H * C * H. It is used in the case of Hermetian. If PlasmaLower, a left apply is followed by a right apply. If PlasmaUpper, a right apply is followed by a left apply. H is represented in the form

This routine is a special code for a corner C diagonal block C1 C2 C3

H = I - tau * v * v'

where tau is a complex scalar and v is a complex vector.

If tau = 0, then H is taken to be the unit matrix

This version uses inline code if H has order < 11.

Arguments

Parameters:
[in]uplo= PlasmaUpper: Upper triangle of A is stored; = PlasmaLower: Lower triangle of A is stored.
[in]VThe float complex V in the representation of H.
[in]TAUThe value tau in the representation of H.
[in,out]C1On entry, the element C1. On exit, C1 is overwritten by the result H * C * H.
[in,out]C2On entry, the element C2. On exit, C2 is overwritten by the result H * C * H.
[in,out]C3On entry, the element C3. On exit, C3 is overwritten by the result H * C * H.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit
<0if -i, the i-th argument had an illegal value

Definition at line 185 of file core_slarfx_tbrd.c.

References PLASMA_SUCCESS, PlasmaLower, T2, TAU, and V.

{
float T2, SUM, TEMP;
/* Quick return */
if (TAU == (float)0.0)
/*
* Special code for a diagonal block C1
* C2 C3
*/
if(uplo==PlasmaLower) {
/*
* Do the corner Left then Right (used for the lower case
* tridiag) L and R for the 2x2 corner
* C(N-1, N-1) C(N-1,N) C1 TEMP
* C(N , N-1) C(N ,N) C2 C3
* For Left : use (TAU) and V.
* For Right: nothing, keep TAU and V.
* Left 1 ==> C1
* C2
*/
TEMP = (*C2); /* copy C2 here before modifying it. */
T2 = (TAU) * V;
SUM = *C1 + (V) * (*C2);
*C1 = *C1 - SUM * (TAU);
*C2 = *C2 - SUM * T2;
/* Left 2 ==> TEMP */
/* C3 */
SUM = TEMP + (V) * (*C3);
TEMP = TEMP - SUM * (TAU);
*C3 = *C3 - SUM * T2;
/* Right 1 ==> C1 TEMP. NB: no need to compute corner (2,2)=TEMP */
T2 = TAU * (V);
SUM = *C1 + V*TEMP;
*C1 = *C1 - SUM*TAU;
/* Right 2 ==> C2 C3 */
SUM = *C2 + V*(*C3);
*C2 = *C2 - SUM*TAU;
*C3 = *C3 - SUM*T2;
}
else {
/*
* Do the corner Right then Left (used for the upper case tridiag)
* C(N-1, N-1) C(N-1,N) C1 C2
* C(N , N-1) C(N ,N) TEMP C3
* For Left : use TAU and (V).
* For Right: use (TAU) and (V).
* Right 1 ==> C1 C2
*/
V = (V);
TEMP = (*C2); /* copy C2 here before modifying it. */
T2 = (TAU) * (V);
SUM = *C1 + V * (*C2);
*C1 = *C1 - SUM * (TAU);
*C2 = *C2 - SUM * T2;
/* Right 2 ==> TEMP C3 */
SUM = TEMP + V * (*C3);
TEMP = TEMP - SUM * (TAU);
*C3 = *C3 - SUM * T2;
/* Left 1 ==> C1 */
/* TEMP. NB: no need to compute corner (2,1)=TEMP */
T2 = TAU * V;
SUM = *C1 + (V) * TEMP;
*C1 = *C1 - SUM * TAU;
/* Left 2 ==> C2 */
/* C3 */
SUM = *C2 + (V) * (*C3);
*C2 = *C2 - SUM * TAU;
*C3 = *C3 - SUM * T2;
}
}

Here is the caller graph for this function:

int CORE_slarfx2ce ( PLASMA_enum  uplo,
float *  V,
float *  TAU,
float *  C1,
float *  C2,
float *  C3 
)

Purpose

CORE_slarfx2c applies a complex elementary reflector H to a diagonal corner C=[C1, C2, C3], from both the left and the right side. C = H * C * H. It is used in the case of general matrices, where it create a nnz at the NEW_NNZ position, then it eliminate it and update the reflector V and TAU. If PlasmaLower, a left apply is followed by a right apply. If PlasmaUpper, a right apply is followed by a left apply. H is represented in the form

This routine is a special code for a corner C diagonal block C1 NEW_NNZ C2 C3

H = I - tau * v * v'

where tau is a complex scalar and v is a complex vector.

If tau = 0, then H is taken to be the unit matrix

This version uses inline code if H has order < 11.

Arguments

Parameters:
[in]uplo= PlasmaUpper: Upper triangle of A is stored; = PlasmaLower: Lower triangle of A is stored.
[in,out]VOn entry, the float complex V in the representation of H. On exit, the float complex V in the representation of H, updated by the elimination of the NEW_NNZ created by the left apply in case of PlasmaLower or the right apply in case of PlasmaUpper.
[in]TAUOn entry, the value tau in the representation of H. On exit, the value tau in the representation of H, updated by the elimination of the NEW_NNZ created by the left apply in case of PlasmaLower or the right apply in case of PlasmaUpper.
[in,out]C1On entry, the element C1. On exit, C1 is overwritten by the result H * C * H.
[in,out]C2On entry, the element C2. On exit, C2 is overwritten by the result H * C * H.
[in,out]C3On entry, the element C3. On exit, C3 is overwritten by the result H * C * H.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit
<0if -i, the i-th argument had an illegal value

Definition at line 335 of file core_slarfx_tbrd.c.

References PLASMA_SUCCESS, PlasmaLower, PlasmaUpper, T2, and V.

{
float T2, SUM, TEMP, VIN, TAUIN;
/* Quick return */
if (*TAU == (float)0.0)
/*
* Special code for a diagonal block C1
* C2 C3
*/
/*
* Do the corner for the lower case BIDIAG ==> Left then will
* create a new nnz. eliminate it and modify V TAU and then
* Right L and R for the 2x2 corner
* C(N-1, N-1) C(N-1,N) C1 TEMP
* C(N , N-1) C(N ,N) C2 C3
*/
VIN = *V;
TAUIN = (*TAU);
/* Left 1 ==> C1 */
/* C2 */
VIN = (VIN);
T2 = TAUIN * (VIN);
SUM = *C1 + VIN*(*C2);
*C1 = *C1 - SUM*TAUIN;
*C2 = *C2 - SUM*T2;
/* new nnz at TEMP and update C3 */
SUM = VIN * (*C3);
TEMP = - SUM * TAUIN;
*C3 = *C3 - SUM * T2;
/* generate Householder to annihilate the nonzero created at TEMP */
*V = TEMP;
LAPACKE_slarfg_work( 2, C1, V, 1, TAU);
VIN = (*V);
TAUIN = (*TAU);
/* Right 1 ==> C2 C3 */
/* VIN = VIN */
T2 = TAUIN * (VIN);
SUM = *C2 + VIN*(*C3);
*C2 = *C2 - SUM*TAUIN;
*C3 = *C3 - SUM*T2;
}else if(uplo==PlasmaUpper){
/*
* Do the corner for the upper case BIDIAG ==> Right then will
* create a new nnz. eliminate it and modify V TAU and then
* Left
* C(N-1, N-1) C(N-1,N) C1 C2
* C(N , N-1) C(N ,N) TEMP C3
* For Left : use (TAU) and V.
* For Right: use (TAU) and (V) as input.
*/
VIN = (*V);
TAUIN = (*TAU);
/* Right 1 ==> C1 C2 */
/* VIN = VIN */
T2 = TAUIN*(VIN);
SUM = *C1 + VIN*(*C2);
*C1 = *C1 - SUM*TAUIN;
*C2 = *C2 - SUM*T2;
/* new nnz at TEMP and update C3 */
SUM = VIN * (*C3);
TEMP = - SUM * TAUIN;
*C3 = *C3 - SUM * T2;
/* generate Householder to annihilate the nonzero created at TEMP */
*V = TEMP;
LAPACKE_slarfg_work( 2, C1, V, 1, TAU);
VIN = *V;
TAUIN = (*TAU);
/* apply from the Left using the NEW V TAU to the remaining 2 elements [C2 C3] */
/* Left 2 ==> C2 */
/* C3 */
VIN = (VIN);
T2 = TAUIN*(VIN);
SUM = *C2 + VIN*(*C3);
*C2 = *C2 - SUM*TAUIN;
*C3 = *C3 - SUM*T2;
}
}

Here is the caller graph for this function: