Download Area
Here you can download free versions of Rturbo/P with various example programs.
Extract the files to a directory of your choice. For further information see below.
Download Rturbo/P 2015_06 for
Linux (Ubuntu 14.04LTS, 64bit, tar.gz archive)
RaspberryPi (.zip archive)
Mac OS X (64bit, tar.gz archive)
Windows 7 (.tar.gz archive)
A manual will be provided as soon as possible. Meanwhile, please study the example programs to learn what kind of R code you can speedup with P.
Installation Instructions for Windows:
The Rturbo/P system comes as a command line tool as well as a shared library. The standalone compiler is invoked from a Windows command prompt ('cmd.exe') or from MSYS. It complies text files. The current version does not provide an interactive mode. To install P proceed as follows:
- Download the zip archive.
- Extract the zip archive to a directory of your choice.
- Start a command prompt (cmd).
- Go to the directory Pdemo. Here you find Pc.exe and libgomp-1.dll (which is needed). If libgomp-1.dll is not yet installed on your system, copy it to windows/system32 or to the directory from which you invoke Pc.exe.
- To run an example program enter, e.g. '.\Pc examples\linear_model.P'
- To edit the P programs, you may use notepad, e.g. 'notepad linear_model.P'
Since P programs can be embedded into R programs, you can also use RStudio to edit and run programs. Start RStudio, load example1.R in the examples folder, set the working directory to the source location and run example1.R to see how it works!
Major Changes and Improvements of Version P2015_06:
- Vectors of strings such as x = c('hello', 'world') implemented. You can access elements as usual, e.g. x[2], but multiindices are not yet implemented (i.e. x[1:2] etc. does not work). Mixing of numbers and strings is not possible (use lists in those cases). Internally, vectors of strings are implemented as in C. Hence, a call such as C_('my_C_function', &x ) allows to feed a C function with an array of strings (as referenced by char **stringarray).
- One can now access those command line args following the P source file name using the functions argc(), which returns the number of arguments, and argv(i), which returns the ith argument as a string. Example:
./Pc -O -nw myprog.P hello world 10
here argc() equals 3 and argv(1) gives 'hello', argv(2) gives 'world' and argv(3) '10'.
- Slightly improved and extended standard libraries.
Major Changes and Improvements of Version P2015_03:
- On-the-fly compilation and linkage of C and C++ extensions added (see gcc.P and g++.P in the examples folder), allowing to include the C/C++ sources directly in the P source file. This feature requires that gcc/g++ is installed on the system (mingw/MSYS on Windows systems).
- strreplace allows to substitute substrings in a string (see strreplace.P in the examples folder).
- for loops can now iterate over the items of a list
- Random number generators: rbeta, rgamma, rchisq, rpois, rlogistic, rcauchy, rlognormal, rexp
- the system() statement allows to invoke system commands. See gcc.P for an example.
- Easy-to-use interface to run P scripts (given as a string or as a text file) from C. See the example in the folder embed_PinC.
- Rturbo/P is compiled with gcc/g++ version 4.8 (Linux, Windows) or 4.6 (OS X).
Major Changes and Improvements of Version P2013_11:
-
Scope of variables: To improve compatability with R, the scope of global variables has been changed. If a variable exists globally, it can be used inside a function. But an assignment with '=' inside a function does not change its global value. Instead a local variable with the same name is introduced. As a consequence, P has now the same behavior as R. If you want set a global variable inside a function, use <<- (as in R).
- The system libraries stdlib.P and stdmath.P are now automatically included. If you want to work with modified versions, one can simply add corresponding source statements.
- One may now omit the return statement in a function definition. In this case, a return( NULL ) is automatically added. This means, functions with no return statement return the special value NULL.
- In strings special characters such as \n or \t can now be used. For instance,
cat( 'Hello, 2 * 2 is equal to ' + 2*2 + '.\n\nBye!' )
does now what it is expected to do.
- The syntatic shortcut '.(' for a function definitions has been introduced. Instead of
sq = function( x ) return(x*x)
one may write
sq = .( x ) return(x*x)
or
sq <- .( x ) return(x*x)
which sometimes improves the readibility (and looks more mathematical).
- The example oo.P on object oriented programming has been polished and should now give a clear picture how the object system works.
Major Changes and Improvements of Version P2012_11:
- Tentative version of fprintf, fscanf and sscanf added (see files3.P for an example).
- Parallel for loop added.
- Some minor bug fixes, closing a memory hole when calling repeatedly from R.
Major Changes and Improvements of Version P2012_10:
- Optimizations for array indexing improved.
- fread/fwrite/filelength added.
- Improved fork() functionality for parallel cluster computing.
- Ported to Raspberry Pi (ARM).
Major Changes and Improvements of Version P2012_08:
- Communication via sockets added.
- Parallel cluster computing via fork() added.
- All version require core2 cpus or equivalent.
Major Changes and Improvements of Version P2012_05:
- Interface (libP) revised ensuring stable JAVA integration.
- The OSX port is now compiled with gcc-mp-4.3, since later versions have a bug such that libP can not be used within RStudio.
Major Changes and Improvements of Version P2012_03:
- Local variables are now detected automatically. The var statement in a function is no longer required.
- If the return statement of a function is missing, return( NULL ) is automatically added.
- Improved I/O functionalities (reading and writing of files)
- A lot of small bugs have been fixed.
- The system now can be used with RStudio.
- New release for OS X.
Major Changes and Improvements of Version P2011_06:
- Support for strings added.
- Support for type boolean added.
- Default expressions for function arguments supported.
- JAVA-like object system (Pro)
Additional Notes
- The compiler has been carefully developed and tested. However, there may still be bugs and it does not provide a full implementation of R. Please take the example programs as starting points for your own experiments.
- Both he compiler and the runtime system perform usually no checks. In particular, there are no out-of-range checks when working with vectors and matrices.
- In the directory embed_R you find an example how to embed P into R programs.
- In the directory example_shared you find examples which demonstrate how to load dynamically a shared library with functions written in C and C++, respectively.