matcreate.c File Reference


Detailed Description

Matrix creation routines.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <oski/common.h>
#include <oski/matrix.h>
#include <oski/matcreate.h>
#include <oski/CSR/module.h>
#include <oski/CSC/format.h>
#include <oski/CSC/module.h>

Defines

#define NUM_STREAMS   2
 Number of times to stream when estimating the matrix streaming time.

Functions

int oski_DestroyMat (oski_matrix_t A_tunable)
 Frees object memory associated with a given matrix object.
static int CopyMatSpecific (const oski_matcommon_t *props, const oski_matspecific_t *src, oski_matspecific_t *dest)
 Duplicate a oski_matspecific_t data structure.
oski_matrix_t oski_CopyMat (const oski_matrix_t A_tunable)
 Creates a copy of a matrix object.
static double MeasureStreamTimeCSR (const void *repr, const oski_matcommon_t *props, oski_timer_t timer)
 Measure the time to stream a CSR data structure, for use in future cost estimates.
oski_matrix_t oski_CreateMatCSR_va (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k, va_list ap)
 Explicit variable-argument version of oski_CreateMatCSR().
oski_matrix_t oski_CreateMatCSR_arr (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k, const oski_inmatprop_t *in_props)
 Explicit property-array version of oski_CreateMatCSR().
oski_matrix_t oski_CreateMatCSR (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k,...)
 Creates and returns a valid tunable matrix object from a compressed sparse row (CSR) representation.
static double MeasureStreamTimeCSC (const void *repr, const oski_matcommon_t *props, oski_timer_t timer)
 Measure the time to stream a CSC data structure, for use in future cost estimates.
oski_matrix_t oski_CreateMatCSC_arr (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k, const oski_inmatprop_t *in_props)
 Explicit property-array version of oski_CreateMatCSC.
oski_matrix_t oski_CreateMatCSC_va (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k, va_list ap)
 Variable-argument version of oski_CreateMatCSC.
oski_matrix_t oski_CreateMatCSC (oski_index_t *Aptr, oski_index_t *Aind, oski_value_t *Aval, oski_index_t num_rows, oski_index_t num_cols, oski_copymode_t mode, int k,...)
 Creates and returns a valid tunable matrix object from a compressed sparse column (CSC) representation.
static double CalcMatRepr1NormViaCSR (const oski_matspecific_t *A, const oski_matcommon_t *props)
 Compute the 1-norm of a matrix representation by first trying to convert to CSR format, since CSR always has a 1-norm computation routine.
double oski_CalcMat1Norm (const oski_matrix_t A)
 Computes the 1-norm (maximum absolute row sum) of the specified matrix.
const oski_matcommon_toski_GetMatProps (const oski_matrix_t A)
 Returns a matrix's type-independent properties.


Function Documentation

static int CopyMatSpecific const oski_matcommon_t props,
const oski_matspecific_t src,
oski_matspecific_t dest
[static]
 

Duplicate a oski_matspecific_t data structure.

This implementation loads the matrix type-specific copy routine and executes it.

Returns:
1 on success, or 0 on error.

static double MeasureStreamTimeCSR const void *  repr,
const oski_matcommon_t props,
oski_timer_t  timer
[static]
 

Measure the time to stream a CSR data structure, for use in future cost estimates.

Stream NUM_STREAMS times and choose the fastest.

double oski_CalcMat1Norm const oski_matrix_t  A  ) 
 

Computes the 1-norm (maximum absolute row sum) of the specified matrix.

Returns:
$||A||_1 = \max_{1 \leq i \leq m} \sum_{j=1}^n |a_{ij}|$, or -1 on error.

oski_matrix_t oski_CreateMatCSC_arr oski_index_t *  Aptr,
oski_index_t *  Aind,
oski_value_t *  Aval,
oski_index_t  num_rows,
oski_index_t  num_cols,
oski_copymode_t  mode,
int  k,
const oski_inmatprop_t in_props
 

Explicit property-array version of oski_CreateMatCSC.

Check input arguments.

Collect asserted input matrix properties.

Load CSC wrapping routine.

Create handle by wrapping input matrix in a matCSC_t data structure.

Cache streaming time for future cost estimates.

oski_matrix_t oski_CreateMatCSR_arr oski_index_t *  Aptr,
oski_index_t *  Aind,
oski_value_t *  Aval,
oski_index_t  num_rows,
oski_index_t  num_cols,
oski_copymode_t  mode,
int  k,
const oski_inmatprop_t in_props
 

Explicit property-array version of oski_CreateMatCSR().

Check input arguments.

Collect asserted input matrix properties.

Load CSR wrapping routine.

Create handle by wrapping input matrix in a matCSR_t data structure.

Cache streaming time for future cost estimates.

const oski_matcommon_t* oski_GetMatProps const oski_matrix_t  A  ) 
 

Returns a matrix's type-independent properties.

Parameters:
[in] A A valid tunable matrix object.
Returns:
A's type-independent properties (a read-only pointer to its oski_matcommon_t structure, valid only for the lifetime of A), or NULL on error.


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