similar to: how to return multipy matrix in a function

Displaying 20 results from an estimated 100 matches similar to: "how to return multipy matrix in a function"

2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello I have a time-comsuming program which need to simplify, I have tested the annotated program as follow: > #define function which will be call > calsta <- function(c, n=100000) + { + i <- seq(from=0, length=c) + logx <- lchoose(NT-n, CT-i) + lchoose(n, i) + logmax <- max(logx) + logmax + log(sum(exp(logx - logmax))) + } > CT=6000 #assignment to CT >
2011 Jan 03
3
matrices call a function element-wise
Hello I have 4 1000*1000 matrix A,B,C,D. I want to use the corresponding element of the 4 matrices. Using the "for loop" as follow: E<-o for (i in 1:1000) {for (j in 1:1000) { E<-fisher.test(matrix(c(A[i][j],B[i][j],C[i][j],D[i][j]),2))#call fisher.test for every element } } It is so time-consuming Need vectorization Yours sincerely ZhaoXing Department of
2011 Jan 11
1
how to use "apply" function partial to each vector of a matrix
Hello Suppose I have a matrix mat=(1:16,2) [,1] [,2] [,3] [,4] [1,] 1 5 9 13 [2,] 2 6 10 14 [3,] 3 7 11 15 [4,] 4 8 12 16 I just want to use the "apply" function to the matrix partially there is a vector end=c(2,3,1,3) #sum the 1st 2 numbers of the 1st column #sum the 1st 3 numbers of the 2nd column #sum the 1st number of the 3rd column
2011 Jan 11
1
how to coerce part of each column of a matrix to a vector and merge them
Hello Suppose I have a matrix mat=(1:16,2) [,1] [,2] [,3] [,4] [1,] 1 5 9 13 [2,] 2 6 10 14 [3,] 3 7 11 15 [4,] 4 8 12 16 there is a vector end=c(2,3,1,3) #coerce the 1st 2 numbers of the 1st column to a vector [1] 1 2 #coerce the 1st 3 numbers of the 2nd column and append it to the previous vector [1] 1 2 5 6 7 #coerce the 1st number of
2008 Apr 24
1
Calling R functions with multiple arguments from C
Hi, I'm writing a C function that has to call a R function with multiple arguments. I've read the relevant section in Writing R Extensions, and searched the R site, mailing lists as well as rseek. I managed to call the function, but I'm now having trouble creating the argument list. I tried to create a pairlist of the arguments and send it to the R function. The R function however
2011 Feb 12
1
how to improve the precison of this calculation?
Hello T I want to order some calculation "result", there will be lots of "result" that need to calculate and order PS: the "result" is just a intermediate varible and ordering them is the very aim # problem: # For fixed NT and CT, and some pair (c,n). order the pair by corresponding result # c and n are both random variable CT<-6000 #assignment to CT
2011 Feb 07
1
kernel density
Hi all (again), many thanks for the answer to the optimization problem. All is fine now. The problem now is with kernel estimators in sm. package. I do all the work and the graphics good, but I need the density function data for each point, and I don't know how to get it. The only thing I get is the table at the end of the following sequence: >
2011 Jan 10
0
how to create and manage a matrix with vector of different length
Hello I have a data consisting of 245 counties, including the population, number of illness and the geographical information of each county. Fixing each county, I want to sort the other county by distance, which can make a 245*245 matrix with each cell is the corresponding index of the county, e.g. the 3rd row of the matrix is a vector of descending order of the 245 indices, maybe
2013 Apr 27
1
using metafor for meta-analysis of before-after studies
Hello, Dr. Viechtbauer. I am trying to perform a meta-analyis on a group of before-after studies using Metafor. I read your webpage including your correspondence with Dr. Dewey (https://stat.ethz.ch/pipermail/r-help/2012-April/308946.html), who also conducted a similar study. These information is very hepful, but I have one additonal question which I wonder if you can give me some instruction.
2011 Jan 07
4
how to calculate this natural logarithm
Hello I want to calculate natural logarithm of sum of combinations as follow: (R code) { com_sum=choose(2000000,482)*choose(1000000,118)+choose(2000000,483)*choose(1000000,117)+...+choose(2000000,i)*choose(1000000,600-i)+...+choose(2000000,600)*choose(1000000,0) #calculate the sum result=log(com_sum) #calculate the log of the sum } But
2011 Jun 05
1
tag \href not recognised in rd doc
Hi, I have a trouble trying to use \href in a rd doc. See example below: \references{ \href{http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2702787/}{Vaniscotte A., Pleydell D., Raoul F., Quere J.P., Coeurdassier M., Delattre P., Li T., Qian W., Takahashi K., Weidmann J.C., Qiu J., Giraudoux P. 2009 Modelling and spatial discrimination of small mammal assemblages: an example from western
2008 Jul 22
4
Opening files from R terminal - appologies
Dear all, I appologise for cluttering up the list with such a basic question, however I have been unable to find the answer I want (possibly through my poor usage of the R help system). As I am visually impaired and using assistive technology, I think I would prefer to use R from the terminal mode, i.e. by running rterm.exe found in the bin directory. I have managed to set my working
2011 Oct 22
3
Sweave, cairo_pdf, CJK, ghostscript
I have had some fun in the last few days trying to put together an annotated map of China with R and some public GIS data: http://sourceforge.net/projects/outmodedbonsai/files/snpMatrix%20next/1.17.7.11/China_Choropleth_Maps.pdf/download It is done, and rather nice... there are a few issues: - the default pdf() device cannot do CJK with embedded fonts - and cairo_pdf() is not hooked up to
2012 Jun 13
1
Indexing Grouped Data
I need help in indexing grouped data. In this excample (df1 data), the first child had a first immunization at age 2. The second child had the first, second and third immunization at age 5,10, and 12, the third child had first and second immunization at age 4 and 6 and the fourth child had the first immunization at age 2. I have df1 and I need to create df2 with and "ind' variable that
2010 Feb 17
2
udp stream multiply
Hello, Not strictly a CentOS question, but I hope someone can hint me in the right direction ... I have an incoming udp data stream to public interface that I want to duplicate and multipy to three or more destinations on the internal interface. Currently I've managed to put together netcat listener with output to pipe and socat reading from that pipe to a single destination. I hoped I
2013 Apr 06
2
How to plot several years data with date information by months?
Hi, all I have a medium sized data, 6 years. Each observation is a case with a date variable, such as '2004-08-02'. Some of the months didn't occur a case. I want to plot the 6 years data by month, and the Y_axis is the freqency of cases for each month, meaning 12*6=72 bars or points in the figure. I though of a method, 1st, using the months function, then ploting. But I need to
2019 May 15
1
[PATCH] Add support for Hygon Dhyana processor
Background: Chengdu Haiguang IC Design Co., Ltd (Hygon) is a Joint Venture between AMD and Haiguang Information Technology Co.,Ltd., aims at providing high performance x86 processor for China server market. Its first generation processor codename is Dhyana, which originates from AMD technology and shares most of the architecture with AMD's family 17h, but with different
2017 Mar 10
1
Can I ask questions about libguestfs usage in SUSE linux ?
Hi all, Glad to join this mail list. As for project usage, we have to use libguestfs to mount guest image in SUSE Linux. While I see this mail list is in redhat, can I ask some question about libguest issue in SUSE ? To be or not to be, that's the question. Phoenix Wang EMC China COE Chengdu Center T: +86 (28) 8296 6862
2017 Mar 14
2
guestfsd: error while loading shared libraries in SUSE12
Hi guys, I've struggled in this error for 1 week and your help is really appreciated. As one EMC software engineer, I need to setup the libguestfs tool in SUSE12 ( SUSE11SP4 is also OK, while SUSE12 is preferred ) to mount some qcow2 image from openstack environment. Then we can read its file system architecture and restore some files. 1. The first thing is we build one SUSE
2018 Jul 23
3
[LoopVectorizer] Improving the performance of dot product reduction loop
Hello all, This code https://godbolt.org/g/tTyxpf is a dot product reduction loop multipying sign extended 16-bit values to produce a 32-bit accumulated result. The x86 backend is currently not able to optimize it as well as gcc and icc. The IR we are getting from the loop vectorizer has several v8i32 adds and muls inside the loop. These are fed by v8i16 loads and sexts from v8i16 to v8i32. The