Calibration and Runtime Optimization

fastmat.core.calibration

fastmat.core.calibration.calibrateAll(**options)

Calibrate all classes present in fastmat.

Parameters
**optionsdict

Additional keyworded arguments that will be passed on to calibrateClass() calls. Note: The verbose option will be digested by this function and not passed on to calibrateClass().

Returns
None
fastmat.core.calibration.calibrateClass(target, **options)

Calibrate a fastmat matrix baseclass using the specified benchmark.

The generated calibration data will be cached in calData and is then available during instantiation of upcoming fastmat classes and can be imported/exported to disk using the routines loadCalibration and saveCalibration.

Parameters
targetMatrix

The Matrix class to be calibrated. Any existing calibration data will be overwritten when the calibration succeeded.

benchmarkOnlybool, optional

If true, only perform the benchmark evaluation and do not generate calibration data (or update the corresponding entries in calData).

Defaults to False.

verbosebool, optional

Controls the BENCH.verbosity flag of the BENCH instance, resulting in increased verbosity during the test.

Defaults to False.

maxIterfloat, optional

Additional benchmark option that will be passed on to the evaluation. Abort iteration if evaluation of one problem takes more than this amount of seconds.

Defaults to 0.1.

maxInitfloat, optional

Additional benchmark option that will be passed on to the evaluation. Abort iteration if preparation of one problem takes more than this amount of seconds.

Defaults to 0.1.

maxSizefloat, optional

Additional benchmark option that will be passed on to the evaluation. Abort iteration if this problem size is exceeded.

Defaults to 1000000 (one million).

maxMemfloat, optional

Additional benchmark option that will be passed on to the evaluation. Abort iteration if memory usage exceeds this amount of kiB.

Defaults to 100000 (100 MB).

minItemsint, optional

Additional benchmark option that will be passed on to the evaluation. Require the evaluation of at least this number of different problem sizes.

Defaults to 3.

measMinTimefloat, optional

Additional benchmark option that will be passed on to the evaluation. Require the measurement interval to be at least this amount of seconds. Increase repetition count of the evaluation of one problem size is faster than that.

Defaults to 0.003.

meas_minRepsint, optional

Additional benchmark option that will be passed on to the evaluation. Require at least this number of repetitions to be performed in one measurement interval.

Defaults to 3.

meas_minRepsint, optional

Additional benchmark option that will be passed on to the evaluation. Require at least this number of independent measurements for one evaluation.

Defaults to 3.

funcStepint callable(int)

Additional benchmark option that will be passed on to the evaluation. Provision to increase problem size after each evaluation as lamba function returning the next problem size, based on the current.

Defaults to lambda x: x + 1.

**optionsoptional

Additional benchmark options that will be passed on to the evaluation.

Returns
tuple (MatrixCalibration, BENCH)

If the option benchmarkOnly is True, return the generated calibration data and the benchmark instance (containing all benchmark data collected) as a tuple

BENCH

If the option benchmarkOnly is False, return the benchmark instance.

fastmat.core.calibration.getMatrixCalibration(target)

Return a MatrixCalibration object with the calibration data for the fastmat baseclass target was instantiated from.

Parameters
targetMatrix

The fastmat Matrix class for which a MatrixCalibration object shall be returned.

Returns
MatrixCalibration

If no calibration data exists, None will be returned.

fastmat.core.calibration.loadCalibration(filename)

Short summary.

Parameters
filenametype

Description of parameter filename.

Returns
type

Description of returned object.

fastmat.core.calibration.saveCalibration(filename)

Save package calibration data in JSON format to file.

The top level is a dictionary containing calibration data for each class, as a MatrixCalibration object, and identified by the class object’s basename as string. The MatrixCalibration object – being a dict itself – will be represented transparently by JSON.

Parameters
filenamestr

Filename to write the configuration data to.

Returns
None