search for: nelem

Displaying 20 results from an estimated 39 matches for "nelem".

Did you mean: elem
2007 Aug 06
3
Error in using nlevels in apply function
...em to work. I did not find anything uesful in the archives so could someone point to me where my mistake(s) is (are) ? Thanks in advance Sebastien #------------------------- mydata<-data.frame(1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6,1:6) mycol.index<-c(1,5,3) nelem<-function(x,col.id) nlevels(factor(x[,col.id])) my.nlevels.col<-apply(mydata,2,nelem,mycol.index) my.nlevels.col #---------------------------- #The error message is the following #>Error in x[, col.id] : incorrect number of dimensions
2008 Dec 22
17
[PATCH 0 of 9] swiotlb: use phys_addr_t for pages
Hi all, Here''s a work in progress series whcih does a partial revert of the previous swiotlb changes, and does a partial replacement with Becky Bruce''s series. The most important difference is Becky''s use of phys_addr_t rather than page+offset to represent arbitrary pages. This turns out to be simpler. I didn''t replicate the map_single_page changes, since
2014 Jun 30
0
[PATCH 1/1] ia64: use ARRAY_SIZE instead of sizeof/sizeof[0]
...ch/ia64/kernel/paravirt.c index 1b22f6d..17bb2d1 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c @@ -864,8 +864,7 @@ __initdata_or_module = unsigned long __init_or_module ia64_native_patch_bundle(void *sbundle, void *ebundle, unsigned long type) { - const unsigned long nelems = sizeof(ia64_native_patch_bundle_elems) / - sizeof(ia64_native_patch_bundle_elems[0]); + const unsigned long nelems = ARRAY_SIZE(ia64_native_patch_bundle_elems); return __paravirt_patch_apply_bundle(sbundle, ebundle, type, ia64_native_patch_bundle_elems, @@ -894,9 +893,8 @@ __ini...
2014 Jun 30
0
[PATCH 1/1] ia64: use ARRAY_SIZE instead of sizeof/sizeof[0]
...ch/ia64/kernel/paravirt.c index 1b22f6d..17bb2d1 100644 --- a/arch/ia64/kernel/paravirt.c +++ b/arch/ia64/kernel/paravirt.c @@ -864,8 +864,7 @@ __initdata_or_module = unsigned long __init_or_module ia64_native_patch_bundle(void *sbundle, void *ebundle, unsigned long type) { - const unsigned long nelems = sizeof(ia64_native_patch_bundle_elems) / - sizeof(ia64_native_patch_bundle_elems[0]); + const unsigned long nelems = ARRAY_SIZE(ia64_native_patch_bundle_elems); return __paravirt_patch_apply_bundle(sbundle, ebundle, type, ia64_native_patch_bundle_elems, @@ -894,9 +893,8 @@ __ini...
2012 Jul 17
3
complexity of operations in R
Hello! I am optimizing my code in R and for this I need to know a bit more about the internals. It would help tremendously if someone could link me to a page with O()-complexities of all the operations. In this particular case, I need something like a linked list with O(1) insertLast/First ability. I can't preallocate a vector since I do not know the final size of the list ahead of time. The
2011 Aug 14
0
Improved version of Rprofmem
...lu, rather than %ld, which I think is not correct. I think incorporating this in the upcoming 2.14.0 release would be useful. For instance, the following gives some useful insights into what R is doing with memory allocation: > Rprofmem("",terminal=TRUE,pages=FALSE,details=TRUE,nelem=10000) > f <- function (x) + { cat("Now in f\n"); + s <- sum(x); + cat("sum =",s,"\n"); + x[10] <- 1; + s <- sum(x); + cat("sum =",s,"\n") + x[20] <- 1; + s <- sum(x);...
2005 Mar 10
1
R_alloc with more than 2GB (PR#7721)
...) maxcp * (long) n; mI = (double*) R_alloc(vs, sizeof(double)); I suspect this caused by allocString(int), which is called by R_alloc, see below. Would it be possible to have allocString take a long argument as well? These code excerpts are from R-devel_2005-03-10.tar.gz: char *R_alloc(long nelem, int eltsize) { R_size_t size = nelem * eltsize; SEXP s = allocString(size); ... } SEXP allocString(int length) { return allocVector(CHARSXP, length); } SEXP allocVector(SEXPTYPE type, R_len_t length) { ... case CHARSXP: size = BYTE2VEC(length + 1); ... malloc(sizeof(SEXPREC_AL...
2016 Jun 02
0
[RFC v3 20/45] xen: dma-mapping: Use unsigned long for dma_attrs
...direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { xen_unmap_single(hwdev, dev_addr, size, dir, attrs); } @@ -538,7 +538,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_sync_single_for_device); int xen_swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_data_direction dir, - struct dma_attrs *attrs) + unsigned long attrs) { struct scatterlist *sg; int i; @@ -599,7 +599,7 @@ EXPORT_SYMBOL_GPL(xen_swiotlb_map_sg_attrs); void xen_swiotlb_unmap_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems, enum dma_...
2008 Jan 19
1
R_alloc segfaults
I want to write a little stand-alone C program that calls R_alloc, but I get a segmentation fault: int main(int argc, char** argv){ double* d = (double *)R_alloc(2, sizeof(double)); // <- segmentation fault! return 0; } gdb reveals that sizeof(double) evaluated to 0: > R_alloc (nelem=2, eltsize=0) at memory.c:1649 so it results in the segfault later. This is how I compile my program: $ cd R-2.6.1/src/main $ gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -g...
1997 Jul 28
0
R-alpha: R 0.50.a1 S_alloc BUG, priority = URGENT
The current version of S_alloc in src/main/memory.c is char *S_alloc(long nelem, int eltsize) { unsigned int i, size; char *p = R_alloc(nelem, eltsize); for(i=0 ; i<size; i++) p[i] = 0; return p; } which segfaults because `size' is not initialized. I am not what the right fix is, adding size = nelem * eltsize; before the loop seems to work. As an aside ... I...
2010 May 04
4
Contar rachas en una matriz
Buen día a todos el problema que tengo es el siguiente: tengo una matriz 0 0 0 1 5 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 6 0 0 0 0 0 0 0 0 0 1 4 0 1 0 7 2 9 0 1 necesito hacer el primer conteo de números hasta que encuentre el primer cero. para la fila 1: tiene 1 y 5 son dos elementos fila 2: solo tiene 1 elemento fila 3: tiene 1 fila 4: 1 y 6 dos elementos fila 5: no tiene elementos distintos de
2016 Jan 05
0
R, AIX 64-bit builds - trying to understand root cause for message: "Error: Line starting 'Package: tools ...' is malformed!"
...gt; I will have to check if R-devel has different code before asking for > assistence. > > +2139 #ifdef HAVE_STDALIGN_H > +2140 # include <stdalign.h> > +2141 #endif > +2142 > +2143 #include <stdint.h> > +2144 > +2145 long double *R_allocLD(size_t nelem) > +2146 { > +2147 #if __alignof_is_defined > +2148 // This is C11: picky compilers may warn. > +2149 size_t ld_align = alignof(long double); > +2150 #elif __GNUC__ > +2151 // This is C99, but do not rely on it. > +2152 size_t ld_align = offsetof(s...
2019 Dec 21
0
[PATCH 2/8] iommu/vt-d: Use default dma_direct_* mapping functions for direct mapped devices
...v, size, vaddr, dma_handle, attrs); - size = PAGE_ALIGN(size); order = get_order(size); @@ -3673,9 +3639,6 @@ static void intel_unmap_sg(struct device *dev, struct scatterlist *sglist, struct scatterlist *sg; int i; - if (iommu_no_mapping(dev)) - return dma_direct_unmap_sg(dev, sglist, nelems, dir, attrs); - for_each_sg(sglist, sg, nelems, i) { nrpages += aligned_nrpages(sg_dma_address(sg), sg_dma_len(sg)); } @@ -3699,8 +3662,6 @@ static int intel_map_sg(struct device *dev, struct scatterlist *sglist, int nele struct intel_iommu *iommu; BUG_ON(dir == DMA_NONE); - if (iommu...
2016 Jun 02
52
[RFC v3 00/45] dma-mapping: Use unsigned long for dma_attrs
Hi, This is third approach (complete this time) for replacing struct dma_attrs with unsigned long. The main patch (2/45) doing the change is split into many subpatches for easier review (3-43). They should be squashed together when applying. *Important:* Patchset is *only* build tested on allyesconfigs: ARM, ARM64, i386, x86_64 and powerpc. Please provide reviewes and tests for other
2019 Dec 21
13
[PATCH 0/8] Convert the intel iommu driver to the dma-iommu api
This patchset converts the intel iommu driver to the dma-iommu api. While converting the driver I exposed a bug in the intel i915 driver which causes a huge amount of artifacts on the screen of my laptop. You can see a picture of it here: https://github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922.jpg This issue is most likely in the i915 driver and is most likely caused by the
2019 Dec 21
13
[PATCH 0/8] Convert the intel iommu driver to the dma-iommu api
This patchset converts the intel iommu driver to the dma-iommu api. While converting the driver I exposed a bug in the intel i915 driver which causes a huge amount of artifacts on the screen of my laptop. You can see a picture of it here: https://github.com/pippy360/kernelPatches/blob/master/IMG_20191219_225922.jpg This issue is most likely in the i915 driver and is most likely caused by the
2016 Jan 04
2
R, AIX 64-bit builds - trying to understand root cause for message: "Error: Line starting 'Package: tools ...' is malformed!"
...ne 2149.31: 1506-046 (S) Syntax error. I will have to check if R-devel has different code before asking for assistence. +2139 #ifdef HAVE_STDALIGN_H +2140 # include <stdalign.h> +2141 #endif +2142 +2143 #include <stdint.h> +2144 +2145 long double *R_allocLD(size_t nelem) +2146 { +2147 #if __alignof_is_defined +2148 // This is C11: picky compilers may warn. +2149 size_t ld_align = alignof(long double); +2150 #elif __GNUC__ +2151 // This is C99, but do not rely on it. +2152 size_t ld_align = offsetof(struct { char __a; long doubl...
2019 Sep 08
7
[PATCH v6 0/5] iommu/amd: Convert the AMD iommu driver to the dma-iommu api
Convert the AMD iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the AMD iommu driver. Change-log: V6: -add more details to the description of patch 001-iommu-amd-Remove-unnecessary-locking-from-AMD-iommu-.patch -rename handle_deferred_device to iommu_dma_deferred_attach -fix double tabs in 0003-iommu-dma-iommu-Handle-deferred-devices.patch V5: -Rebase on
2019 Jun 13
8
[PATCH v4 0/5] iommu/amd: Convert the AMD iommu driver to the dma-iommu api
Convert the AMD iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the AMD iommu driver. Change-log: V4: -Rebase on top of linux-next -Split the removing of the unnecessary locking in the amd iommu driver into a seperate patch -refactor the "iommu/dma-iommu: Handle deferred devices" patch and address comments v3: -rename dma_limit to dma_mask -exit
2019 Jun 13
8
[PATCH v4 0/5] iommu/amd: Convert the AMD iommu driver to the dma-iommu api
Convert the AMD iommu driver to the dma-iommu api. Remove the iova handling and reserve region code from the AMD iommu driver. Change-log: V4: -Rebase on top of linux-next -Split the removing of the unnecessary locking in the amd iommu driver into a seperate patch -refactor the "iommu/dma-iommu: Handle deferred devices" patch and address comments v3: -rename dma_limit to dma_mask -exit