Displaying 20 results from an estimated 500 matches similar to: "question about dll crashing R"
2006 Mar 09
0
When calling external C-function repeatedly I get different results; can't figure out why..
Dear all,
I need to calculate tr(xyxy) fast for matrices x and y. Inspired by the R-source code, I've created the following functions (I am *new* to writing external C-functions, so feel free to laugh at my code - or, perhaps, suggest changes):
#include <Rinternals.h>
#include <R_ext/Applic.h> /* for dgemm */
static void matprod(double *x, int nrx, int ncx,
double *y, int
2006 Mar 09
0
When calling external C-function repeatedly I get differentresults; can't figure out why..
Not an expert in programming either, but to me it seems like you've forgotten to initialize the variable "tr". It just picks up garbage from allocated memory previously initialized by other processes.
Med venlig hilsen
Frede Aakmann T?gersen
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] P?
2005 Oct 12
1
Using matprod from array.c
Hi,
I was wondering if I could use the matprod function from array.c in my own C routine. I tried the following as a test
/* my_matprod.c */
# include <Rinternals.h> /* for REAL, SEXP etc */
# include <R_ext/Applic.h> /* array.c says need for dgemm */
/* following copied from array.c */
static void matprod(double *x, int nrx, int ncx,
double *y, int nry, int ncy, double *z)
2019 Apr 05
2
patch to improve matrix conformability error message
With this patch,
> A <- matrix(1, 2, 2)
> B <- matrix(2, 3, 2)
> A %*% B
Error in A %*% B :
non-conformable arguments of dimension (2, 2) and (3, 2)
>From 205b591d4d14b5ff667325fb233a6deb08314726 Mon Sep 17 00:00:00 2001
From: Joshua Nathaniel Pritikin <jpritikin at pobox.com>
Date: Fri, 5 Apr 2019 12:03:58 -0400
Subject: [PATCH] Improve non-conformable arguments error
2010 Aug 23
1
Internal state indicating if a data object has NAs/no NAs/not sure (Was: Re: Speeding up matrix multiplies)
Hi, I'm just following your messages the overhead that the code for
dealing with possible NA/NaN values brings. When I was setting up
part of the matrixStats package, I've also though about this. I was
thinking of having an additional logical argument 'hasNA'/'has.na'
where you as a user can specify whether there is NA/NaN:s or not,
allowing the code to avoid it or not.
2010 Aug 23
1
Speeding up matrix multiplies
I've looked at the code for matrix multiplies in R, and found that it
can speeded up quite a bit, for multiplies that are really vector dot
products, and for other multiplies in which the result matrix is small.
Here's my test program:
u <- seq(0,1,length=1000)
v <- seq(0,2,length=1000)
A2 <- matrix(2.1,2,1000)
A5 <- matrix(2.1,5,1000)
B3 <- matrix(3.2,1000,3)
A4 <-
2019 Apr 30
0
patch to improve matrix conformability error message
I think this is a good idea. Is there a reason why it got no interest?
Slippery slope?
Or maybe others were also just occupied trying to figure out how
Joshua's second message had timestamp earlier than his first message?
On Fri, Apr 05, 2019 at 12:05:36PM -0400, Joshua N Pritikin wrote:
>With this patch,
>
>> A <- matrix(1, 2, 2)
>> B <- matrix(2, 3, 2)
>> A
2017 Jan 07
2
accelerating matrix multiply
I am using R to multiply some large (30k x 30k double) matrices on a 64 core machine (xeon phi). I added some timers to src/main/array.c to see where the time is going. All of the time is being spent in the matprod function, most of that time is spent in dgemm. 15 seconds is in matprod in some code that is checking if there are NaNs.
> system.time (C <- B %*% A)
nancheck: wall time
2013 Apr 25
1
lsfit: Error in formatting error message
Hi,
in R-3.0 I get the following error when calling lsfit with more
observations than variables, which seems to come from an error in the
formatting of the error message (note that this was not happening in
2.15.3):
> nobs <- 5; nvar <- 6; lsfit(matrix(runif(nobs*nvar), ncol=nvar),
runif(nobs), intercept=FALSE)
Error in sprintf(ngettext(nry, "%d response", "%d
2017 Jan 11
2
accelerating matrix multiply
> Do you have R code (including set.seed(.) if relevant) to show on how to generate
> the large square matrices you've mentioned in the beginning? So we get to some
> reproducible benchmarks?
Hi Martin,
Here is the program I used. I only generate 2 random numbers and reuse them to make the benchmark run faster. Let me know if there is something I can do to help--alternate
2017 Jan 10
0
accelerating matrix multiply
>>>>> Cohn, Robert S <robert.s.cohn at intel.com>
>>>>> on Sat, 7 Jan 2017 16:41:42 +0000 writes:
> I am using R to multiply some large (30k x 30k double)
> matrices on a 64 core machine (xeon phi). I added some timers
> to src/main/array.c to see where the time is going. All of the
> time is being spent in the matprod function, most of that
2017 Jan 16
1
accelerating matrix multiply
Hi Tomas,
Can you share the full code for your benchmark, compiler options, and performance results so that I can try to reproduce them? There are a lot of variables that can affect the results. Private email is fine if it is too much for the mailing list.
I am measuring on Knight's Landing (KNL) that was released in November. KNL is not a co-processor so no offload is necessary. R executes
2006 Feb 22
2
How can I see how %*% is implemented?
I would like to see how the matrix multiplication operator %*% is implemented (because I want to see which external Fortran/C routines are used). How can I do so?
Best
S??ren
2017 Jan 16
0
accelerating matrix multiply
Hi Robert,
thanks for the report and your suggestions how to make the NaN checks
faster.
Based on my experiments it seems that the "break" in the loop actually
can have positive impact on performance even in the common case when we
don't have NaNs. With gcc on linux (corei7), where isnan is inlined, the
"break" version uses a conditional jump while the
2019 Sep 12
0
Fw: Calling a LAPACK subroutine from R
Hi guys,
interestingly, my problem seems to be solved by writing a FORTRAN
wrapper for the Fortran code! (As long as the check doesn't get
smarter...). This is the relevant part of my Fortran code:
-----------------------------------------------------------
subroutine gmlfun(what,
& totevent, totrs, ns,
& antrs, antevents, size,
& totsize,
2017 Oct 09
1
Using response variable in interaction as explanatory variable in glm crashes R
>>>>> Jan van der Laan <rhelp at eoos.dds.nl>
>>>>> on Fri, 6 Oct 2017 12:13:39 +0200 writes:
> It is actually model.matrix that crashes, not glm. Same
> crash occurs with e.g. lm.
> model.matrix(dob_mon ~ dob_day*dob_mon, data = tab)
> also crashes R.
Yes, segmentation fault.
It only happens when these are *logical*
2004 Nov 02
0
how to call function in ../src/main
Hi, This is Kotien Wu from NIH/NCI.
We want to use R function for our web:
http://cgap.nci.nih.gov
It works for functions in R/R-1.9.1/src/nmath/standalone very well.
We have function GetPvalueForT.c which has
#define MATHLIB_STANDALONE 1
#include <Rmath.h>
double GetPvalueForT ( double t, double deg ) {
return 2 * pt(t, deg, 0, 0);
}
We create GetPvalueForT.i, which has
/* File :
2006 Apr 08
1
add lines to a plot with a loop without erase the last one
Hello,
I want to plot several lines to a main plot but at the end of each loop, it
erases the last one.
Here my program:
alpha<-5
beta<-10
var<-0.5
s<-runif(1000,0,50)
m<-length(s)
variancealpha<-0.002
variancebeta<-0.051
variancevar<-0.001
alphachap<-vector()
betachap<-vector()
varchap<-vector()
epsilon<-vector()
b<-vector()
1997 Nov 28
3
R-alpha: Problems with dimnames and names
This message is in MIME format
--_=XFMail.1.1.p0.Linux:971128122615:3052=_
Content-Type: text/plain; charset=us-ascii
I have rounded up three buglets in R-0.50-a4. Two of them I can
fix and a patch is supplied below. I hope this is useful for the
current source (if these haven't been fixed already :)
1) cov
cov() fails when it's argument is a matrix with one column and with
column names
2009 Jul 31
1
write matrix M including names(dimnames(M))
I can do this by writing (and reading) the file according to some format of
my own devising, but I'm wondering if there is a built-in way to write and
then restore a matrix with not only the dimnames (which
write.table/read.table can preserve) but also the names(dimnames)?
Example:
> M <- matrix(1:4, 2, 2)
> dimnames(M) <- list(xdim=c("a", "b"),