Displaying 20 results from an estimated 7000 matches similar to: "PDF with computationally expensive normalizing constant"
2008 Feb 04
2
a != a*1 != a+0 != +a
hits=1.0 tests=MANY_EXCLAMATIONS
X-USF-Spam-Flag: NO
Hi
I am writing a package for multivariate polynomials ('multipols')
using S3 methods.
The package includes a Ops.multipol() function for the
arithmetic methods; I would like
to define some sort of user-specified Boolean option which, if
set, would force results to be simplified as they are produced.
Call this option
2008 May 07
1
optional setValidity()
Hi
Suppose I have an S4 class "foo" and a validity checking
function ".checkfoo()":
setClass("foo", representation=representation("numeric"))
setValidity("foo" , .checkfoo)
is fine; in my application, .checkfoo() verifies that a bunch
of necessary conditions are met.
But .checkfoo() is very time consuming and I want
to give users the option
2007 Dec 19
3
array addition
Hi
suppose I have two arrays x1,x2 of dimensions a1,b1,c1 and
a2,b2,c2 respectively.
I want x = x1 "+" x2 with dimensions c(max(a1,a2), max(b1,b2),max
(c1,c2))
with
x[a,b,c] = x1[a1,b1,c1] + x2[a2,b2,c2] if a <=min(a1,a2) , b<=min
(b1,b2), c<=min(c1,c2)
and the other bits either x1 or x2 or zero according to whether the
coordinates
are "in range" for
2008 Jan 14
2
as.function()
Hi
[this after some considerable thought as to R-help vs R-devel]
I want to write a (S3) method for as.function();
toy example follows.
Given a matrix "a", I need to evaluate trace(ax) as a function of
(matrix) "x".
Here's a trace function:
tr <- function (a) {
i <- seq_len(nrow(a))
return(sum(a[cbind(i, i)]))
}
How do I accomplish the following:
2008 Apr 23
0
new package multipol
Hello List
please find a new package, multipol, recently uploaded to CRAN.
This package generalizes the polynom package (which handles univariate
polynomials) to the multivariate case. A short article discussing the
package will appear in the next issue of Rnews, Insha'Allah
enjoy
--
Robin Hankin
Uncertainty Analyst and Neutral Theorist,
National Oceanography Centre, Southampton
2007 Dec 18
0
branch cuts of log() and sqrt()
Dear developers
Neither Math.Rd nor Log.Rd mention the branch cuts
that appear for complex arguments. I think it's important
to include such information.
Please find following two context diffs for Log.Rd and Math.Rd.
[The pedants amongst us will observe that
both sqrt() and log() have a branch point at complex
infinity, which is not mentioned in the patch. Comments
anyone?]
rksh
2008 Mar 26
5
S4 slot with NA default
Hi
How do I specify an S4 class with a slot that is potentially numeric,
but NA
by default? I want the slot to be NA until I calculate its value
(an expensive operation, not needed for all applications). When
its value is
known, I will create a new object with the correct value inserted in
the slot.
I want "NA" to signify "not known".
My attempt fails because
2008 Apr 02
1
"[<-" plus drop-type extra argument
Hello
I am writing a replacement method for an S4 class and want to pass
an additional argument to "[<-"() along the lines of "["()'s "drop"
argument.
Specifically, I have an S4 class, call it "foo", with a slot 'x'
that is a
vector and a slot 'NC' that is a scalar.
I want to be able to pass a Boolean argument to the
2008 Jan 07
2
S3 vs S4 for a simple package
I am writing a package and need to decide whether to use S3 or S4.
I have a single class, "multipol"; this needs methods for "[" and "[<-"
and I also need a print (or show) method and methods for arithmetic +-
*/^.
In S4, an object of class "multipol" has one slot that holds an array.
Objects of class "multipol" require specific arithmetic
2006 Jul 26
2
largest acceptable lookup table in a package
Hi
One of my packages needs a look-up table of pre-calculated
numbers in the data directory.
I would like to have the matrix as large as possible.
What is the largest size matrix that would be an acceptable datafile in
an R package?
[
The table is a square, upper triangular matrix
consisting of logs of Stirling numbers calculated by Maple.
As discussed on the List a few days ago (thanks
2004 Nov 18
0
Fwd: Re: 3d scatter plot with drop line
Hi
try this:
p3dpairs <- function(x,x1,
xlim=NULL,ylim=NULL,zlim=NULL,col=par("col"), pch=par("pch"),
cex=par("cex"), ...){
if(is.matrix(x)){
z <- x[,3]
y <- x[,2]
x <- x[,1]
}
if(is.matrix(x1)){
z1 <- x1[,3]
y1 <- x1[,2]
x1 <- x1[,1]
}
if(missing(zlim)) {
z.grid <-
2005 Jan 07
1
Visualizing complex analytic functions using domain coloring
Hi
has anyone coded up domain colouring for visualizing complex analytic
functions
(such as elliptic functions)?
[
the idea is to depict a complex function f(z) using a filled.contour()
variant
in which the hue is given by Arg(f(z)), and the saturation by Mod(f(z)).
]
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
tel
2005 Apr 29
1
accuracy of test cases
Hi
I have several methods for evaluating a function. The methods are
algebraically
identical but use different numerical techniques. The different methods
work
better (converge faster, etc) in different parts of the function's
domain.
I am compiling a test suite for a package, and would like to verify
that the
different methods return approximately identical results.
Toy example
2005 Jul 04
1
prototypes for z_sin() and z_cos()
Hi
I have been looking at complex.c and want to access z_cos() and z_sin
() from
C in one of my packages.
There doesn't seem to be a corresponding header file: there is no
complex.h file.
Where are the prototypes of z_sin() and z_cos() for these functions?
grepping didn't help me:
find ~/downloads/R-2.1.1/ -name "*.h " | xargs
egrep "z_cos"
2005 Sep 01
1
generic function S3 consistency warning advice
Hi
section 6.1 of R-exts suggests that a package can take over a
function in the base
package and make it generic.
I want to do this with Re() and have the following lines in my R code:
"Re" <- function(x){UseMethod("Re" )}
"Re.default" <- get("Re" ,pos=NULL,mode="function")
"Re.octonion" <- function(x){give.comp(x,1)}
2006 Sep 01
1
setMethod("Logic", ...)
Hi
In V&R the "polynomial" class is explicitly specified to have no
logical operators:
setMethod("Logic", signature(e1="polynomial"), function(e1,e2){stop
("...")})
I too have a class of objects for which I want to
specify that Logic operators do not work, but executing
setClass("brob",
representation = representation
2007 Jun 27
1
inherits() and virtual classes
Hi
How do I test for an object having a particular virtual class?
In the following, "onion" is a virtual class, and "octonion" is
a non-virtual class contained in onion. The last call
to inherits() gives FALSE [R-2.5.0], when inherits.Rd led
me to expect TRUE.
setClass("onion",
representation = "VIRTUAL"
)
2005 Jan 20
1
Cauchy's theorem
In complex analysis, Cauchy's integral theorem states (loosely
speaking) that the path integral
of any entire differentiable function, around any closed curve, is zero.
I would like to see this numerically, using R (and indeed I would like
to use the
residue theorem as well).
Has anyone coded up path integration?
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
2005 Mar 16
1
problem solved and new insight
Hi
just now I had an apparently insurmountable problem
that's been bugging me for days, but phrasing my question in a form
suitable for the R-help list enabled me to solve my own problem
in two minutes flat.
thanks everyone.
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743
2005 Apr 13
2
Inf +1i vs 1+Inf*1i
Hi
If I have
a <- Inf + 1i
then
Re(a) is Inf, and Im(a) is 1, as expected.
But if
b <- 1 + Inf * 1i,
then
Im(b) = Inf , as expected, but Re(b) = NaN, which I didn't expect.
Why this asymmetry? How to define an object with Re(b)=1, Im(b)=Inf?
--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
European Way, Southampton SO14 3ZH, UK
tel 023-8059-7743