Skip to content

a question about optim.R and optim.c in R

2 messages · John C Nash, Dirk Eddelbuettel

#
As you dig deeper you will find vmmin.c, cgmin.c and (I think) nmmin.c
etc. Those were, as I understand, converted by p2c from my Pascal codes
that you can find in the pascal library on netlib.org. These can be run
with the Free Pascal compiler.

Given how long ago these were developed (>30 years in all cases), they
are due for review. The packages Rvmmin and Rcgmin are all-R
replacements for the 1st two, and nmkb from dfoptim generally offers a
better version of the Nelder-Mead approach. All have bounds-constrained
variants, but for efficiency, there are direct calls of the
unconstrained methods, though I need to provide some nice examples of
when and how to call each. There is likely a place for some compiling of
sections to speed things up, but the R codes are not particularly sluggish.

Side comment: At UseR last week, Yihui Xie sat with me and we
implemented a Fortran language engine for knitr. It looks like a Pascal
one may also be possible, and maybe even a BASIC (though that may need
variants for different platforms). This would allow vignettes to
document some of the legacy code to be written, and that may be an
important matter as the expertise for such older tools moves into
retirement. Off-list communication about such ideas welcome.

John Nash
On 14-07-08 06:00 AM, r-devel-request at r-project.org wrote:
#
(flagged thread as OT as this is now orthogonal to the OP's question)
On 8 July 2014 at 08:41, Prof J C Nash (U30A) wrote:
| Side comment: At UseR last week, Yihui Xie sat with me and we
| implemented a Fortran language engine for knitr. It looks like a Pascal
| one may also be possible, and maybe even a BASIC (though that may need
| variants for different platforms).

I am not so sure. If you look at what Yihui actually did (ie: enable Fortran
support which R already had -- and you can actually _run_ the code) then you
may see that Pascal and (gasp) Basic have a different status _as they cannot
be used to extend R_.  So where are talking "just typesetting". So read on.

| This would allow vignettes to
| document some of the legacy code to be written, and that may be an
| important matter as the expertise for such older tools moves into
| retirement. Off-list communication about such ideas welcome.

As I mentioned to you at useR, knitr has had the ability to just call
highlight as an external 'engine' for a long time (and that may have been
added after I prodded Yihui when I needed to typeset some Matlab and/or
Python code).  

Below is the output from 'highlight -p' --- we do already have support for a
fairly large number of languages.  Pascal is among them, as are some old
enough to be of interest to you. Algol 68, maybe?  ;-)

Dirk


edd at max:~$ highlight -p

Installed language definitions (located in /usr/share/highlight/langDefs/):

ABAP/4                        : abap4 ( abp )
ABC                           : abc
Advanced Backus-Naur Form     : abnf
Action Script                 : actionscript ( as )
ADA95                         : ada ( a adb ads gnad )
Agda                          : agda
ALGOL 68                      : algol ( alg )
AMPL                          : ampl ( dat run )
AMTrix                        : amtrix ( hnd s4 s4h s4t t4 )
AppleScript                   : applescript
Arc                           : arc
ARM                           : arm
AS/400 CL                     : as400cl
ASCEND                        : ascend ( a4c )
ASP                           : asp ( asa )
Abstract                      : aspect ( was wud )
Assembler                     : assembler ( asm )
Applied Type System           : ats ( dats )
AutoHotKey                    : autohotkey ( ahk )
AutoIt                        : autoit ( au3 )
Avenue                        : avenue
(G)AWK                        : awk
DOS Batch                     : bat ( cmd )
BBcode                        : bbcode
BCPL                          : bcpl
BibTeX                        : bibtex ( bib )
Biferno                       : biferno ( bfr )
Bison                         : bison ( y )
Blitz Basic                   : blitzbasic ( bb )
BM Script                     : bms
Backus-Naur Form              : bnf
Boo                           : boo
C and C++                     : c ( c++ cc cpp cu cxx h hh hpp hxx )
Ceylon                        : ceylon
Charmm                        : charmm ( inp )
CHILL                         : chill ( chl )
Clean                         : clean ( icl )
ClearBasic                    : clearbasic ( cb )
Clipper                       : clipper
Clojure                       : clojure
Clips                         : clp
COBOL                         : cobol ( cbl cob )
ColdFusion MX                 : coldfusion ( cfc cfm )
C#                            : csharp ( cs )
CSS                           : css
D                             : d
Diff                          : diff ( patch )
Dylan                         : dylan
Extended Backus-Naur Form     : ebnf
Eiffel                        : eiffel ( e se )
Erlang                        : erlang ( erl hrl )
Euphoria                      : euphoria ( eu ew ex exw wxu )
Express                       : express ( exp )
FAME                          : fame ( fame )
Felix                         : felix ( flx )
Fortran 77                    : fortran77 ( f for ftn )
Fortran 90                    : fortran90 ( f90 f95 )
Frink                         : frink
F#                            : fsharp ( fs fsx )
Java FX                       : fx
Gambas                        : gambas ( class )
Go                            : go
Graphviz                      : graphviz ( dot )
Haskell                       : haskell ( hs )
haXe                          : haxe ( hx )
Hecl                          : hcl
HTML                          : html ( htm xhtml )
Apache Config                 : httpd
Icon                          : icon ( icn )
IDL                           : idl
Interactive Data Language     : idlang
Lua (for LuaTeX)              : inc_luatex
Informix                      : informix ( 4gl )
INI                           : ini
Inno Setup                    : innosetup ( iss )
INTERLIS                      : interlis ( ili )
IO                            : io
Jasmin                        : jasmin ( j )
Java                          : java ( groovy grv )
Javascript                    : js
JSP                           : jsp
LDAP                          : ldif
Haskell LHS                   : lhs
Lilypond                      : lilypond ( ly )
Limbo                         : limbo ( b )
Linden Script                 : lindenscript ( lsl )
Lisp                          : lisp ( cl clisp el lsp sbcl scom )
Logtalk                       : logtalk ( lgt )
Lotos                         : lotos
Lotus                         : lotus ( ls )
Lua                           : lua
Luban                         : luban ( lbn )
Make                          : make ( mak mk )
Maple                         : maple ( mpl )
Matlab                        : matlab ( m )
Maya                          : maya ( mel )
Mercury                       : mercury
Miranda                       : miranda
Modula2                       : mod2 ( def mod )
Modula3                       : mod3 ( i3 m3 )
Modelica                      : modelica ( mo )
MoonScript                    : moon
MaxScript                     : ms
MSSQL                         : mssql
Magic eXtensible Markup Language: mxml
Notation3 (N3), N-Triples, Turtle, SPARQL: n3 ( nt ttl )
Nasal                         : nasal ( nas )
NeXT Byte Codes               : nbc
Nemerle                       : nemerle ( n )
NetRexx                       : netrexx ( nrx )
Nice                          : nice
NSIS                          : nsis ( nsi )
Not eXactly C                 : nxc
Oberon                        : oberon ( ooc )
Objective C                   : objc
Objective Caml                : ocaml ( ml mli )
Octave                        : octave
Open Object Rexx              : oorexx
Object Script                 : os
Oz                            : oz
Paradox                       : paradox ( sc )
Pascal                        : pas
Perl                          : perl ( cgi perl pl plex plx pm )
PHP                           : php ( php3 php4 php5 php6 )
Pike                          : pike ( pmod )
PL/1                          : pl1 ( bdy ff fp fpp rpp sf sp spb spe spp sps wf wp wpb wpp wps )
PL/Perl                       : plperl
PL/Python                     : plpython
PL/Tcl                        : pltcl
POV-Ray                       : pov
Prolog                        : pro
Progress                      : progress ( i p w )
PostScript                    : ps
Microsoft PowerShell          : ps1
PATROL                        : psl
Pure                          : pure
Pyrex                         : pyrex ( pyx )
Python                        : python ( py )
Qore                          : q
QMake Project                 : qmake
Qu                            : qu
R                             : r
Rebol                         : rebol
Rexx                          : rexx ( rex rx the )
Relax NG                      : rnc
RPG                           : rpg
RPL Programming Language      : rpl
Ruby                          : ruby ( pp rb rjs ruby )
PowerPC Assembler             : s
SAS                           : sas
Scala                         : scala
Scilab                        : scilab ( sce sci )
Bash                          : sh ( bash ebuild eclass )
SMALL                         : small ( sma )
Smalltalk                     : smalltalk ( gst sq st )
Standard ML                   : sml
SNMP                          : snmp ( mib smi )
SNOBOL                        : snobol ( sno )
RPM Spec                      : spec
SPIN SQL                      : spn
PL/SQL                        : sql
Squirrel                      : squirrel ( nut )
Sybase SQL                    : sybase
Tcl/Tk                        : tcl ( itcl wish )
TCSH                          : tcsh
Regex tests                   : test_re
TeX and LaTeX                 : tex ( cls sty )
Transact-SQL                  : tsql
TTCN3                         : ttcn3
Plain text                    : txt ( text )
UPC (and C, technically)      : upc
Vala                          : vala
Visual Basic                  : vb ( bas basic bi vbs )
Verilog                       : verilog ( v )
VHDL                          : vhd
XML                           : xml ( dtd ecf ent hdr hub jnlp nrm resx sgm sgml svg tld vxml wml xsd xsl )
SuperX++                      : xpp
Yaiff                         : yaiff
Zonnon                        : znn

Use name of the desired language with the --syntax option.

edd at max:~$