Does tilda in a function output give any speed up?
조회 수: 2 (최근 30일)
이전 댓글 표시
If, say, I use
[a,b,~]=svd(d);
instead of
[a,b,c]=svd(d);
should I generally expect any speed up and/or memory saving? Or it depends on the function I use and should be tested each time?
댓글 수: 0
답변 (3개)
Star Strider
2016년 3월 12일
Time it and find out!
I doubt it, though. The value is still calculated, but no space is made for it in the calling function workspace.
댓글 수: 0
Jan
2016년 3월 12일
From inside the function there is no way to check, if the 3rd agrument is caught in the caller or not. Therefor the runtime for the function must be the same. But the calling function can free the memory for the argument immediately. For huge arrays this can be an advantage under certain circumstances, but not in general.
댓글 수: 0
Kuba
2016년 7월 25일
And what about using tilda in input arguments, say:
[a,b,c]=svd(~, e);
Instead of:
[a,b,c]=svd(d, e);
Is there any difference in performance?
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!