scipy.io.

hb_write#

scipy.io.hb_write(path_or_open_file, m, hb_info=None)[Quelle]#

HB-Format-Datei schreiben.

Parameter:
path_or_open_filePfad-ähnlich oder datei-ähnlich

Wenn ein datei-ähnliches Objekt übergeben wird, wird es wie es ist verwendet. Andernfalls wird es vor dem Schreiben geöffnet.

msparse Array oder Matrix

das zu schreibende sparse Array

hb_infoHBInfo

enthält die Metadaten für das Schreiben

Rückgabe:
None

Hinweise

Derzeit wird nicht das vollständige Harwell-Boeing-Format unterstützt. Unterstützte Merkmale sind:

  • zusammengesetzte, nicht-symmetrische, reelle Matrizen

  • Integer für Zeiger/Indizes

  • Exponentialformat für Float-Werte und Int-Format

Beispiele

Wir können eine Harwell-Boeing-Formatdatei lesen und schreiben

>>> from scipy.io import hb_read, hb_write
>>> from scipy.sparse import csr_array, eye
>>> data = csr_array(eye(3))  # create a sparse array
>>> hb_write("data.hb", data)  # write a hb file
>>> print(hb_read("data.hb", spmatrix=False))  # read a hb file
<Compressed Sparse Column sparse array of dtype 'float64'
    with 3 stored elements and shape (3, 3)>
    Coords  Values
    (0, 0)  1.0
    (1, 1)  1.0
    (2, 2)  1.0