# tools.c

Some tools used in sopalin.

Summary
 tools.c Some tools used in sopalin. dim_dgeam Computes b = alpha * a + b. GetMpiType Construct a MPI type to store complex values. FreeMpiType Free the MPI type to store complex values. mysum Computes the sum of in and inout vectors and stores it in inout. GetMpiSum Creates a new MPI sum operation. FreeMpiSum Free the MPI sum operation.

## dim_dgeam

 void dim_dgeam( char * transa, char * transb, INT m, INT n, FLOAT alpha, FLOAT * a, INT lda, FLOAT * b, INT ldb )

Computes b = alpha * a + b.

• if transa and transb equals ‘N’.
`b := alpha * a + b`
• if transa = ‘T’ and transb =’N’.
`b := alpha * trans(a) + b`
• if transa = ‘N’ and transb =’T’.
`trans(b) := alpha * a + trans(b)`
• if transa = ‘T’ and transb =’T’.
`trans(b) := alpha * trans(a) + trans(b)`

#### Parameters

 transa indicates if a needs to be transposed. transb indicates if b needs to be transposed. m number of row in a and b. n number of colonnes in a and b. alpha scalar. a Matrix a. lda Stride between 2 columns of a. b Matrix b. ldb Stride between 2 columns of b.

## GetMpiType

 MPI_Datatype GetMpiType( void )

Construct a MPI type to store complex values.

none

#### Return

the constructed MPI type for complex floating values.

## FreeMpiType

 void FreeMpiType( void )

Free the MPI type to store complex values.

none

## mysum

 void mysum( void * in, void * inout, int * len, MPI_Datatype * dptr )

Computes the sum of in and inout vectors and stores it in inout.

#### Parameters

 in First vector. inout Second vector wich will store the sum. len Size of each vector. dptr MPI datatype

## GetMpiSum

 MPI_Op GetMpiSum( void )

Creates a new MPI sum operation.

#### Parameters

none

Return: the new operation created.

## FreeMpiSum

 void FreeMpiSum( void )

Free the MPI sum operation.

#### Parameters

none

 void dim_dgeam( char * transa, char * transb, INT m, INT n, FLOAT alpha, FLOAT * a, INT lda, FLOAT * b, INT ldb )
Computes b = alpha * a + b.
 MPI_Datatype GetMpiType( void )
Construct a MPI type to store complex values.
 void FreeMpiType( void )
Free the MPI type to store complex values.
 void mysum( void * in, void * inout, int * len, MPI_Datatype * dptr )
Computes the sum of in and inout vectors and stores it in inout.
 MPI_Op GetMpiSum( void )
Creates a new MPI sum operation.
 void FreeMpiSum( void )
Free the MPI sum operation.