Is it possible to determine the byte size of a scipy.sparse matrix? In NumPy you can determine the size of an array by doing the following:
import numpy as np
print(np.zeros((100, 100, 100).nbytes)
8000000
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A sparse matrix is constructed from regular numpy arrays, so you can get the byte count for any of these just as you would a regular array.
If you just want the number of bytes of the array elements:
If you want the byte counts of all arrays required to build the sparse matrix, then I think you want: