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:
- dtype
numpy.dtype
,optional
NumPy data type to store the vector as. The options are
np.double
,np.int32
, andnp.int64
. The default isnp.double
.- name
str
,optional
AnsMath vector name. The default is
None
, in which case a name is automatically generated.- fname
str
,optional
Name of the file to read the vector from. The default is
"file.full"
.- mat_id
str
,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 defaultdtype
isnp.int32
."FORWARD"
- Nodal mapping vector (user to internal). If this vector ID is used, the defaultdtype
isnp.int32
.
- asarraybool,
optional
Whether to return a NumPy array rather than an AnsMath vector. The default is
False
.
- dtype
- Returns:
AnsVec
ornumpy.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