Displaying 20 results from an estimated 2000 matches similar to: "Matrix Multiplication, Floating-Point, etc."
2007 Mar 05
2
Linear programming with sparse matrix input format?
Hi.
I am aware of three different R packages for linear programming: glpk,
linprog, lpSolve. From what I can tell, if there are N variables and M
constraints, all these solvers require the full NxM constraint matrix. Some
linear solvers I know of (not in R) have a sparse matrix input format. Are
there any linear solvers in R that have a sparse matrix input format?
(including the
2013 Jun 18
1
eigen(symmetric=TRUE) for complex matrices
R-3.0.1 rev 62743, binary downloaded from CRAN just now; macosx 10.8.3
Hello,
eigen(symmetric=TRUE) behaves strangely when given complex matrices.
The following two lines define 'A', a 100x100 (real) symmetric matrix
which theoretical considerations [Bochner's theorem] show to be positive
definite:
jj <- matrix(0,100,100)
A <- exp(-0.1*(row(jj)-col(jj))^2)
A's being
2007 Dec 10
4
Reading through a group of .RData files
Hi.
I have a procedure that reads a directory, loops through a set of particular .RData files, loading each one, and feeding its object(s) into a function, as follows:
cvListFiles<-list.files(fnDir);
for(i in grep(paste("^",pfnStub,".*\\.RData$",sep=""),cvListFiles)){
load(paste(fnDir,cvListFiles[i],sep="/"));
myFunction(rliObject);
rm(rliObject);
};
2008 Jan 07
3
Seeking a more efficient way to find partition maxima
Hi.
Suppose I have a vector that I partition into disjoint, contiguous subvectors. For example, let v = c(1,4,2,6,7,5), partition it into three subvectors, v1 = v[1:3], v2 = v[4], v3 = v[5:6]. I want to find the maximum element of each subvector. In this example, max(v1) is 4, max(v2) is 6, max(v3) is 7. If I knew that the successive subvector maxima would never decrease, as in the example,
2007 Jan 11
1
rank function and NA in 2.3.1
Hi.
I am using R 2.3.1 on WIndows XP, and I am having trouble with the rank
function in the presence of numerical NA data. I want the NA's all to get
the same rank, but they don't. Here is an example from my session:
>ct_align_rets_f2$liq[6851:6859]
[1] 115396 NA 362595 NA 242986 340805 NA 692905 251533
2007 Feb 01
3
Can this loop be delooped?
Hi.
I have the following code in a loop. It splits a vector into subvectors of
equal size. But if the size of the original vector is not an exact multiple
of the desired subvector size, then the first few subvectors have one more
element than the last few. I know that the cut function could be used to
determine where to break up the vector, but it doesn't seem to provide
control over
2007 May 15
2
Testing for existence inside a function
Hi.
I'm having trouble testing for existence of an object inside a function.
Suppose I have a function:
f<-function(x){
...
}
and I call it with argument y:
f(y)
I'd like to check inside the function whether argument y exists. Is this
possible, or do I have to either check outside the function or pass the name
of the argument as a separate argument?
If I do exists(x) or
2007 Feb 28
1
Efficient way to repeat rows (or columns) of a matrix?
Hi.
If I have a vector, v_1, and another vector of positive integers, i_1, the
same length as v_1, then rep(v_1,i_1) will repeat v_i[j] exactly i_1[j]
times, like so:
>rep(c(1,2,3),c(3,2,1))
[1] 1 1 1 2 2 3
>
I'd like to do the same sort of thing where I replace v_1 with a matrix, and
the jth row of the matrix is repeated i_1 times.
Obviously, I could do this with for loops, like
2008 Jan 02
2
Seeking a more efficient way to read in a file
Hi.
I have a matrix stored in a large, tab-delimited flat file. The first row contains column names. Because the matrix is symmetric, the file has lower triangular format, so the second row contains one number, the third row two numbers, etc. In general, row k+1 contains k numbers; the matrix has 3000 rows, so the file has 3001 rows. The file has variable length records, so each row ends
2007 Feb 02
1
Another loop - deloop question
Hi.
You folks are so clever, I thought perhaps you could help me make another
procedure more efficient.
Right now I have the following setup:
p is a vector of length m
g is a list of length n, g[[i]] is a vector whose elements are indices of p,
i.e., integers between 1 and m inclusive); the g[[i]] cover the full set
1:m, but they don't have to constitute an exact partition, theycan
2007 Dec 26
1
Can you recover default argument values of a function?
Hi.
Maybe this is a stupid question. If so, I apologize, but here goes. Suppose I have a function f1(x,...) that calls a function f2(y1,y2,...,yn) in the following way: if x satisfies a certain condition, then I want to call f2(x,y2,...,yn); otherwise I want to use the default value of y1, if there is one. I could do something like the following:
v <- ifelse ( is.null(x), f2( , y2,...,
2006 Dec 29
1
Failure loading library into second R 2.3.1 session on Windows XP
Hi.
I am using R 2.3.1 on Windows XP. I had installed a library package into my
first session and wanted the same package in my second session, so I went
out to the CRAN mirror and tried to install the package, and got the
following message:
*********************************************************************
>utils:::menuInstallPkgs()
trying URL
2007 Sep 12
1
"Save to File..." option on File menu
Hi.
There was an interesting thread about a year ago, called 'Command
equivalent of rgui "File, Save to File"?'
(http://tolstoy.newcastle.edu.au/R/e2/help/06/09/0553.html) started by
Michael Prager, and contributed to by Duncan Murdoch (I didn't notice
anything beyond the four entries they posted). The question was how to
replicate programmatically the "Save to
2007 Jan 18
1
Robust PCA?
Hi.
I'm checking into robust methods for principal components analysis. There
seem to be several floating around. I'm currently focusing my attention on
a method of Hubert, Rousseeuw, and Vanden Branden
(http://wis.kuleuven.be/stat/Papers/robpca.pdf) mainly because I'm familiar
with other work by Rousseeuw and Hubert in robust methodologies. Of course,
I'd like to obtain
2007 Aug 31
1
gsub warning message
Hi.
I am using R 2.5.1 on a Windows XP machine. Here is an example of a piece
of code I was running in older versions of R on the same machine. I am
looking for underscores and replacing them with periods. This result is
from R 2.4.1:
>gsub ( "\\_+","\.","AAA_I")
[1] "AAA.I"
>
Here is what I get in R 2.5.1:
>gsub (
2007 Jul 09
1
factanal frustration!
Hi.
It seems that nearly every time I try to use factanal I get the following
response:
>faa2db1<-factanal(mretdb1,factors=2,method="mle",control=list(nstart=25))
Error in factanal(mretdb1, factors = 2, method = "mle", control =
list(nstart = 25)) :
unable to optimize from these starting value(s)
>
In the case cited above, mretdb1 is synthetic data created
2007 Jan 03
1
na.action and simultaneous regressions
Hi.
I am running regressions of several dependent variables using the same set
of independent variables. The independent variable values are complete, but
each dependent variable has some missing values for some observations; by
default, lm(y1~x) will carry out the regressions using only the observations
without missing values of y1. If I do lm(cbind(y1,y2)~x), the default will
be to use
2007 Dec 19
1
Function reference
Hi.
I'm looking for an R equivalent to something like function pointers in C/C++. I have a search procedure that evaluates the fitness of each point it reaches as it moves along, and decides where to move next based on its fitness evaluation. I want to be able to pass different fitness functions to this procedure. I am trying to find a good way to do this. I was thinking of passing in
2007 Mar 09
1
lpSolve space problem in R 2.4.1 on Windows XP
Hi.
I am trying to use the linear optimizer from package lpSolve in R 2.4.1 on
Windows XP (Version 5.1). The problem I am trying to solve has 2843
variables (2841 integer, 2 continuous) and 8524 constraints, and I have 2 Gb
of memory. After I load the input data into R, I have at most 1.5 Gb of
memory available. If I start the lp with significantly less memory
available (say 1 Gb), I get
2007 Feb 13
1
Questions about results from PCAproj for robust principal component analysis
Hi.
I have been looking at the PCAproj function in package pcaPP (R 2.4.1) for
robust principal components, and I'm trying to interpret the results. I
started with a data matrix of dimensions RxC (R is the number of rows /
observations, C the number of columns / variables). PCAproj returns a list
of class princomp, similar to the output of the function princomp. In a
case where I can