MCPcopy Create free account
hub / github.com/FEniCS/dolfinx / vector

Function vector

python/dolfinx/la/__init__.py:341–370  ·  view source on GitHub ↗

Create a distributed vector. Args: map: Index map the describes the size and distribution of the vector. bs: Block size. dtype: The scalar type. Returns: A distributed vector.

(map, bs=1, dtype: npt.DTypeLike = np.float64)

Source from the content-addressed store, hash-verified

339
340
341def vector(map, bs=1, dtype: npt.DTypeLike = np.float64) -> Vector:
342 """Create a distributed vector.
343
344 Args:
345 map: Index map the describes the size and distribution of the
346 vector.
347 bs: Block size.
348 dtype: The scalar type.
349
350 Returns:
351 A distributed vector.
352 """
353 if np.issubdtype(dtype, np.float32):
354 vtype = _cpp.la.Vector_float32
355 elif np.issubdtype(dtype, np.float64):
356 vtype = _cpp.la.Vector_float64
357 elif np.issubdtype(dtype, np.complex64):
358 vtype = _cpp.la.Vector_complex64
359 elif np.issubdtype(dtype, np.complex128):
360 vtype = _cpp.la.Vector_complex128
361 elif np.issubdtype(dtype, np.int8):
362 vtype = _cpp.la.Vector_int8
363 elif np.issubdtype(dtype, np.int32):
364 vtype = _cpp.la.Vector_int32
365 elif np.issubdtype(dtype, np.int64):
366 vtype = _cpp.la.Vector_int64
367 else:
368 raise NotImplementedError(f"Type {dtype} not supported.")
369
370 return Vector(vtype(map, bs))
371
372
373def orthonormalize(basis: list[Vector[_T]]) -> None:

Callers 7

meshFunction · 0.85
declare_bbtreeFunction · 0.85
declare_meshFunction · 0.85
declare_objectsFunction · 0.85
build_entity_typesFunction · 0.85
comm_graphMethod · 0.85
MatrixCSRMethod · 0.85

Calls 1

VectorClass · 0.70

Tested by

no test coverage detected