Displaying 20 results from an estimated 1000 matches similar to: "lsfit: Error in formatting error message"
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
2006 Aug 03
1
question about dll crashing R
I have ported some R code to C to make it faster.
I can perform .Call("foobar",....) once and it
works fine. Absolutely correct answer.
If I put a loop inside foobar and run the main code
routine more than 100 times, it crashes R.
Or if I call .Call("foobar"....) seperately more than
two tims it crashes R.
For the most part I am doing matirx multiplies using
EXP
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)
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.
2009 Mar 13
1
lsfit w/ rank-deficient x
Dear R-devel,
It seems that lsfit incorrectly reports coefficients when the input matrix 'x' is rank-deficient, see the example below:
## here values of 'b' and 'c' are incorrectly swapped
> x <- cbind(a=rnorm(100), b=0, c=rnorm(100)); y <- rnorm(100); lsfit(x, y)$coef
Intercept a b c
-0.0227787 0.1042860 -0.1729261 0.0000000
Warning
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
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
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?
2009 Oct 25
1
lsfit residuals
I'm trying to extract the points above and below a particular lsfit. I
can only get the residuals from the original fit though.
x = runif(100, 0, 10)
plot(x)
abline(lsfit(1:100, test))
abline(lsfit(1:100, test + sd(test))) #I want the points above THIS
line.
Is there a way to use the coefficients from the fit to do this?
Thanks for any help.
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 <-
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
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
2005 May 19
1
R 2.1.0 RH Linux Built from Source Segmentation Fault
Background:
I administer a cluster of RedHat EWS 3U4 Linux workstations at a university.
I built R 2.1.0 from source:
./configure \
--prefix=/sscc/opt/R-2.1.0 \
--with-blas=no \
2>&1 \
| tee NUInstall.configure
R is now configured for i686-pc-linux-gnu
Source directory: .
Installation directory: /sscc/opt/R-2.1.0
C compiler:
2009 Apr 07
1
typo in R-ints.texi's description of P_ macro
I think there are some missing words in "R Internals"'s description of
the P_ macro.
It currently has "A macro as a wrapper for ngettext", which I think
ought to be
something like "The macro P_ may be used as a wrapper for ngettext".
The following patch also makes the 2 alternate definitions of P_ have
the same argument names,
StringS and StringP. Expanding the
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
2009 Feb 27
0
help with correct use of function lsfit
To the purpose of fitting a 2nd order polynomial (a + b*x + c*x^2) to the chunk of signal falling in a 17 consecutive samples window
I wrote the following very crude script. Since I have no previous experience of using Least Square Fit with R I would appreciate
your supervision and suggestion.
I guess the returned coefficients of the oolynomial are:
a = -1.3191398
b = 0.1233055
c = 0.9297401
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
n <- length(x)
2002 May 14
1
princomp
Hello experts,
as newcomer in pca, i have a question, concerning the princomp algorithm.
With a dataset "r" containing 18 "input" parameters and 1 "output" parameter
r[19], i got with the following fit
ls <- lsfit(r[1:18],r[19]); lsdiag <- ls.diag(ls); lsdiag$std.dev
a prediction error of:
[1] 8.879561
what is quite reasonable. If i take only two
2011 Jul 19
1
"may be used in an incorrect context"
R CMD check tells me
* checking R code for possible problems ... NOTE
agexact.fit.rds: ... may be used in an incorrect context: ?optim(init,
agfitfn, ...)?
Warning: <anonymous>: ... may be used in an incorrect context: ?optim(init, agfitfn, ...)?
Can anyone tell me what this message means? My searches haven't turned
up anything useful. This is with R 2.7 and 2.9.
The message