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)
| 339 | |
| 340 | |
| 341 | def 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 | |
| 373 | def orthonormalize(basis: list[Vector[_T]]) -> None: |
no test coverage detected