getset.c File Reference


Detailed Description

Get/set value routines.

#include <oski/common.h>
#include <oski/config.h>
#include <oski/mangle.h>
#include <oski/matrix.h>
#include <oski/getset.h>

Defines

#define MIN(i, j)   ((i) < (j) ? (i) : (j))
 Returns the smallest of two values.
#define MAX(i, j)   ((i) > (j) ? (i) : (j))
 Returns the largest of two values.

Functions

static int GetMatEntry (const oski_matspecific_t *mat, const oski_matcommon_t *props, oski_index_t row, oski_index_t col, oski_value_t *p_aij)
 Calls matrix type-specific implementation of oski_GetMatEntry().
static int SetMatEntry (const oski_matspecific_t *mat, const oski_matcommon_t *props, oski_index_t row, oski_index_t col, oski_value_t new_val)
 Calls matrix type-specific implementation of oski_SetMatEntry().
oski_value_t oski_GetMatEntry (const oski_matrix_t A_tunable, oski_index_t row, oski_index_t col)
 Returns the value of a matrix element.
int oski_SetMatEntry (const oski_matrix_t A_tunable, oski_index_t row, oski_index_t col, oski_value_t new_val)
 Changes the value of the specified matrix element.
static int FindIndexOutOfRange (const oski_index_t *x, oski_index_t n, oski_index_t min, oski_index_t max)
 Returns the index of any element not in the specified closed interval, or -1 if all elements are in the interval.
static int GetMaxIndex (const oski_index_t *x, oski_index_t n)
 Returns the largest value in the specified array.
static int CheckCliqueArgs (const oski_matrix_t A_tunable, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, oski_vecview_t vals, const char *caller)
 Checks the input arguments to oski_GetMatClique() and oski_SetMatClique(), returning 0 if the arguments are valid or an error code otherwise.
static int GetClique (const oski_matspecific_t *mat, const oski_matcommon_t *props, const oski_index_t *rows, oski_index_t R, const oski_index_t *cols, oski_index_t C, const oski_vecview_t V)
 Given a type-specific representation, try to find a native oski_GetMatReprClique() implementation and call it.
static int GetCliqueDefault (const oski_matrix_t A_tunable, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, oski_vecview_t V)
 Returns a clique using a default naive algorithm that just calls oski_GetMatEntry() repeatedly.
int oski_GetMatClique (const oski_matrix_t A_tunable, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, oski_vecview_t vals)
 Returns a block of values, defined by a clique, from a matrix.
static int SetClique (const oski_matspecific_t *mat, const oski_matcommon_t *props, const oski_index_t *rows, oski_index_t R, const oski_index_t *cols, oski_index_t C, const oski_vecview_t V)
 Given a type-specific representation, try to find a native oski_SetMatReprClique() implementation and call it.
static int SetCliqueDefault (const oski_matrix_t A_tunable, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, oski_vecview_t V)
 Returns a clique using a default naive algorithm that just calls oski_SetMatEntry() repeatedly.
int oski_SetMatClique (const oski_matrix_t A_tunable, const oski_index_t *rows, oski_index_t num_rows, const oski_index_t *cols, oski_index_t num_cols, const oski_vecview_t vals)
 Changes a block of values, defined by a clique, in a matrix.
static int CheckDiagValuesArgs (const oski_matrix_t A_tunable, oski_index_t d, oski_vecview_t vals, const char *caller)
 Checks the input arguments to oski_GetMatDiagValues() and oski_SetMatDiagValues(), returning 0 if the arguments are valid or an error code otherwise.
static int GetDiagValues (const oski_matspecific_t *mat, const oski_matcommon_t *props, oski_index_t d, oski_vecview_t V)
 Given a type-specific representation, try to find a native oski_GetMatReprDiagValues() implementation and call it.
static int GetDiagValuesDefault (const oski_matrix_t A_tunable, oski_index_t d, oski_vecview_t V)
 Returns a clique using a default naive algorithm that just calls oski_GetMatEntry() repeatedly.
int oski_GetMatDiagValues (const oski_matrix_t A_tunable, oski_index_t diag_num, oski_vecview_t diag_vals)
 Extract the diagonal $d$ from $A$, that is, all entries $A(i,j)$ such that $j-i = d$.
static int SetDiagValues (const oski_matspecific_t *mat, const oski_matcommon_t *props, oski_index_t d, const oski_vecview_t V)
 Given a type-specific representation, try to find a native oski_SetMatReprDiagValues() implementation and call it.
static int SetDiagValuesDefault (const oski_matrix_t A_tunable, oski_index_t d, const oski_vecview_t V)
 Sets values along a given diagonal using a default naive algorithm that just calls oski_SetMatEntry() repeatedly.
int oski_SetMatDiagValues (const oski_matrix_t A_tunable, oski_index_t diag_num, const oski_vecview_t diag_vals)
 Sets the values along diagonal $d$ from $A$, that is, all entries $A(i,j)$ such that $j-i = d$.


Function Documentation

static int CheckCliqueArgs const oski_matrix_t  A_tunable,
const oski_index_t *  rows,
oski_index_t  num_rows,
const oski_index_t *  cols,
oski_index_t  num_cols,
oski_vecview_t  vals,
const char *  caller
[static]
 

Checks the input arguments to oski_GetMatClique() and oski_SetMatClique(), returning 0 if the arguments are valid or an error code otherwise.

This routine calls the error handler on error, using the method name, 'caller'.

static int CheckDiagValuesArgs const oski_matrix_t  A_tunable,
oski_index_t  d,
oski_vecview_t  vals,
const char *  caller
[static]
 

Checks the input arguments to oski_GetMatDiagValues() and oski_SetMatDiagValues(), returning 0 if the arguments are valid or an error code otherwise.

This routine calls the error handler on error, using the method name, 'caller'.

static int FindIndexOutOfRange const oski_index_t *  x,
oski_index_t  n,
oski_index_t  min,
oski_index_t  max
[static]
 

Returns the index of any element not in the specified closed interval, or -1 if all elements are in the interval.

The index returned is 0-based.

static int GetClique const oski_matspecific_t mat,
const oski_matcommon_t props,
const oski_index_t *  rows,
oski_index_t  R,
const oski_index_t *  cols,
oski_index_t  C,
const oski_vecview_t  V
[static]
 

Given a type-specific representation, try to find a native oski_GetMatReprClique() implementation and call it.

If none exists, returns ERR_NOT_IMPLEMENTED. Otherwise, calls the native function and returns its error code.

static int GetCliqueDefault const oski_matrix_t  A_tunable,
const oski_index_t *  rows,
oski_index_t  num_rows,
const oski_index_t *  cols,
oski_index_t  num_cols,
oski_vecview_t  V
[static]
 

Returns a clique using a default naive algorithm that just calls oski_GetMatEntry() repeatedly.

Precondition:
Assumes all arguments are valid. See CheckCliqueArgs().

static int GetDiagValues const oski_matspecific_t mat,
const oski_matcommon_t props,
oski_index_t  d,
oski_vecview_t  V
[static]
 

Given a type-specific representation, try to find a native oski_GetMatReprDiagValues() implementation and call it.

If none exists, returns ERR_NOT_IMPLEMENTED. Otherwise, calls the native function and returns its error code.

static int GetDiagValuesDefault const oski_matrix_t  A_tunable,
oski_index_t  d,
oski_vecview_t  V
[static]
 

Returns a clique using a default naive algorithm that just calls oski_GetMatEntry() repeatedly.

Precondition:
Assumes all arguments are valid. See CheckDiagValuesArgs().

static int GetMatEntry const oski_matspecific_t mat,
const oski_matcommon_t props,
oski_index_t  row,
oski_index_t  col,
oski_value_t *  p_aij
[static]
 

Calls matrix type-specific implementation of oski_GetMatEntry().

Parameters:
[in] mat Type-specific data structure.
[in] props Type-independent properties.
[in] row Row of entry to retrieve (1-based).
[in] col Column of entry to retrieve (1-based).
[in,out] p_aij Pointer to buffer into which the (row, col) entry is returned.
Returns:
On success, sets *p_aij to $a_{\mathrm{row}, \mathrm{col}}$ and returns 0. Returns an error code otherwise. This routine calls the error handler unless the error that there is no matrix type-specific implementation. (In this case, the caller has an opportunity to try calling the type-specific implementation of another representation.)

static int GetMaxIndex const oski_index_t *  x,
oski_index_t  n
[static]
 

Returns the largest value in the specified array.

Precondition:
n >= 1 && x != NULL

static int SetClique const oski_matspecific_t mat,
const oski_matcommon_t props,
const oski_index_t *  rows,
oski_index_t  R,
const oski_index_t *  cols,
oski_index_t  C,
const oski_vecview_t  V
[static]
 

Given a type-specific representation, try to find a native oski_SetMatReprClique() implementation and call it.

If none exists, returns ERR_NOT_IMPLEMENTED. Otherwise, calls the native function and returns its error code.

static int SetCliqueDefault const oski_matrix_t  A_tunable,
const oski_index_t *  rows,
oski_index_t  num_rows,
const oski_index_t *  cols,
oski_index_t  num_cols,
oski_vecview_t  V
[static]
 

Returns a clique using a default naive algorithm that just calls oski_SetMatEntry() repeatedly.

Precondition:
Assumes all arguments are valid. See CheckCliqueArgs().

static int SetDiagValues const oski_matspecific_t mat,
const oski_matcommon_t props,
oski_index_t  d,
const oski_vecview_t  V
[static]
 

Given a type-specific representation, try to find a native oski_SetMatReprDiagValues() implementation and call it.

If none exists, returns ERR_NOT_IMPLEMENTED. Otherwise, calls the native function and returns its error code.

static int SetDiagValuesDefault const oski_matrix_t  A_tunable,
oski_index_t  d,
const oski_vecview_t  V
[static]
 

Sets values along a given diagonal using a default naive algorithm that just calls oski_SetMatEntry() repeatedly.

Precondition:
Assumes all arguments are valid. See CheckDiagValuesArgs().

static int SetMatEntry const oski_matspecific_t mat,
const oski_matcommon_t props,
oski_index_t  row,
oski_index_t  col,
oski_value_t  new_val
[static]
 

Calls matrix type-specific implementation of oski_SetMatEntry().

Parameters:
[in] mat Type-specific data structure.
[in] props Type-independent properties.
[in] row Row of entry to set (1-based).
[in] col Column of entry to set (1-based).
[in] new_val New value for the specified entry.
Returns:
On success, sets $a_{\mathrm{row}, \mathrm{col}}$ to new_val and returns 0. This routine returns an error code otherwise, and calls the error handler unless 'mat' has an invalid type id.


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