Displaying 20 results from an estimated 25 matches for "subarray".
2005 Apr 29
2
Subarrays
Define an array
> v<-1:256
> dim(v)<-rep(4,4)
Subarrays can be obtained as follows:
> v[3,2,,2]
[1] 71 87 103 119
> v[3,,,2]
[,1] [,2] [,3] [,4]
[1,] 67 83 99 115
[2,] 71 87 103 119
[3,] 75 91 107 123
[4,] 79 95 111 127
In the general case this procedure is very tedious.
Given an array
A, dim(A)=(dim_1,dim_2,....
2006 Oct 19
2
arraytake for extracting subarrays from multidimensional arrays
Hi,
I recently encountered a problem with array subsetting and came up with a
fix. Given an array of arbitrary dimensions, in which the number of
dimensions is only known at runtime, I wanted to extract a subarray. The
main issue with doing this is that in order to extract a subarray from an
array of (say) 4 dimensions you usually specify something like this
a.subarray <- a[,c(4,2),1:5,]
However, if your code needs to handle an array with an arbitrary number of
dimensions then you can't hard code th...
2010 Dec 16
1
Subarray specification problem
Hi. I'm new to R, and I'm still learning R's system for addressing
subsets of data structures. I'm particularly interested in the
problem of selecting subarrays based on complex criteria involving the
dimnames (as opposed to the values of the cells) of the array. Here's
an example of such a problem.
Suppose I have an array x of unknown dimensions (it may have been
passed as the argument to a function I'm coding), but I know that one
of its dimen...
2010 Mar 18
2
how to take multiple subsets from a matrix
...16,23)
> dat[miss] <- NA
> mat <- matrix(dat,5,5)
> mat
[,1] [,2] [,3] [,4] [,5]
[1,] 3 9 3 NA 2
[2,] NA 2 13 4 7
[3,] 1 NA 1 6 NA
[4,] 9 6 4 10 5
[5,] 12 NA 8 11 10
I define a multidimensional array to hold the 9 subarrays I want:
> subarray <- array(0,dim=c(3,3,9))
I want to populate each 3x3 array within subarray with the value from mat,
taking the values from mat to be the center values of each array,
respectively. so, excluding the edges of mat, there are 9 values to build
3x3 arrays from: 2,13,4,NA,1,6,...
2010 Mar 16
2
Help running a Fortran subroutine from R
...filter2d")
[1] TRUE
Then I pass the parameters according to the order they are specified in the
filter:
array <- data.matrix(read.table("time702.txt",header=F))
array1 <- array
nx <- 60
ny <- 120
halfintx <- 3
halfinty <- 3
mask <- matrix(array(rep(1.0,25)),5,5)
subarray <- matrix(0,5,5)
subarray1 <- matrix(0,5,5)
Then I run the Fortran subroutine...
out <- .Fortran("filter2d",
as.single(array),
as.single(array),
as.integer(nx),
as.integer(ny),
as.integer(halfintx),
as.integer(halfinty),
as.single(mask),
as.single(...
2008 Jun 18
1
subarray
Hello everyone,
I am trying to subset a matrix with the following code:
dat<-read.table(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt",header=T,row.names=1)
file.show(file="C:\\Documents and Settings\\Owner\\My Documents\\Yeast\\Yeast.txt")
Z.matrix<-as.matrix(dat)
Y<-array(dat,dim(,[46:63])
but I keep getting the error message: error in dim
2004 Aug 23
3
idea for "virtual matrix/array" class
...ensible use of seek operations, the data access
could probably be quite fast. The file format of the object on disk could
possibly be the standard serialized binary format as used in .RData
files. Of course, if the object was larger than would fit in memory, then
trying to extract too large a subarray would exhaust memory, but it should
be possible to efficiently extract reasonably sized subarrays. To be more
useful, one would want want apply() to work with such arrays. That would
be doable, either by creating a new method for apply, or possibly just for
aperm.
Some difficulties that migh...
2006 Aug 01
2
Indexing issue
...following weird behavior and I am not sure if that is a
feature or a bug:
I am working on the following "3D" array:
> bIm
, , 1
[,1]
[1,] TRUE
[2,] TRUE
[3,] TRUE
[4,] TRUE
[5,] TRUE
> class(bIm)
[1] "array"
> dim(bIm)
[1] 5 1 1
When I try to get the first 2D subarray, the whole thing folds into a
vector:
> bIm[,,1]
[1] TRUE TRUE TRUE TRUE TRUE
This causes a lot of trouble in the R code as one would have expected to get
a 2D array but ends up with this "logical" vector.
Is this the way it was meant to be? Does not this behavior bother anyone
else...
2007 Nov 24
1
ragged array with append
I wonder what's the right way in R to do the following -- placing
objects of the same kind together in subarrays of varying length.
Here's what I mean:
> word <- c("a","b","c","d","e","f","g","h","i","j")
> kind <- c(1,1,1,2,3,4,5,5,7,7)
> d <- data.frame(word,kind)
> d
wor...
2006 Aug 11
2
Array#chunk method, maybe someone will find this useful
...rying to loop through an activerecord
result array and determine how to handle displaying a specific # of
items per row and what to do when you have an odd number of elements
on the last row? it can get ugly.
Array.chunk might be for you.
this method takes an array and breaks it out into smaller subarrays of
a specified size.
@photos = Photo.find(:all).
say you had 12 photos returned...chunk would break your array of
photos up into ''chunks'' of 5 elements each adding nil objects to fill
in the empty elements, so you would end up with
[[p1, p2, p3, p4, p5], [p6, p7, p8, p9, p10],...
2009 Feb 01
1
[LLVMdev] Aliasing (was Performance vs other VMs)
...because I consider it to
represent how fast my LLVM-based VM might be compared to other garbage
collected VMs.
However, LLVM has a serious disadvantage compared to the other VMs here
because it does not have aliasing assurances. For example, it does not know
about array aliasing, e.g. that the subarrays in the successive
over-relaxation test cannot overlap.
The LLVM 2.1 release notes say that llvm-gcc got alias analysis and understood
the "restrict" keyword but when I add it to the C code for SciMark2 it makes
no difference. Can anyone else get this to work?
--
Dr Jon Harrop, Flyi...
2012 May 19
0
Re: [RFC PATCH 0/7] bcache: md conversion
...al conversion. Other refactoring items like
> deprecating register_lock for mddev->reconfig_mutex are deferred.
>
> This supports assembly of an already established cache array:
>
> mdadm -A /dev/md/bcache /dev/sd[ab]
>
> ...will create the /dev/md/bcache container and a subarray representing
> the cache volume. "Flash-only", or backing-device only volumes were not
> tested. "Create" support and hot-add/hot-remove come later.
>
> Note:
> * When attempting to test with small loopback devices (100MB), assembly
> soft locks in bcache_...
2010 Dec 18
0
What's wrong with these mail headers?
...xWd4r+LBJSBq9h+2d9pOBXWRg5cgWHnz3z at mail.gmail.com>
> <4D0B6C82.1030407 at yorku.ca>
> Date: Sat, 18 Dec 2010 08:54:16 -0500
> Delivered-To: rshmz29 at gmail.com
> Message-ID:
> <AANLkTikHJT8T+Ao4qNj8ZrACubNk+hSPGA+JQG3o4hwG at mail.gmail.com>
> Subject: Re: Subarray specification problem
> From: Roy Shimizu <rshmz29 at gmail.com>
> To: r-help at r-project.org
> Content-Type: text/plain; charset=ISO-8859-1
>
>
> If anyone can tell what set off the filter, please let me know.
>
> Thanks!
>
> Hoping that this message doesn&...
2009 Feb 01
0
[LLVMdev] Performance vs other VMs
This is not a quite fair comparison. Other virtual machines must be
doing garbage collection, while LLVM, as it is using C code, it is
taking advantage of memory allocation by hand.
On Fri, Jan 30, 2009 at 9:56 PM, Jon Harrop <jon at ffconsultancy.com> wrote:
>
> The release of a new code generator in Mono 2.2 prompted me to benchmark the
> performance of various VMs using the
2004 Sep 15
2
efficient submatrix extraction
Hi,
I have a matrix of say 1024x1024 and I want to look at it in chunks.
That is I'd like to divide into a series of submatrices of order 2x2.
| 1 2 3 4 5 6 7 8 ... |
| 1 2 3 4 5 6 7 8 ... |
| 1 2 3 4 5 6 7 8 ... |
| 1 2 3 4 5 6 7 8 ... |
...
So the first submatrix would be
| 1 2 |
| 1 2 |
the second one would be
| 3 4 |
| 3 4 |
and so on. That is I want the matrix to be evenly divided
2019 Jul 21
6
[RFC] A new multidimensional array indexing intrinsic
...s appears to make expressing this information quite difficult: We
now need to attach the shape
information to an array per "shape-live-range".
## Appendix-A
##### A realistic, more involved example of dependence analysis going wrong
```cpp
// In an array A of size (n0 x n1),
// fill a subarray of size (s0 x s1)
// which starts at an offset (o0 x o1) in the larger array A
void set_subarray(unsigned n0, unsigned n1,
unsigned o0, unsigned o1,
unsigned s0, unsigned s1,
float A[n0][n1]) {
for (unsigned i = 0; i < s0; i++)
for (unsigned j = 0; j < s1; j++)
S: A[i + o0][j + o1]...
2009 Jan 30
5
[LLVMdev] Performance vs other VMs
The release of a new code generator in Mono 2.2 prompted me to benchmark the
performance of various VMs using the SciMark2 benchmark on an 8x 2.1GHz
64-bit Opteron and I have published the results here:
http://flyingfrogblog.blogspot.com/2009/01/mono-22.html
The LLVM results were generated using llvm-gcc 4.2.1 on the C version of
SciMark2 with the following command-line options:
llvm-gcc
2019 Jul 22
2
[RFC] A new multidimensional array indexing intrinsic
...he shape
>> information to an array per "shape-live-range".
>>
>>
>> ## Appendix-A
>>
>> ##### A realistic, more involved example of dependence analysis going wrong
>>
>> ```cpp
>> // In an array A of size (n0 x n1),
>> // fill a subarray of size (s0 x s1)
>> // which starts at an offset (o0 x o1) in the larger array A
>> void set_subarray(unsigned n0, unsigned n1,
>> unsigned o0, unsigned o1,
>> unsigned s0, unsigned s1,
>> float A[n0][n1]) {
>> for (unsigned i = 0; i < s0; i++)
>> for (...
2019 Jul 22
2
[RFC] A new multidimensional array indexing intrinsic
...need to attach the shape
> information to an array per "shape-live-range".
>
>
> ## Appendix-A
>
> ##### A realistic, more involved example of dependence analysis going wrong
>
> ```cpp
> // In an array A of size (n0 x n1),
> // fill a subarray of size (s0 x s1)
> // which starts at an offset (o0 x o1) in the larger array A
> void set_subarray(unsigned n0, unsigned n1,
> unsigned o0, unsigned o1,
> unsigned s0, unsigned s1,
> float A[n0][n1]) {
> for (unsigned i = 0; i < s0; i++)
>...
2019 Jul 25
0
[RFC] A new multidimensional array indexing intrinsic
...array per "shape-live-range".
>>>
>>>
>>> ## Appendix-A
>>>
>>> ##### A realistic, more involved example of dependence analysis going wrong
>>>
>>> ```cpp
>>> // In an array A of size (n0 x n1),
>>> // fill a subarray of size (s0 x s1)
>>> // which starts at an offset (o0 x o1) in the larger array A
>>> void set_subarray(unsigned n0, unsigned n1,
>>> unsigned o0, unsigned o1,
>>> unsigned s0, unsigned s1,
>>> float A[n0][n1]) {
>>> for (unsigned i = 0; i <...