Simplify array indexing
Replace multiply operations in array indices when accessing arrays in a loop
Model Configuration Pane: Code Generation / Optimization
Description
The Simplify array indexing parameter instructs the code generator whether to replace multiply operations in array indices when accessing arrays in a loop.
Settings
off
(default) | onDefault: Off
- On
In array indices, replace multiply operations with add operations when accessing arrays in a loop in the generated code. When the original signal is multidimensional, the Embedded Coder® generates one-dimensional arrays, resulting in multiply operations in the array indices. Using this setting eliminates costly multiply operations when accessing arrays in a loop in the C/C++ program. This optimization (commonly referred to as strength reduction) is particularly useful if the C/C++ compiler on the target platform does not have similar functionality. The absence of multiply operations in the C/C++ program does not imply that the C/C++ compiler does not generate multiply instructions.
- Off
Leave multiply operations in array indices when accessing arrays in a loop.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | On (execution speed) |
Safety precaution | No impact |
Programmatic Use
Parameter: StrengthReduction |
Type: character vector |
Value: 'on' | 'off' |
Default: 'off' |
Version History
Introduced in R2009a