Memory usage of a function

23 ビュー (過去 30 日間)
Iassen Iben
Iassen Iben 2021 年 12 月 30 日
回答済み: Walter Roberson 2021 年 12 月 30 日
I am trying to measure the memory usage of a function. I would like to compare the memory requirements for different methods of solving a linear system of equations. I am looking for a way of measuring it like this:
N = 100;
A = rand(N, N);
b = rand(N, 1);
mem1 = memory(sol = A \ b);
mem2 = memory(sol = sparse(A) \ b);

回答 (2 件)

KSSV
KSSV 2021 年 12 月 30 日
N = 100;
A = rand(N, N);
b = rand(N, 1);
mem1 = A \ b ;
mem2 = sparse(A) \ b ;
whos mem1 mem2
Name Size Bytes Class Attributes mem1 100x1 800 double mem2 100x1 800 double

Walter Roberson
Walter Roberson 2021 年 12 月 30 日

カテゴリ

Help Center および File ExchangeLinear Algebra についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by