withall: A Shorthand for Nested for Loop + If Statement
- 397 Downloads
The combination of for loop and if statement is very common in array programming. The for loop iterates over the elements in the array, the if statement filters out the required elements and are processed. A shorthand for this combination is developed from the observation that the information required for the loop indexing is often available in the processing statement. We also present a fast and efficient implementation of the loop for Single Dimensional arrays, with a minute increase in time for compilation.
KeywordsArray processing For loop If statement Programming language construct
The authors express their gratitude to all members of the Chapel development team, especially to Brad Chamberlain and Michael Ferguson for lending a helping hand during the times of dilemma. The time and effort they have spent to prepare lengthy reply mails in the layman’s language deserves thanks beyond words.
- 1.Arrays: The Julia Language. https://docs.julialang.org/en/latest/base/arrays/#Base.fill
- 2.numpy.full—NumPy v1.18.dev0 Manual. https://numpy.org/devdocs/reference/generated/numpy.full.html
- 3.Arrays—Chapel Documentation 1.20. https://chapel-lang.org/docs/primers/arrays.html
- 4.index [SaC-Home]. http://www.sac-home.org/doku.php
- 6.Data Structures—Python 3.7.5rc1 documentation. https://docs.python.org/3/tutorial/datastructures.html
- 7.Indexing— umPy v1.18.dev0 Manual. https://numpy.org/devdocs/reference/arrays.indexing.html#boolean-array-indexing
- 8.Chapel: Productive Parallel Programming. https://chapel-lang.org/
- 9.Modules—Chapel Documentation 1.20. https://chapel-lang.org/docs/primers/modules.html
- 10.Iterators—Chapel Documentation 1.20. https://chapel-lang.org/docs/primers/iterators.html
- 11.Time—Chapel Documentation 1.20. https://chapel-lang.org/docs/modules/standard/Time.html
- 12.GNU Time - GNU Project - Free Software Foundation. https://www.gnu.org/software/time/