vecview.c File Reference

Multivector view implementation. More...

#include <assert.h>
#include <math.h>
#include <oski/config.h>
#include <oski/common.h>
#include <oski/vecview.h>

Defines

#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 Min of two side-effect-free values.

Functions

static void SetRowColIncMultiVecView (oski_vecstruct_t *vec)
 Set the redundantly maintained row/column stride parameters.
static oski_vecview_t CreateMultiVecView_NoError (oski_value_t *X, oski_index_t length, oski_index_t num_vecs, oski_storage_t orient, oski_index_t stride)
 Create a multivector view object, but without error checking.
void oski_PrintDebugVecView (const oski_vecview_t x, const char *val_fmt)
 Dump a vector view object to the debug log (FOR DEBUGGING ONLY).
oski_vecview_t oski_CreateVecView (oski_value_t *x, oski_index_t length, oski_index_t inc)
 Creates a valid view on a single dense column vector $x$.
oski_vecview_t oski_CreateMultiVecView (oski_value_t *X, oski_index_t length, oski_index_t num_vecs, oski_storage_t orient, oski_index_t stride)
 Creates a multivector view on $k$ dense column vectors $X = \left(\begin{array}{c} x_1 \cdots x_k \end{array}\right)$, stored as a submatrix in the user's data.
int oski_DestroyVecView (oski_vecview_t x)
 Destroy an existing vector view.
oski_vecview_t oski_CopyVecView (const oski_vecview_t x)
 Creates a copy of the given (multi)vector view.
double oski_CalcVecViewInfNorm (const oski_vecview_t x, oski_index_t j)
 Compute the infinity norm of a specified column vector of a vector view.
double oski_CalcVecViewInfNormDiff (const oski_vecview_t x0, oski_index_t j0, const oski_vecview_t x1, oski_index_t j1)
 Compute the infinity norm of the difference between two vectors.
int oski_InitSubVecView (const oski_vecview_t x, oski_index_t i, oski_index_t j, oski_index_t R, oski_index_t C, oski_vecstruct_t *y)
 Given an $m\times n$ multivector object $x$, returns a shallow copy submatrix $y = x(i_0:(i_0+R-1), j_0:(j_0+C-1)$.

Variables

static oski_vecstruct_t OBJ_SYMBOLIC_VEC
 Statically declared symbolic single vector object.
static oski_vecstruct_t OBJ_SYMBOLIC_MULTIVEC
 Statically declared symbolic multivector object.
const oski_vecview_t SYMBOLIC_VEC = &OBJ_SYMBOLIC_VEC
 Symbolic single-vector view.
const oski_vecview_t SYMBOLIC_MULTIVEC = &OBJ_SYMBOLIC_MULTIVEC
 Symbolic multiple-vector view.


Detailed Description

Multivector view implementation.


Define Documentation

#define MIN ( a,
 )     ((a) < (b) ? (a) : (b))

Min of two side-effect-free values.


Function Documentation

static oski_vecview_t CreateMultiVecView_NoError ( oski_value_t *  X,
oski_index_t  length,
oski_index_t  num_vecs,
oski_storage_t  orient,
oski_index_t  stride 
) [static]

Create a multivector view object, but without error checking.

This routine is equivalent to oski_CreateMultiVecView(), but without the parameter checking.

See also:
oski_CreateMultiVecView

References oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, oski_vecstruct_t::orient, oski_Malloc, SetRowColIncMultiVecView(), oski_vecstruct_t::stride, and oski_vecstruct_t::val.

Referenced by oski_CreateMultiVecView(), and oski_CreateVecView().

double oski_CalcVecViewInfNorm ( const oski_vecview_t  x,
oski_index_t  j 
)

Compute the infinity norm of a specified column vector of a vector view.

Parameters:
[in] x A valid vector view.
[in] j Column for which to compute the infinity norm (in 1-based indices).
Returns:
Let $x_j$ denote column $j$ of $x$. Then this routine returns $||x_j||_\infty$, or -1 on error.

References _IM, _RE, oski_vecstruct_t::colinc, ERR_BAD_ARG, INVALID_VEC, IS_VAL_IN_RANGE, oski_vecstruct_t::num_cols, OSKI_ERR_BAD_VEC, oski_HandleError, oski_vecstruct_t::rowinc, oski_vecstruct_t::val, and VAL_ASSIGN.

double oski_CalcVecViewInfNormDiff ( const oski_vecview_t  x0,
oski_index_t  j0,
const oski_vecview_t  x1,
oski_index_t  j1 
)

Compute the infinity norm of the difference between two vectors.

Parameters:
[in] x0 A valid vector view.
[in] j0 Column of x0 to use (1-based).
[in] x1 A valid vector view.
[in] j1 Column of x1 to use (1-based).
Returns:
$||x0_{j0} - x1_{j1}||_\infty$, where $x0_{j0}$ is column $j0$ of $x0$, and $x1_{j1}$ is column $j1$ of $x1$. Returns -1 on error.

References _IM, _RE, oski_vecstruct_t::colinc, ERR_BAD_ARG, INVALID_VEC, IS_VAL_IN_RANGE, MACRO_TO_STRING, oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, OSKI_ERR_BAD_VEC, oski_HandleError, oski_vecstruct_t::rowinc, oski_vecstruct_t::val, VAL_ASSIGN, and VAL_DEC.

int oski_InitSubVecView ( const oski_vecview_t  x,
oski_index_t  i,
oski_index_t  j,
oski_index_t  R,
oski_index_t  C,
oski_vecstruct_t y 
)

Given an $m\times n$ multivector object $x$, returns a shallow copy submatrix $y = x(i_0:(i_0+R-1), j_0:(j_0+C-1)$.

Parameters:
[in] x The multivector object, $x$.
[in] i Starting row (1-based index).
[in] j Starting column (1-based index).
[in] R Number of rows in the submatrix, or 0 to include all rows.
[in] C Number of columns in the submatrix, or 0 to include all columns.
[in,out] y Pointer to a structure in which to store the shallow copy of the submatrix.
Returns:
0 on success, or an error code on error.

References oski_vecstruct_t::colinc, ERR_BAD_ARG, INVALID_VEC, MIN, oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, oski_vecstruct_t::orient, OSKI_ERR_BAD_ROW, OSKI_ERR_BAD_VEC, oski_vecstruct_t::rowinc, oski_vecstruct_t::stride, and oski_vecstruct_t::val.

void oski_PrintDebugVecView ( const oski_vecview_t  x,
const char *  val_fmt 
)

Dump a vector view object to the debug log (FOR DEBUGGING ONLY).

Parameters:
[in] x Vector view object.
[in] val_fmt Format string to use when displaying values.
This format string MUST contain the following fields, in this order: "%f", "%c". That is, the implementation will print a single character to the right of the value. If val_mft is NULL, then the routines uses the default format of "%5.2f%c".

If oski_value_t is complex, then the format string must contain "%f", "%f", and "%c", to display the real and imaginary parts.

The extra fields are used to print special characters to distinguish between values of the logical matrix, and values lying in the "padding" when the stride is not equal to the matrix dimension.

References _IM, _RE, INVALID_VEC, LAYOUT_COLMAJ, LAYOUT_ROWMAJ, oski_vecstruct_t::num_cols, oski_vecstruct_t::num_rows, oski_vecstruct_t::orient, oski_PrintDebugMessage(), oski_PrintDebugMessageShort(), oski_vecstruct_t::stride, oski_vecstruct_t::val, VECCM_GET, VECRM_GET, and VECVIEW_GET.

static void SetRowColIncMultiVecView ( oski_vecstruct_t vec  )  [static]

Set the redundantly maintained row/column stride parameters.

Parameters:
[in,out] vec Partially initialized vector view (see precondition).
Precondition:
vec->orient and vec->stride have been initialized.
Postcondition:
Sets vec->row_stride and vec->col_stride.

References oski_vecstruct_t::colinc, LAYOUT_COLMAJ, LAYOUT_ROWMAJ, oski_vecstruct_t::orient, oski_vecstruct_t::rowinc, and oski_vecstruct_t::stride.

Referenced by CreateMultiVecView_NoError().


Variable Documentation

Initial value:

MAKE_VECSTRUCT_INIT (0, 1, LAYOUT_COLMAJ, 0, 1, 0, NULL)
Statically declared symbolic multivector object.

Initial value:

MAKE_VECSTRUCT_INIT (0, 1, LAYOUT_COLMAJ, 0, 1, 0, NULL)
Statically declared symbolic single vector object.

Symbolic multiple-vector view.

Symbolic single-vector view.


Generated on Fri Apr 8 22:35:20 2011 for BeBOP Optimized Sparse Kernel Interface Library by  doxygen 1.5.9