Generated by DocFX

Class NpzFormat

Provides static methods to save and load files saved in NumPy's .npz format.

Inheritance
System.Object
NpzFormat
Namespace: ISynergy.Framework.Mathematics.IO
Assembly: ISynergy.Framework.Mathematics.dll
Syntax
public static class NpzFormat : object

Methods

View Source

Load<T>(Stream)

Gets a lazily-instantiated array that can be used to load matrices of the specified type from a stream.

Declaration
public static NpzDictionary<T> Load<T>(Stream stream)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
Stream stream

The stream containing the matrix to be loaded.

Returns
Type Description
NpzDictionary<T>

The array to be returned.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(Stream, out T)

Loads an array of the specified type from a file in the disk.

Declaration
public static void Load<T>(Stream stream, out T value)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
Stream stream

The stream containing the matrix to be loaded.

T value

The object to be read. This parameter can be used to avoid the need of specifying a generic argument to this function.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(Stream, out NpzDictionary<T>)

Gets a lazily-instantiated array that can be used to load matrices of the specified type from a stream.

Declaration
public static NpzDictionary<T> Load<T>(Stream stream, out NpzDictionary<T> value)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
Stream stream

The stream containing the matrix to be loaded.

NpzDictionary<T> value

The object to be read. This parameter can be used to avoid the need of specifying a generic argument to this function.

Returns
Type Description
NpzDictionary<T>

The array to be returned.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(Byte[])

Gets a lazily-instantiated array that can be used to load matrices of the specified type from an array of bytes.

Declaration
public static NpzDictionary<T> Load<T>(byte[] bytes)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
System.Byte[] bytes

The bytes that contain the matrix to be loaded.

Returns
Type Description
NpzDictionary<T>

The array to be returned.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(Byte[], out T)

Loads an array of the specified type from an array of bytes.

Declaration
public static void Load<T>(byte[] bytes, out T value)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
System.Byte[] bytes

The bytes that contain the matrix to be loaded.

T value

The object to be read. This parameter can be used to avoid the need of specifying a generic argument to this function.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(String)

Gets a lazily-instantiated array that can be used to load matrices of the specified type from a file in the disk.

Declaration
public static NpzDictionary<T> Load<T>(string path)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
System.String path

The path to the file containing the matrix to be loaded.

Returns
Type Description
NpzDictionary<T>

The array to be returned.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(String, out T)

Loads an array of the specified type from a file in the disk.

Declaration
public static void Load<T>(string path, out T value)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
System.String path

The path to the file containing the matrix to be loaded.

T value

The object to be read. This parameter can be used to avoid the need of specifying a generic argument to this function.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

Load<T>(String, out NpzDictionary<T>)

Gets a lazily-instantiated array that can be used to load matrices of the specified type from a file in the disk.

Declaration
public static NpzDictionary<T> Load<T>(string path, out NpzDictionary<T> value)
    where T : class, ICloneable, IList, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable
Parameters
Type Name Description
System.String path

The path to the file containing the matrix to be loaded.

NpzDictionary<T> value

The object to be read. This parameter can be used to avoid the need of specifying a generic argument to this function.

Returns
Type Description
NpzDictionary<T>

The array to be returned.

Type Parameters
Name Description
T

The type to be loaded from the npy-formatted file.

View Source

LoadJagged(Stream, Boolean)

Loads a jagged array from a stream.

Declaration
public static NpzDictionary<Array> LoadJagged(Stream stream, bool trim = true)
Parameters
Type Name Description
Stream stream

The stream containing the matrix to be loaded.

System.Boolean trim

Pass true to remove null or empty elements from the loaded array.

Returns
Type Description
NpzDictionary<Array>

A jagged array containing the values available in the given stream.

View Source

LoadJagged(Byte[])

Gets a lazily-instantiated array that can be used to load jagged matrices from an array of bytes.

Declaration
public static NpzDictionary<Array> LoadJagged(byte[] bytes)
Parameters
Type Name Description
System.Byte[] bytes

The bytes that contain the matrix to be loaded.

Returns
Type Description
NpzDictionary<Array>

A collection of arrays.

View Source

LoadJagged(String)

Gets a lazily-instantiated array that can be used to load jagged matrices from a file in the disk.

Declaration
public static NpzDictionary<Array> LoadJagged(string path)
Parameters
Type Name Description
System.String path

The path to the file containing the matrix to be loaded.

Returns
Type Description
NpzDictionary<Array>

A collection of arrays.

View Source

LoadMatrix(Stream)

Gets a lazily-instantiated array that can be used to load multi-dimensional matrices from a stream.

Declaration
public static NpzDictionary<Array> LoadMatrix(Stream stream)
Parameters
Type Name Description
Stream stream

The stream containing the matrix to be loaded.

Returns
Type Description
NpzDictionary<Array>

A collection of arrays.

View Source

LoadMatrix(Byte[])

Gets a lazily-instantiated array that can be used to load multi-dimensional matrices from an array of bytes.

Declaration
public static NpzDictionary<Array> LoadMatrix(byte[] bytes)
Parameters
Type Name Description
System.Byte[] bytes

The bytes that contain the matrix to be loaded.

Returns
Type Description
NpzDictionary<Array>

A collection of arrays.

View Source

LoadMatrix(String)

Gets a lazily-instantiated array that can be used to load multi-dimensional matrices from a file in the disk.

Declaration
public static NpzDictionary<Array> LoadMatrix(string path)
Parameters
Type Name Description
System.String path

The path to the file containing the matrix to be loaded.

Returns
Type Description
NpzDictionary<Array>

A collection of arrays.

View Source

Save(Array, CompressionLevel)

Saves the specified array to an array of bytes.

Declaration
public static byte[] Save(Array array, CompressionLevel compression = null)
Parameters
Type Name Description
Array array

The array to be saved to the array of bytes.

CompressionLevel compression

The compression level to use when compressing the array.

Returns
Type Description
System.Byte[]

A byte array containig the saved array.

View Source

Save(Array, Stream, CompressionLevel, Boolean)

Saves the specified array to a stream.

Declaration
public static void Save(Array array, Stream stream, CompressionLevel compression = null, bool leaveOpen = false)
Parameters
Type Name Description
Array array

The array to be saved to disk.

Stream stream

The stream to which the file will be saved.

CompressionLevel compression

The compression level to use when compressing the array.

System.Boolean leaveOpen

True to leave the stream opened after the file is saved; false otherwise.

View Source

Save(Array, String, CompressionLevel)

Saves the specified array to a file in the disk.

Declaration
public static void Save(Array array, string path, CompressionLevel compression = null)
Parameters
Type Name Description
Array array

The array to be saved to disk.

System.String path

The disk path under which the file will be saved.

CompressionLevel compression

The compression level to use when compressing the array.

View Source

Save(Dictionary<String, Array>, CompressionLevel)

Saves the specified arrays to an array of bytes.

Declaration
public static byte[] Save(Dictionary<string, Array> arrays, CompressionLevel compression = null)
Parameters
Type Name Description
Dictionary<System.String, Array> arrays

The arrays to be saved to the array of bytes.

CompressionLevel compression

The compression level to use when compressing the array.

Returns
Type Description
System.Byte[]

A byte array containig the saved arrays.

View Source

Save(Dictionary<String, Array>, Stream, CompressionLevel, Boolean)

Saves the specified arrays to a file in the disk.

Declaration
public static void Save(Dictionary<string, Array> arrays, Stream stream, CompressionLevel compression = null, bool leaveOpen = false)
Parameters
Type Name Description
Dictionary<System.String, Array> arrays

The arrays to be saved to disk.

Stream stream

The stream to which the file will be saved.

CompressionLevel compression

The compression level to use when compressing the array.

System.Boolean leaveOpen

True to leave the stream opened after the file is saved; false otherwise.

View Source

Save(Dictionary<String, Array>, String, CompressionLevel)

Saves the specified arrays to a file in the disk.

Declaration
public static void Save(Dictionary<string, Array> arrays, string path, CompressionLevel compression = null)
Parameters
Type Name Description
Dictionary<System.String, Array> arrays

The arrays to be saved to disk.

System.String path

The disk path under which the file will be saved.

CompressionLevel compression

The compression level to use when compressing the array.

See Also

NpyFormat