ScaMaC  0.8.2
A Scalable Matrix Collection
Files | Typedefs | Functions
ScaMaC library

High-level access to the ScaMaC library for matrix generation. More...

Files

file  scamac.h
 ScaMaC library top-level header file
 

Typedefs

typedef struct scamac_generator_st ScamacGenerator
 Abstract generator object.
 
typedef struct scamac_workspace_st ScamacWorkspace
 Abstract workspace object.
 

Functions

ScamacErrorCode scamac_benchmark_obtain (const char *name, int m, int x, ScamacGenerator **gen)
 obtain generator for benchmark matrix "Bmname-m-x" e.g. scamac_benchmark_obtain("Simple",1,1) gives, to quote, "the simplest benchmark matrix ever". More...
 
ScamacErrorCode scamac_generator_set_rngseed (ScamacGenerator *gen, const char *parname, uint64_t seed)
 set random seed
 
ScamacErrorCode scamac_generator_set_rngseed_str (ScamacGenerator *gen, const char *parname, const char *seedstr)
 set random seed, reading from an arbitrary (random) string More...
 
ScamacErrorCode scamac_generator_check (const ScamacGenerator *gen, char **desc)
 Check the parameters of the generator. More...
 
ScamacErrorCode scamac_generate_row (const ScamacGenerator *gen, ScamacWorkspace *ws, ScamacIdx irow, ScamacFlag flag, ScamacIdx *nzr, ScamacIdx *cind, double *val)
 Generate one row of a matrix. More...
 
ScamacErrorCode scamac_alloc_cind_val (const ScamacGenerator *gen, ScamacFlag flag, ScamacIdx **cind, double **val)
 Allocate vector cind and val, for calls to scamac_generate_row(). More...
 

Detailed Description

High-level access to the ScaMaC library for matrix generation.

Only the functions listed here should be called directly by the user. They are bundled in the top-level header scamac.h.

Function Documentation

◆ scamac_alloc_cind_val()

ScamacErrorCode scamac_alloc_cind_val ( const ScamacGenerator gen,
ScamacFlag  flag,
ScamacIdx **  cind,
double **  val 
)

Allocate vector cind and val, for calls to scamac_generate_row().

This function is merely a convenience.

◆ scamac_benchmark_obtain()

ScamacErrorCode scamac_benchmark_obtain ( const char *  name,
int  m,
int  x,
ScamacGenerator **  gen 
)

obtain generator for benchmark matrix "Bmname-m-x" e.g. scamac_benchmark_obtain("Simple",1,1) gives, to quote, "the simplest benchmark matrix ever".

Note
benchmark names start with a capital letter

◆ scamac_generate_row()

ScamacErrorCode scamac_generate_row ( const ScamacGenerator gen,
ScamacWorkspace ws,
ScamacIdx  irow,
ScamacFlag  flag,
ScamacIdx *  nzr,
ScamacIdx *  cind,
double *  val 
)

Generate one row of a matrix.

We generate a row.

Parameters
[in]genMatrix generator, after scamac_generator_finalize()
[in,out]wsWorkspace, allocated by scamac_workspace_alloc()
[in]irowindex of the row to be generated
[in]flagflags
[out]nzrnumber of non-zero elements in the row
[out]cindcolumn indices of non-zero elements
[out]valvalues of non-zero elements

◆ scamac_generator_check()

ScamacErrorCode scamac_generator_check ( const ScamacGenerator gen,
char **  desc 
)

Check the parameters of the generator.

This routine performs some checks.

Parameters
[in]genThe generator to be checked
[out]descIf desc != NULL, it contains a string describing the problems with the parameters.
Returns
Status of the check. Returns SCAMAC_EOK if check passed, SCAMAC_EFAIL otherwise.
Precondition
gen != NULL

◆ scamac_generator_set_rngseed_str()

ScamacErrorCode scamac_generator_set_rngseed_str ( ScamacGenerator gen,
const char *  parname,
const char *  seedstr 
)

set random seed, reading from an arbitrary (random) string

The random values used in matrix generation depend on a seed value, which is given by a matrix parameter normally called "seed". Random number generation is consistent: For the same seed, the same random values are used independently of the way the matrix is generated.