Use algorithms optimized for row-major array layout

Description

Enable algorithms for row-major format code generation and corresponding row-major algorithms for simulation.

Category: Math and Data Types

Settings

Default: Off

When Array layout (Simulink Coder) is set to Row-major, the code generator uses algorithms to maintain consistency of numeric results between the simulation and the generated code. Sometimes, the generated code for these algorithms can be inefficient. You can enable the Use algorithms optimized for row-major array layout configuration parameter to enable efficient algorithms, which might result in numeric differences between simulation and generated code. To enable the lookup table, sum, and product blocks for efficient row-major code generation, use this configuration parameter. The Use algorithms optimized for row-major array layout parameter affects the simulation and the generated code.

On

Use algorithms optimized for row-major array layout when Array layout is set to Row-major.

Off

Do not use algorithms optimized for row-major array layout when Array layout is set to Column-major.

Tips

When Array layout is set to Row-major, the row-major algorithm operates on table data that is contiguous in memory. This table data leads to faster cache access, making these algorithms cache-friendly.

This table summarizes the relationship between array layout and cache-friendly algorithms. It is recommended to use the algorithm that is optimized for the specified array layout to achieve good performance. For example, select Use algorithms optimized for row-major array layout when the Array layout is set to Row-major for code generation.

Command-Line Information

Parameter: UseRowMajorAlgorithm
Type: character vector
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precautionNo impact

Related Topics