Wrapping and Defining Octave Functions from R

Share:

Description

Wrapping and Defining Octave Functions from R

OctaveFunction objects can be created from existing Octave function using their name, or directly from their Octave implementation. In this case, the Octave code is parsed to extract and use the name of the first function defined therein.

Usage

1

Arguments

fun

the name of an existing Octave function or, Octave code that defines a function.

check

logical that indicates if the existence of the Octave function should be checked. If function does not exist then, an error or a warning is thrown if check=TRUE or check=FALSE respectively. The existence check can be completly disabled with check=NA.

Slots

name

name of the wrapped Octave function

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
osvd <- OctaveFunction('svd')
osvd
osvd(matrix(1:9,3))

orand <- OctaveFunction('rand')
orand()
orand(2)
orand(2, 3)

# From source code
myfun <- OctaveFunction('function [Y] = somefun(x)
	Y = x * x;
	end
')
myfun
myfun(10)