#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) |
This routine is logically equivalent to the matrix object the caller would obtain if she performed the following sequence of steps:
| |
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_t * | oski_GetMatProps (const oski_matrix_t A) |
Returns a matrix's type-independent properties. |
#define NUM_STREAMS 2 |
Number of times to stream when estimating the matrix streaming time.
Referenced by MeasureStreamTimeCSR().
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.
References INVALID_ID, OSKI_ERR_MATTYPEID_MEMBER, OSKI_MATTYPEID_METHOD, oski_matspecific_t::repr, and oski_matspecific_t::type_id.
Referenced by oski_CopyMat().
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.
References NUM_STREAMS, OSKI_ERR_NOT_IMPLEMENTED, OSKI_MATTYPE_METHOD, oski_PrintDebugMessage(), oski_ReadElapsedTime(), oski_RestartTimer(), oski_StopTimer(), oski_StreamMatRepr_funcpt, and TIME_NOT_AVAIL.
Referenced by MeasureStreamTimeCSC(), and oski_CreateMatCSR_arr().
double oski_CalcMat1Norm | ( | const oski_matrix_t | A | ) |
Computes the 1-norm (maximum absolute row sum) of the specified matrix.
References CalcMatRepr1NormViaCSR(), oski_matstruct_t::input_mat, INVALID_MAT, OSKI_ERR_NOT_IMPLEMENTED, OSKI_MATTYPEID_METHOD, oski_matstruct_t::props, oski_matspecific_t::repr, oski_matstruct_t::tuned_mat, and oski_matspecific_t::type_id.
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.
References oski_inmatpropset_t::index_base, oski_matstruct_t::input_mat, INVALID_MAT, oski_matstruct_t::is_shared, MeasureStreamTimeCSC(), OSKI_CHECK_COPYMODE, OSKI_CHECK_MAT_DIMS, oski_CollectInMatProps_arr(), OSKI_ERR_BAD_COPYMODE, OSKI_ERR_BAD_DIMS, OSKI_ERR_NOT_IMPLEMENTED, OSKI_ERR_NULL_ARG, OSKI_ERR_SMALL_ARG, OSKI_MATTYPE_ID, OSKI_MATTYPE_METHOD, oski_PrintDebugMessage(), oski_matstruct_t::props, oski_matspecific_t::repr, SHARE_INPUTMAT, oski_matstruct_t::time_stream, oski_matstruct_t::timer, and oski_matspecific_t::type_id.
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.
References oski_inmatpropset_t::index_base, oski_matstruct_t::input_mat, INVALID_MAT, oski_matstruct_t::is_shared, MeasureStreamTimeCSR(), OSKI_CHECK_COPYMODE, OSKI_CHECK_MAT_DIMS, oski_CollectInMatProps_arr(), OSKI_ERR_BAD_COPYMODE, OSKI_ERR_BAD_DIMS, OSKI_ERR_NOT_IMPLEMENTED, OSKI_ERR_NULL_ARG, OSKI_ERR_SMALL_ARG, OSKI_MATTYPE_ID, OSKI_MATTYPE_METHOD, oski_PrintDebugMessage(), oski_WrapCSR_funcpt, oski_matstruct_t::props, oski_matspecific_t::repr, SHARE_INPUTMAT, oski_matstruct_t::time_stream, oski_matstruct_t::timer, and oski_matspecific_t::type_id.
const oski_matcommon_t* oski_GetMatProps | ( | const oski_matrix_t | A | ) |
Returns a matrix's type-independent properties.
[in] | A | A valid tunable matrix object. |
References INVALID_MAT, OSKI_ERR_BAD_MAT, and oski_matstruct_t::props.