get_vec#

AnsMath.get_vec(dtype=None, name=None, fname='file.full', mat_id='RHS', asarray=False)#

Load a vector from a FULL file.

Parameters:
dtypenumpy.dtype, optional

NumPy data type to store the vector as. The options are np.double, np.int32, and np.int64. The default is np.double.

namestr, optional

AnsMath vector name. The default is None, in which case a name is automatically generated.

fnamestr, optional

Name of the file to read the vector from. The default is "file.full".

mat_idstr, optional

Vector ID to load. If loading from a "*.full" file, the vector ID can be one of the following:

  • "RHS": Load vector

  • "GVEC": Constraint equation constant terms

  • "BACK": Nodal mapping vector (internal to user) If this vector ID is used, the default dtype is np.int32.

  • "FORWARD" - Nodal mapping vector (user to internal). If this vector ID is used, the default dtype is np.int32.

asarraybool, optional

Whether to return a NumPy array rather than an AnsMath vector. The default is False.

Returns:
AnsVec or numpy.ndarray

AnsMath vector or NumPy array vector, depending on the value for the asarray parameter.

Examples

>>> vec = mm.get_vec(fname='PRSMEMB.full', mat_id="RHS")
>>> vec
AnsMath vector size 126