AW: [scilab-Users] Why an interpreter?

Pedro Ledoux p_ledoux at yahoo.com.br
Sat Oct 2 15:18:06 CEST 2010


About compiled languages the best alternative for numerical methods is Fortran standart 95. Unlike C and othe common languages, Fortran is dedicated to numerical aplications thus it's intrinsic functions are almost dedicated to it. In common languages like C, Pascal etc you have Integer and real types. Fortran gives you integer, real and complex. All math functions like sin, sqrt etc are completly ready to support complex type.

Fortran 95 was an great advance compared with Fortran 77. To turn the things more easy to numerial implemetation Fortran let you manipulate a vector with 1 line of command, ex: v=cos(i) will turn each element of vector v in the cossine of each element of vector i, in a conventional language you'd have to use a loop to do it. 

Fortran 95 has incorporated also commands for high performance and paralelization. When you do something in a loop for i=0:1:10 you says to computer that this process must run in order, first for i=0, i=1 i=2 etc. In Fortran 95 the command Forall acts in a way like for however you says to computer thar the process can be done in any order, as consequence it can run in more than one CPU if possible.

Was told thar Scilab let you use Fortran code in the same way as C code.

--- Em sáb, 2/10/10, Harald Galda, Dr. Eng. (J) <haraldgalda at yahoo.com> escreveu:

De: Harald Galda, Dr. Eng. (J) <haraldgalda at yahoo.com>
Assunto: AW: [scilab-Users] Why an interpreter?
Para: users at lists.scilab.org
Data: Sábado, 2 de Outubro de 2010, 9:44

Hello everyone.

Even though I am no expert in the field of compilers and interpreters I would like to share some thoughts and observations.

Matlab does have a compiler. The compiler is a separate toolbox  and more expensive than Matlab itself or any other toolbox. However, a compiled program does not run faster than the interpreted program run in Matlab. Maybe a compiled program is a little faster if Matlab is not installed and therefore does not occupy any resources such as RAM and disk space. 

There is another interesting effect: a function called for the first time during a session runs much slower than during all consecutive runs. So it seems that the interpreter translates the source code into some intermediate code. A function that runs on the Matlab level can access the
 resources of the basis software such as work space and it can display outputs on the basis software console. This would be completely impossible if the function were compiled as a stand alone program. Running selected parts of a script or function also requires interpreted code.

It is possible to call compiled programs written in C from Scilab, Matlab or Mathematica. However, these programs usually must exchange data with the basis software or functions calling these programs. It takes time to copy huge amounts of data or to write them to and read them from disk. Therefore, it is not desirable to compile each and any function as a separate program. A compiler is necessary for stand alone software, but not for functions run inside numerical software.

Stand alone programs are often written in C or C++. There are a lot of libraries written in these languages. Moreover, there are some wide spread development environments for C and C++.
 Embedded Matlab, Simulink and XCos can generate C code. Maybe there will be something like embedded Scilab to create C code in the future. Therefore, it is possible to combine the advantages of interpreted numerical software and fast C programs.

For these reasons, I conclude that numerical software will continue to run interpreted code for the time being.

Best regards
Harald Galda, Dr. Eng. (J)


Von: Pedro Ledoux <p_ledoux at yahoo.com.br>
An: users at lists.scilab.org
Gesendet: Samstag, den 2. Oktober 2010, 4:01:50 Uhr
Betreff:
 [scilab-Users] Why an interpreter?

Hello everyone.

Scilab, Matlab, Octave and others softwares of this kind uses an interpreter not a compiler. Is there any specific rason to do it? I don't know deeply the technical details about interpreters and compilers but i've become curious about it. In long interative process a compiled code runs much more faster because in a interpreter to each interation the language commands should be converted to machine language and in a compiled one it happens only one time when the object code is generated. Was told me that in a interpreter debug is more easy. So why those everyoments chose do numerical process by an interpreted language?





        




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20101002/d4f8233b/attachment.htm>


More information about the users mailing list