02/25/1995 This is the Macintosh port of RLaB 1.18c program. RLaB is a Matlab-like linear algebra package. The author is Ian Searle ians@eskimo.com RLaB is an interpreter for the RLaB Programming Language/Environment. The RLaB language is useful for matrix or array oriented numerical analyses. RLaB is especially useful for prototyping and experimenting with algorithms. RLaB extensively uses the BLAS, LAPACK, FFTPACK and RANLIB sources available from netlib.att.com and PLPLOT from dino.ph.utexas.edu. MacRLaB is not a full port of RLaB. Some items will probably never be fully supported as they are too tied to the Unix operating system. Examples are the 'pipe', the 'fork', and many others. Other features are handled a little differently in the Mac version. Most of the important differences or extensions of the MacRLaB port are described below. 1. Please print out and study the RLaB Primer first, the file is in ":doc:rlabp.ps". You can print this Postscript file using 'Drop¥PS' program (simply drag and drop it onto Drop¥PS). (Files in rlab folder are getting larger, many folders are compressed as self-extracting-archives (.sea), you can double-click on them to uncompress them.) 2. You can set up your own file search-path(RLAB_SEARCH_PATH), start-up file (RLAB_RC0), etc.. The default settings are stored in the file 'RLab-Preference'. To change these settings, just use a text editor to change. You have to set the PLPLOT_DIR environmental variable to the path of your RLaB folder. This setting is important because PLPLOT has to know the location of font files 'plstnd5.fnt' and 'plxtnd5.fnt'. After making the changes, the file 'RLab-Preference' has to be placed in the 'System Folder:Preferences' folder. For example, if your absolute RLaB folder (directory) path is like this HD --- Appl --- RLaB then you can put the following environmental variables in 'RLab-Preference': RLAB_RC0 = "HD:Appl:RLaB:_rlab"; PLPLOT_DIR = "HD:Appl:RLaB"; RLAB_HELP_DIR = "HD:Appl:RLaB:help"; RLAB_LIB_DIR = "HD:Appl:RLaB:rlib"; RLAB_SEARCH_PATH = ";HD:Appl:RLaB:toolbox;HD:Appl:RLaB:examples"; You can have several search-paths, just put them together and use ';' as delimiter (see above example with 3 search paths, first one is for the current folder). If you feel the font/size on the MacRLaB console is not the best choice, feel free to change it. The environmental variable RLAB_FONT can be set to one of the following numbers (check Mac document for more): 0 SystemFont 1 AppleFont 2 NewYork 3 Geneva 4 Monaco 5 Venice 6 London 7 Athens 8 SanFrancisco 9 Toronto 11 Cairo 12 LosAngles 20 Times 21 Helvetica 22 Courier It is better to use constant width fonts such as Monaco and Courier, otherwise the output will not be aligned. The font size (RLAB_SIZE) can be set to any number between 1 and 127 point. The popular font sizes for the console are 9 points 10 points 11 points 12 points 14 points 18 points You can change the number of text rows (RLAB_ROWS) on the console. Default values are RLAB_FONT = "4 Monaco"; RLAB_SIZE = "9 points"; RLAB_ROWS = "25"; The console window width will be set to 80 columns based on the largest character width of the selected font. 3. By the way, do you know how to change directory (folder) using cd() on the Mac? Suppose your hard disk directory tree is like this ----- Peggy | |-- rlib --------- App -----| | | | |-- examples HD ---| ----- RLaB (you are here) ----| | |-- help -------- Kevin | |-- toolbox When you launch RLaB, you are in RLaB directory. If you wish to change directory to "examples", you can use either >cd(":examples"); // relative method or >cd("HD:App:RLaB:examples"); // absolute method The colon ":" means present directory, it is similar to "." on the Unix but not exactly the same. You MUST supply a ":" as first char if partial (relative) pathname is used. If the first character of a pathname is not a ":", it is a full (absolute) pathname. Two colons "::" means parent directory (folder). Three colons ":::" means grandparent directory. The ":" character also acts as directory delimiter, like "/" on the unix and "\" on the MS-DOS. For example, if your work directory is in Kevin and you are in RLaB now, you can use either >cd(":::Kevin"); // relative method or >cd("HD:Kevin"); // absolute method to change directory to Kevin. 4. RLaB comes with a built-in plotting library PLPLOT. PLPLOT is a powerful tool for XY and XYZ graphics. It can generate (via plprint) Postscript, color Postscript, HP LJ, and lots of other formats for post processing. I've implemented a minimum Mac interface for PLPLOT4.99i. Multi-window is allowed but the redrawing is slow; well, that depends on what machine you got. The number of windows is limited to 10. The mac-plplot interface is based on ColorQuickDraw routines. Sixteen colors are directly available in PLPLOT. These colors are pre-assigned as the following numbers: 1 2 3 4 5 6 7 8 black red yellow green aquamarine pink wheat gray 9 10 11 12 13 14 15 16 brown blue blueviolet cyan turquoise magenta salmon white You can select color by _plcol() function. More colors are available by using RGB combinations (see PLPLOT manual). There are three things remained to be done -- add scroll bar to the MacRLaB window, add copy/paste ability in the graphics windows, and add PICT image to the generated EPSF files. You can include the PLPLOT generated Postscript output (EPSF) in your document (Word, MacDraw, Canvas, TeX, ...) but you can only see a big crossed box (the bounding box) on the screen due to the lack of the PICT image. You can perform scaling, rotating, dragging,... on the box except there is no picture inside. Don't worry, the picture will appear in the printed copy. If you need superscript, subscript, over/under line char, and Greek letters in annotation of axis, title, etc., then you need to get a copy of PLPLOT manual. See README.PLPLOT for detail. There is a plotting example in ":examples:plot_test.r", try >rfile plot_test You can click on those background windows to see them again. The graphics windows are numbered as plplot 0, plplot 1, plplot 2, ..., and so on. You can also resize or drag them. Resizing on the screen will not affect the quality of later plprint() output. For each graph window, there is a temporary file (SCRATCH????) associated with it. It contains your plotting commands which can be used later to produce a Postscript or other types of graphics file (via plprint). It is also used by my Mac interface in redrawing. Don't dump them into trash can during the execution of MacRLaB. They will be automatically eliminated after the execution. Also, don't use pend() to close graphics windows unless you don't want to plot anymore. Use pclose() instead. plplot has a bug that it does not close the plotting command file even you close the graphics window by pend() or pclose(). So if you plot after pend(), the old picture together with the new picture will appear on the graphics window. If you plot several pages of PS graph into a file, you have to change the file type to 'TEXT' (all capital) by drag and drop the file onto ctc 1.5. After the file type has been changed, you can print it out by Drop¥PS or ShowPages. Why? Because plplot creates the PS output file in binary mode, but Drop¥PS and ShowPages accept only TEXT file. 5. The full history command editing capacity is built-in. To recall previous commands, just press up and down arrow keys. The 'control' key described in the RLaB Primer can be replaced by the 'command' key on the Mac keyboard. Delete-cursor-character (del) is also supported. The full description of command line editing is in the file ":help:COMMAND_EDIT", or type "help COMMAND_EDIT" in RLaB. 6. Your machine must have a 68020 or better cpu to run MacRLaB. You also need System 7 to run it. If your machine does not have an fpu (68881 or better) then you should run MacRLaB-nofpu instead of MacRLaB. Try >load("test") on your machine to see if your machine can pass all tests. 7. The total size of arrays is only limited by the available memory of your machine. If RLaB runs out of memory, it will display RLaB: out of memory. on the screen. You can either increase RLaB memory using 'Get Info' of System 7 Finder or, if your physical RAM is limited, turn on the virtual memory and set the memory size large enough for your application. 8. To interrupt RLaB during execution, type command-. (i.e. press command key + period key), it will return to the interactive mode in the next i/o. To abort RLaB and kick it out, you can use File-Quit (command-Q) on Menu bar. You can also do so by type in command-d at the beginning of a command line, or type "quit" directly. If RLaB hangs, press command-option-esc to abort it. 9. The source code of mac version is merged in the rlab source code distribution (see :misc:ftp-sites). Those statements within #ifdef THINK_C ... #endif are my modifications for THINK C 7.03 compiler on the Mac. I've modified the console user interface. Three difference files diff1, diff2, and diff3 tell you those modifications (they are in :misc:MAC). You also need f2c and POSIX libraries. They are available in info-mac archives. 10. If you wish to join the RLaB community, send an email to Ian (ians@eskimo.com) and ask him to add your name in the mailing list. You can reach the RLaB community by sending email to rlab-list@eskimo.com. 11. We need more tools. Please send your useful rfiles to Ian. Thanks. 12. THIS IS FREE SOFTWARE. THERE IS NO WARRANTY FOR THE PROGRAM. USE IT AT YOUR OWN RISK. Have fun! Tzong-Shuoh Yang (tsyang@ce.berkeley.edu)