Displaying 20 results from an estimated 10000 matches similar to: "row*matrix"
2003 May 16
4
Newbie hung up with matrices
Hi all:
Thanks in advance for your assistance.
I just started learning R. I'm trying to use the Help and the downloadable
manuals. I am stuck on trying to multiply matrices. Can anyone please
supply a couple of lines of code that I can plug into a fresh console to see
how a double precision (1x3) matrix is multiplied by a double precision
(3x3) matrix? I keep getting an error
2011 Nov 04
6
Matrix element-by-element multiplication
is there a way to do element-by-element multiplication as in Gauss
and MATLAB, as shown below? Thanks.
---
a
1.0000000
2.0000000
3.0000000
x
1.0000000 2.0000000 3.0000000
2.0000000 4.0000000 6.0000000
3.0000000 6.0000000 9.0000000
a.*x
1.0000000 2.0000000 3.0000000
4.0000000
2008 Jan 30
4
Multiplying each row of a big matrix with a vector
I have a big matrix 'ret'. I want to multiply each row of it with a 2nd vector 'pos', resulting result, I want to save in a vector named 'port'. I wrote following code:
> pos
[1] 2593419 2130220 6198197 1673888 1980000 1784732 2052120 -7490228 -5275000
> dim(ret)
[1] 500 9
> fu # user defined function
function(x)
{
fu = x %*%
2010 Feb 02
2
Writing out csv files
In my code, I calculate the maximum values with 2 factors using
maxr=with(arrdf, tapply(rate,list(weekday,quarter), max, na.rm=T))
and I want to write out the file so that Excel can read it.
I used
write.table(maxr, fname, sep=",", col.names=TRUE, row.names=TRUE,
quote=TRUE, na="0")
which works, and yields something like
2010 Jan 02
1
Question on Reduce + rollmean
Hello useRs,
I'd like to perform a moving average on the dataset, xx. I've tried
combining the functions Reduce and rollmean but it didn't work.
> r <- function(n) rollmean(n, 2) # where 2 = averaging interval
> output < - Reduce("r", x)
Error in f(init, x[[i]]) : unused argument(s) (x[[i]])
Is there anything wrong with the code in the first place?
where
2012 Feb 20
2
Column wise matrix multiplication
Hi all,
I am trying to multiply each column of a matrix such to have a unique resulting vector with length equal to the number of rows of the original matrix. In short I would like to do what prod(.) function in Matlab does, i.e.
A <-matrix(c(1:10),5,2)
V = A[,1]*A[,2]
Thank you
Graziano
[[alternative HTML version deleted]]
2011 Oct 01
7
Poor performance of "Optim"
I used to consider using R and "Optim" to replace my commercial packages:
Gauss and Matlab. But it turns out that "Optim" does not converge
completely. The same data for Gauss and Matlab are converged very well. I
see that there are too many packages based on "optim" and really doubt if
they can be trusted!
--
View this message in context:
2009 Aug 14
4
Assigning values based on a separate reference (lookup) table
Dear R Users,
I have a data frame of 360 rows by 720 columns (259200 values). For each value in this grid I am hoping to apply an equation to, to generate a new grid. One of the parts of the equation (called 'p') relies on reading from a separate reference table. This is Table 4 at: http://www.fao.org/docrep/s2022e/s2022e07.htm#3.1.3%20blaney%20criddle%20method (scroll down a little).
2005 Nov 09
8
Element-by-element multiplication operator?
Is there an element-by-element multiplication in R, like the .* operator in Matlab?
eg: A (2x3)
B (2x3)
C=A.*B
C (2x3)
C = [[a11*b11 a12*b12 a13*b13]; [a21*b21 a22*b22 a23*b23]]
I can't find one...
Thanks
-Mike Gates
2011 Jan 14
4
matrix multiplication speed R
Hi,
A quick bench-mark of an R matrix muliplication 500by500 X 500by10000, all
random variates, with matlab reveals a huge difference in speed (5 times at
least). Is there anything that can be done in R to speed up the
multiplication?
Kind regards, Oyvind
--
View this message in context: http://r.789695.n4.nabble.com/matrix-multiplication-speed-R-tp3217257p3217257.html
Sent from the R devel
2009 Jan 30
3
Matlab inv() and R solve() differences
I submit the following matrix to both MATLAB and R
x= 0.133 0.254 -0.214 0.116
0.254 0.623 -0.674 0.139
-0.214 -0.674 0.910 0.011
0.116 0.139 0.011 0.180
MATLAB's inv(x) provides the following
137.21 -50.68 -4.70 -46.42
-120.71 27.28 -8.94 62.19
-58.15 6.93 -7.89 36.94
8.35 11.17 10.42 -14.82
R's solve(x) provides:
261.94 116.22 150.92 -267.78
116.22 344.30 286.68
2005 Sep 01
1
FW: In-place editor inside a Draggable
I was able to do a cheap workaround
By putting this:
this.editField.focus();
at the end of the enterEditMode: function()
this still does not allow highlighting with the mouse. Also if there are
regular forms in a draggable the end user is screwed especially when using
firefox.
-----Original Message-----
From: Stephen Major [mailto:smajor@gmail.com]
Sent: Thursday, September 01, 2005 3:28 AM
1999 Jul 20
2
tensor() function and sets
Hi Everyone,
To complete the outer() and kronecker() functions in the base, may I
suggest the following tensor() function, which allows the multiplication
of arrays through sets of conformable dimensions. I am happy to write a
help page if required.
The code also needs a setdiff() function which prompts me to ask: what
about simple set functions? I expect many of us have written our own
2005 Sep 01
2
In-place editor inside a Draggable
Hello,
I have noticed that when an In-place editor is inside a Draggable in IE it
is real sketchy, cannot highlight text and plain out cannot edit in Firefox.
Respectfully,
Stephen
2005 Aug 30
8
Who can help me?
I have own function wrote. I used an algorithm, which was written in Matlab.
in matlab:
...
gamma = inv(v)*g;
...
#v = matrix of variable size, v=vv(k) => k=2 => dimension of v 2x2
#g = a line vector with 4 elements e.g. g=[1,0,2,0];
my rewritten r-file:
...
gamma = solve(v)*g;
...
which is my error? Who can help me?
thank you in advance.
Chris
--
Lust, ein paar Euro nebenbei zu
2011 Oct 11
2
matrix multiplication
Dear all,
Sorry to bother you with such a stupid question, but I just cannot find the
solution to my problem.
I'd like to use matrix multiplication for meanA and factorial 3.
I use the command meanA%*%factorial 3.
But everything I get is: Error in factorial3 %*% A : non-conformable
arguments
I know that the number of the columns of the first vector has to be the same
number of rows of the
2015 May 02
5
[LLVMdev] Modifying LoopUnrollingPass
Hi Zhoulai,
I am trying to modify "LoopUnrollPass" in llvm which produces multiple
copies of loop equal to the loop unroll factor.Currently, using multicore
architecture, say 3 for example and the execution goes like:
for 3 cores if there are 9 iterations of loop
core instruction
1 0,3,6
2 1,4,7
3 2,5,8
But I want to to
2004 Mar 31
11
Zero Index Origin?
I'm very new to R and utterly blown away by not only the
language but the unbelievable set of packages and the
documentation and the documentation standards and...
I was an early APL user and never lost my love for it and in
R I find most of the essential things I loved about APL
except for one thing. At this early stage of my learning I
can't yet determine if there is a way to
2010 Mar 24
3
help in matlab - r code
Dear list members,
I need to translate 3 lines of matlab code to R (a loop, to be specific),
and I don't know what would be the results in matlab or how to do it in R--
I don't realise if they are doing to the col, vector or what. if the results
are a vector or a value or a matrix :-(
Anyone with matlab, can run it and give me the result? Any ideias what am I
doing wrong?
The code is
2006 Jan 22
1
Solve for x in Ax=B with vectors, not matrices
Hello R-helpers,
What I have: I am working with vectors not matrice:
#Basic equations
A <-c(-20,-9,-2)
x <-c(0.17,0.22,0.61)
B <- crossprod(A,x)
# R matrix multiplication works with vectors
A%*%x==B # Is true...
Question: If x is unknown and A and B are known, how do I solve for x in R?
solve(A,B) won't work because A is not a square matrix
solve(A,B)
Error in solve.default(A,