<< emx_codegen Scilab Code Generator Xcos Code Generator >>

Scilab Code Generator >> Scilab Code Generator > Scilab Code Generator

Scilab Code Generator

Efficient, comprehensible and compact embedded single-core C/C++ code generation from Scilab code.

Description

This module implements a code-generator for Scilab and is based on a remote emmtrix Code Generator (eCG).

Demonstration

a = (1:3)';
b = (1:4);

c = a * b
int main() {
  double c_data[4][3]; 
  double chain1_data[3]; 
  static const double init1[3] = {1, 2, 3} ; 
  size_t i1, i2, i4, i5, i6; 
  double sum1; 
  
  // matrixmul.sce(5:1-10):  c = a * b
  #pragma EMX_KILLVAR c_data
  
  #pragma EMX_KILLVAR chain1_data
  
  for (i4 = 0; i4 < 3; i4++) {
    chain1_data[i4] = (int32_t )(init1[i4]); 
  } 
  for (i2 = 0; i2 < 4; i2++) {
    for (i1 = 0; i1 < 3; i1++) {
      sum1 = 0; 
      
      sum1 += chain1_data[i1] * (double )(((int32_t )(i2) + 1)); 
      
      c_data[i2][i1] = sum1; 
    } 
  } 
  
  // matrixmul.sce(5:10-11)
  puts("c = "); 
  for (i5 = 0; i5 < 3; i5++) {
    for (i6 = 0; i6 < 4; i6++) {
      printf(" %11.6g", c_data[i6][i5]); 
    } 
    puts(""); 
  } 
  
  return 0; 
}

Terms of Use

emmtrix Technologies kindly provides a free web frontend to the code generator.

Your submissions to the service may be accessible from any part of the world and any information they contain may be used by emmtrix Technologies and the public, both within and outside the country from which you posted. You understand that emmtrix Technologies does not guarantee any confidentiality with respect to any content you submit.

You are solely responsible for the support and maintenance of any content you submit through this service. All new submissions of content posted by users will be licensed under the BSD license unless otherwise noted.

See also


Report an issue
<< emx_codegen Scilab Code Generator Xcos Code Generator >>