ParameterVector module

class ParameterVector

Implements the ParameterVector class. This class is used to create a vector of named parameters.

See also:

Parameter

To access the individual parameter objects created, use the subscript. For example:

>>> myparamvec = ParameterVector("test", 6)
>>> qc.u(myparamvec[0], myparamvec[1], myparamvec[2], 1)
ParameterVector(self, name, length)

This is the constructor for the ParameterVector class.

Args:
name (str):

The symbolic name of the parameter object that is to be created.

length (int):

Total number of parameter objects to be created.

Returns:

The ParameterVector object.

Raises:

None.

name(self)

Returns the symbolic name of the parameter vector.

Args:

None.

Returns:

Symbolic name of the parameter object.

Raises:

None.

resize(self, length)

Resizes the parameter vector with the given length.

Args:
length (int):

The new length of the parameter vector. The vector is shrunk or expanded to fullful this request.

Returns:

Symbolic name of the parameter object.

Raises:

None.

params(self)

Returns a vector of parameter objects corresponding to this vector object.

Args:

None.

Returns:

A vector parameter objects corresponding to the vector object.

Raises:

None.

index(self, value)

Returns the index number of the object, if present in the vector.

Example:

>>> myparamvec = ParameterVector("test_param", 10)
>>> print(myparamvec.index(Parameter("test_param[0]")))

The above two lines of code produces output 0.

Args:
value (Parameter):

The Parameter object whose index in the vector to be found.

Returns:

The index number of the object, if present in the vector.

Raises:
RunTimeError:

Invalid Parameter passed to the function, if the object can not be located in the vector