similar to: flip certain bits in vector

Displaying 20 results from an estimated 10000 matches similar to: "flip certain bits in vector"

2009 Feb 18
2
how to randomly eliminate half the entries in a vector?
(sorry if this is a duplicate-problems with posting at my end) ---- Hello all, I need some help with a nice R-idiomatic and efficient solution to a small problem. Essentially, I am trying to eliminate randomly half of the entries in a vector that contains index values into some other vectors. More details: I am working with two strings/vectors of 0s and 1s. These will contain about 200
2009 Apr 27
3
Formatting numbers
I've been trough the R documentation for about half an hour and it's not clear to me how to do this: I need to format to character a series of integers from 1 to 1000, and I like them to look like "0001" "0002", "0059", "0123" and so on. Padded with zeroes to have four digits. Cheers! Mario. r-help-request at r-project.org wrote: > Send
2009 Aug 28
6
Google's R Style Guide
Perhaps most of you have already seen this? http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html Comments/Critiques? Thanks, Esmail ps: Reminds me of PEP 8 for Python http://www.python.org/dev/peps/pep-0008/ Maybe not that surprising since Python is also one of the main languages used by Google.
2008 May 09
2
which.max2()
Hello, which.max() only returns one index value, the one for the maximum value. If I want the two index values for the two largest values, is this a decent solution, or is there a nicer/better R'ish way? max2 <-function(v) { m=which.max(v) v[m] = -v[m] m2=which.max(v) result=c(m, m2) result } Seems to work ok. Thanks, Esmail
2008 Jun 12
3
Adding new columns to (output) data - e.g., read 5 cols write 8
Hello, I have the following task I'd like to accomplish: A file contains 5 columns of data (several hundred rows), let's call them a, b, c, d and e (ie these are their column headers) I also have a set of definitions, e.g., f = a + b g = a * 3 h = c + d etc. I would like to write out a new .rda file that contains columns a b c d e f g h etc. I.e. , the original data plus new columns
2008 May 07
1
Automatically generating new column names (and columns)
Once again I need to tap into the collective knowledge here. Let's say I have the following columns and data below Y X1 X2 X3 X4 I would like to generate additional new columns and column names (ie the data would be squared - and I'd like the column names to reflect this) like: Y X1 X2 X3 X4 X1^2 X2^2 X3^2 X4^2 I believe I can compute the values correctly with the code below, but I
2001 Jan 14
2
Help
Dear sir, I am using R in windows. I want to extend R Memory size. I use the following command, but unfortunately it doesn't work. -- vsize=15M --nsize=1000K Your help is appreciated. Thanks, Esmail Amiri. __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/
2009 Apr 26
4
comparing matrices
I'm trying to compare two matrices made up of bits. doing a simple comparison of matA == matB yields this sort of output. [,1] [,2] [,3] [,4] [,5] [,6] [1,] FALSE TRUE FALSE TRUE TRUE FALSE [2,] TRUE TRUE TRUE TRUE TRUE TRUE [3,] FALSE TRUE FALSE FALSE FALSE TRUE [4,] FALSE TRUE TRUE FALSE FALSE FALSE [5,] TRUE TRUE TRUE TRUE FALSE FALSE [6,] TRUE TRUE
2010 Feb 24
2
sprintf + integer(0) problem
Hello all, I am stuck with R v2.8.0 under Linux for the time being and I am running into a small problem that doesn't exist under 2.9.x and 2.10.x with sprintf. If I have the following code segment to help me determine the column number for a specific column header/label: nn = names(Dataset) s = "Group" c = which(nn==s) cat(sprintf('found %s in col %d\n', s, c))
2010 Feb 15
1
argh .. if/else .. why?
Hello, would someone please help explain the following inconsistency in the if/else statement to me? The format of the if/else #3 below is ok, but if/else #1 is not? (I get an "unexpected else" type error.) In order for it to work I have to use if/else #2 Thanks .. maybe there is some reason for this, but this looks very inconsistent to me. R version 2.10.1 (2009-12-14) Ubuntu 9.04
2017 Jan 26
1
[PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
> -----Original Message----- > From: Cheng, Tony > Sent: Monday, January 23, 2017 2:49 PM > To: Daniel Vetter; Grodzovsky, Andrey > Cc: Deucher, Alexander; nouveau at lists.freedesktop.org; amd- > gfx at lists.freedesktop.org; dri-devel at lists.freedesktop.org; > daniel.vetter at intel.com; dc_upstream > Subject: RE: [PATCH 1/4] drm/atomic: Save flip flags in
2017 Jan 16
2
[PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
Hi Andrey, Thank you for the patch. On Monday 16 Jan 2017 10:44:55 Andrey Grodzovsky wrote: > Allows using atomic flip helpers for drivers > using ASYNC flip. > Remove ASYNC_FLIP restriction in helpers and > caches the page flip flags in drm_plane_state > to be used in the low level drivers. > > Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com> > ---
2017 Jan 30
2
[v3 PATCH 1/3] drm/atomic: Save flip flags in drm_crtct_state
Hi Andrey, Thank you for the patch. On Saturday 28 Jan 2017 21:26:49 Andrey Grodzovsky wrote: > Allows using atomic flip helpers for drivers > using ASYNC flip. > Remove ASYNC_FLIP restriction in helpers and > caches the page flip flags in drm_crtc_state > to be used in the low level drivers. > > v2: > Resending the patch since the original was broken. > > v3:
2017 Jan 16
1
[PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
Allows using atomic flip helpers for drivers using ASYNC flip. Remove ASYNC_FLIP restriction in helpers and caches the page flip flags in drm_plane_state to be used in the low level drivers. Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com> --- drivers/gpu/drm/drm_atomic_helper.c | 10 +++------- include/drm/drm_plane.h | 8 ++++++++ 2 files changed, 11
2008 Jul 23
2
Flip Matrix form file?
Hello, I have a problem to flip a 200x200 matrix, which is imported by a .asc file. I want to flip the matrix like in a created example below: > b <- matrix(1:9,3,3,byrow=T) > b [,1] [,2] [,3] [1,] 1 2 3 [2,] 4 5 6 [3,] 7 8 9 > b1 <- apply(t(b),1,rev) > b1 [,1] [,2] [,3] [1,] 7 8 9 [2,] 4 5 6 [3,] 1 2 3 but my
2009 May 23
1
optimizing function over x,y
Hello all, I would like to maximize or minimize a given math function over a specific set of values. I was checking out Wolfram Alpha (http://www70.wolframalpha.com/) and it can do simple optimization problems in math, such as maximize 15*x - x**2 over 0 to 15 (http://www70.wolframalpha.com/input/?i=maximize+15*x+-+x**2+over+0+to+15) which finds the maximum value and input for x in
2017 Jan 18
1
[PATCH 3/4] drm/amd/display: Switch to using atomic_helper for flip.
> -----Original Message----- > From: Michel Dänzer [mailto:michel at daenzer.net] > Sent: Tuesday, January 17, 2017 8:50 PM > To: Laurent Pinchart > Cc: dri-devel at lists.freedesktop.org; Grodzovsky, Andrey; > daniel.vetter at intel.com; amd-gfx at lists.freedesktop.org; > nouveau at lists.freedesktop.org > Subject: Re: [PATCH 3/4] drm/amd/display: Switch to using
2017 Jan 23
3
[PATCH 1/4] drm/atomic: Save flip flags in drm_plane_state
On Mon, Jan 16, 2017 at 10:44:55AM -0500, Andrey Grodzovsky wrote: > Allows using atomic flip helpers for drivers > using ASYNC flip. > Remove ASYNC_FLIP restriction in helpers and > caches the page flip flags in drm_plane_state > to be used in the low level drivers. > > Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com> It's mostly guesswork, but I
2017 Jan 16
2
[PATCH 0/4] Allow ASYNC flip with atomic helpers.
On 2017-01-16 03:39 PM, Laurent Pinchart wrote: > Hi Andrey, > > Thank you for the patches. > > On Monday 16 Jan 2017 10:44:54 Andrey Grodzovsky wrote: >> This series is a folow-up on >> https://patchwork.kernel.org/patch/9501787/ >> >> The first patch makes changes to atomic helpers >> to allow for drives with ASYNC flip support to use them. >>
2017 Jan 17
4
[PATCH v2 0/3] Allow ASYNC flip with atomic helpers.
This series is a folow-up on https://patchwork.kernel.org/patch/9501787/ The first patch makes changes to atomic helpers to allow for drives with ASYNC flip support to use them. Patch 2 is to use this in AMDGPU/DC. Patch 3 is possible cleanup in nouveau/kms who seems to have to duplicate the helper as we did to support ASYNC flips. v2: Resend drm/atomic: Save flip flags in drm_plane_state