14.09.2015 Views

Matvec Users’ Guide

Matvec Users' Guide

Matvec Users' Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2<br />

Working on Objects<br />

<strong>Matvec</strong> is object-oriented. Almost every piece in <strong>Matvec</strong> system is an object. All objects in <strong>Matvec</strong> can<br />

be classified into nine classes: Scalar, Vector, Matrix, SparseMatrix, String, Data, Model, FileStream, and<br />

StatDist.<br />

It should always keep in mind that you’re using an object-oriented language. Thus, to play with <strong>Matvec</strong><br />

you have to create your own objects at the very beginning.<br />

2.1 Special Object: this<br />

A very special object built in <strong>Matvec</strong> is this. It is the object of the current working session. All of the<br />

parameters, properties pertaining to the current working session can be changed through this special object.<br />

For C++ programmer, keyword this is an old friend<br />

If you simply type this, it will display the names of the user-defined variables and functions.<br />

this.clear(a,b,...) deletes the named objects from the current <strong>Matvec</strong> session immediately. The memory<br />

associated with the objects are freed. this.clear() deletes all objects (but not the builtins’) and all intermediate<br />

temporary files (but not ones created from the other matvec sessions) from the matvec trash can. The<br />

return value is the number of objects that have been successfully deleted.<br />

this.parameter( "OUTPUT_PRECISION", k) sets the output precision for the current <strong>Matvec</strong> working session<br />

to k. The default value is 6. this.parameter( "OUTPUT_PRECISION") returns the output precision in the<br />

current <strong>Matvec</strong> working session. Note that “precision” is defined to be the number of significant digits in<br />

output.<br />

this.parameter( "WARNING", k) sets the warning flag for the current working session to k, which can be<br />

either 1 or 0. The default value is 1. this.parameter( "WARNING") returns the value of the warning flag in<br />

the current working session.<br />

this.parameter( "EPSILON", x) sets the epsilon value for the current <strong>Matvec</strong> working session to x.<br />

The default value is 1.0e-14. <strong>Matvec</strong> users are strongly discouraged to change the default epsilon value.<br />

this.parameter( "EPSILON") returns the epsilon value in the current <strong>Matvec</strong> working session.<br />

this.parameter( "OUTPUT_LINE_WIDTH", k) sets the line width of output for the current <strong>Matvec</strong> working<br />

session to k. The default value is 80. this.parameter( "OUTPUT_LINE_WIDTH") returns the line width of<br />

output in the current <strong>Matvec</strong> working session.<br />

this.parameter( "INPUT_LINE_WIDTH", k) sets the line (record) width for input in the current <strong>Matvec</strong><br />

working session to k. The default value is 1024. this.parameter( "INPUT\_LINE\_WIDTH") returns the line<br />

(record) width for input in the current <strong>Matvec</strong> working session.<br />

this.parameter( "MAX_ERRORS", k) sets the maxmum number of errors allowed for the current <strong>Matvec</strong><br />

working session to k. The default value 15. this.parameter( "MAX_ERRORS") returns the maxmum number of<br />

errors allowed for the current <strong>Matvec</strong> working session.<br />

For example,<br />

> this.parameter("OUTPUT_PRECISION")<br />

9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!