transpose.c File Reference


Detailed Description

Implements a routine to transpose a CSR matrix.

#include <oski/config.h>
#include <oski/common.h>
#include <oski/matrix.h>
#include <oski/CSR/format.h>
#include <oski/CSR/module.h>

Functions

static void cumulative_sum (const oski_index_t *x, oski_index_t n, oski_index_t *y)
 Given an array $x$ of $n$ values, this routine computes the cumulative sum $y_i = \sum_{k=0}^{i-1} x_k$, where $0 \leq i \leq n$.
static int TransposeFullCSR (const oski_index_t *ptr, const oski_index_t *ind, const oski_value_t *val, oski_index_t m, oski_index_t n, oski_index_t base, oski_index_t **p_Tptr, oski_index_t **p_Tind, oski_value_t **p_Tval)
 Transpose a full-storage $m\times n$ matrix $A$ stored in CSR matrix (or equivalently, convert from CSR to CSC).
static void ConjOffDiagElems (const oski_index_t *ptr, const oski_index_t *ind, oski_value_t *val, oski_index_t m, oski_index_t b)
 Conjugate all off-diagonal elements of a CSR representation.
oski_matCSR_toski_TransposeCSR (const oski_matCSR_t *A, const oski_matcommon_t *props)
 Given a matrix $A$ in CSR format, returns a copy of its explicit transpose $A^T$ in CSR format.


Function Documentation

static void cumulative_sum const oski_index_t *  x,
oski_index_t  n,
oski_index_t *  y
[static]
 

Given an array $x$ of $n$ values, this routine computes the cumulative sum $y_i = \sum_{k=0}^{i-1} x_k$, where $0 \leq i \leq n$.

Parameters:
[in] x Array of values to sum.
[in] n Length of $x$.
[in,out] y An array of size $n+1$ used to store the cumulative sum.
Note:
This routine was "outlined" from its use in this module (TransposeFullCSR) to avoid an unexplained bug that occurred when using the Intel C compiler on IA-64.

oski_matCSR_t* oski_TransposeCSR const oski_matCSR_t A,
const oski_matcommon_t props
 

Given a matrix $A$ in CSR format, returns a copy of its explicit transpose $A^T$ in CSR format.

Parameters:
[in] A Matrix $A$ to transpose.
[in] props Common properties of $A$.
Returns:
A pointer to a new CSR matrix storing $A^T$, or NULL on memory error.
This implementation maintains symmetric/Hermitian properties if they apply to $A$.

static int TransposeFullCSR const oski_index_t *  ptr,
const oski_index_t *  ind,
const oski_value_t *  val,
oski_index_t  m,
oski_index_t  n,
oski_index_t  base,
oski_index_t **  p_Tptr,
oski_index_t **  p_Tind,
oski_value_t **  p_Tval
[static]
 

Transpose a full-storage $m\times n$ matrix $A$ stored in CSR matrix (or equivalently, convert from CSR to CSC).

Parameters:
[in] ptr Row pointers.
[in] ind Column indices.
[in] val Non-zero values, or NULL if the caller only wishes to transpose the pattern.
[in] m Number of rows.
[in] n Number of columns.
[in] base Index base used for ptr, ind.
[out] p_Tptr *p_Tptr stores the $n+1$ row pointers of $A^T$.
[out] p_Tind *p_Tind stores the column indices of $A^T$.
[out] p_Tval *p_Tval stores the non-zero values of $A^T$.
Returns:
0 on success, an error code otherwise. This routine does not call the error handler. If an error occurs, the output variables *p_Tptr, *p_Tind, and *p_Tval remain unchanged.


Generated on Wed Sep 19 16:41:23 2007 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.4.6