PSCF v1.3
pscfpp.param.Matrix Class Reference

A Matrix represents a matrix-valued parameter in parameter file. More...

Public Member Functions

 __init__ (self, label, file)
 Constructor.
 read (self, file)
 Read the a parameter block from a file.
 __str__ (self)
 String representation of this Matrix object.
 getString (self, depth='')
 Indented string representation of this Matrix object.
 returnData (self)
 Return the value of this Matrix as a list of lists.
 setValue (self, val)
 Set a new value for this Matrix.

Detailed Description

A Matrix represents a matrix-valued parameter in parameter file.

A Matrix object represents a two-dimensional array or matrix of element values. A matrix appears in a parameter file in a multi-line format that begins with a line containing a label immediately followed by an opening parenthesis and ends with a line containing only a closing parenthesis. In between, each line contains a row index, a column index and the value of a single element of the matrix.

Definition at line 691 of file param.py.

Constructor & Destructor Documentation

◆ __init__()

Member Function Documentation

◆ read()

pscfpp.param.Matrix.read ( self,
file )

Read the a parameter block from a file.

This function reads the elements of a Matrix from the file object that is passed as a parameter. On entry, the opening line containing the opening curly bracket ("{") must already have been processed, and the first unread line of the file should contain the value of the first element. Reading stops stops when the closing "}" is read.

Parameters
filea file object, open for reading

Definition at line 716 of file param.py.

References pscfpp.param.getValue(), pscfpp.param.Array.val, val, and pscfpp.param.Parameter.val.

Referenced by __init__().

◆ __str__()

pscfpp.param.Matrix.__str__ ( self)

String representation of this Matrix object.

This function return a multi-line string representation of this Matrix object in the PSCF param file format, with no indentation of the first line.

Definition at line 747 of file param.py.

References pscfpp.param.Array.getString(), pscfpp.param.Composite.getString(), getString(), and pscfpp.param.Parameter.getString().

◆ getString()

pscfpp.param.Matrix.getString ( self,
depth = '' )

Indented string representation of this Matrix object.

This function returns an indented string representation of this Matrix object in PSCF parameter file format, with a controllable indentation of the first line.

Parameters
depththe spaces string as the prefix depth.

Definition at line 759 of file param.py.

References pscfpp.command.Command.label, pscfpp.param.Array.label, pscfpp.param.Composite.label, label, pscfpp.param.Parameter.label, pscfpp.param.Array.val, val, and pscfpp.param.Parameter.val.

Referenced by __str__().

◆ returnData()

pscfpp.param.Matrix.returnData ( self)

Return the value of this Matrix as a list of lists.

Definition at line 771 of file param.py.

References pscfpp.param.Array.val, val, and pscfpp.param.Parameter.val.

◆ setValue()

pscfpp.param.Matrix.setValue ( self,
val )

Set a new value for this Matrix.

This function sets the new value, parameter val, to the Matrix object.

Parameters
valthe new value

Definition at line 782 of file param.py.

References pscfpp.param.getValue(), pscfpp.param.Array.val, val, and pscfpp.param.Parameter.val.


The documentation for this class was generated from the following file: