Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #79263

Re: Extract Indices of Numpy Array Based on Given Bit Information

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <vbubbly21@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.032
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'suppose': 0.07; 'bits': 0.09; 'cc:addr:python-list': 0.11; 'binary,': 0.16; 'did,': 0.16; 'sense,': 0.16; 'zero.': 0.16; 'zeroes': 0.16; '\xc2\xa0if': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'skip:1 30': 0.19; '>>>': 0.22; 'example': 0.22; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; '&gt;&gt;&gt;': 0.24; 'cc:2**0': 0.24; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'there.': 0.32; 'url:python': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'combination': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'so,': 0.37; 'pm,': 0.38; 'does': 0.39; 'url:mail': 0.40; 'hope': 0.61; 'new': 0.61; 'no.': 0.61; 'numbers': 0.61; "you're": 0.61; 'more': 0.64; 'forward': 0.65; 'to:addr:gmail.com': 0.65; '2-5': 0.91; 'imagine': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=T4+fGpCA0V2/hk8sepWYG6NXSQd7JAvGCtEalrzYYqo=; b=ym+UCdqEvJJeqkMmICdwBeUpMVRSuQSXnqPA2qJ86r12XFF/9THnW3MxJhar7adshh G2kw36wwFFk7pckLCXHM0oh/kFab/QtSEs0unj+HYuJRSiVkIKVf21wfFdVRhYO71zA1 PiaStG1sYvq+DrFK0kwe5u10l+qHyJwIwHjZWKs7crrmrf9PAwfgW2MVME9ej5iLhSxN B00JG+PSvwrQuLmNteFPcsm9CFSekIsbD++JwkFXjD+QgY/iZ65pyaqxq781txI5ReA7 x7LqFOLtw6jDy+7ESLC1bZmVIUHzFCqBtdI4tARNUh0+TkbKdRP/vju/5Zbe7f5lwfUT K+Dg==
X-Received by 10.202.104.210 with SMTP id o79mr10468467oik.41.1413615765428; Sat, 18 Oct 2014 00:02:45 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmqkvC-yoBbsudk8y3tZ53Afbg38g3Aj0ffg21yBfwZ4Pg@mail.gmail.com>
References <CA+F4vi=SMCNO-v55ZyKBau6+HAt=HPRYECnVkUr28wzgG3praA@mail.gmail.com> <CAPTjJmohbdOOn_Ug1iYBJO6NMoR944OY+ecUCamGO26hTNZEcA@mail.gmail.com> <CA+F4vinwQvNJWu2wkx_sr+xhTWJOvXtODb9PZH9vvYbSCG+1iQ@mail.gmail.com> <CAPTjJmqkvC-yoBbsudk8y3tZ53Afbg38g3Aj0ffg21yBfwZ4Pg@mail.gmail.com>
From Artur Bercik <vbubbly21@gmail.com>
Date Sat, 18 Oct 2014 16:02:25 +0900
Subject Re: Extract Indices of Numpy Array Based on Given Bit Information
To Chris Angelico <rosuav@gmail.com>
Content-Type multipart/alternative; boundary=001a114098a08c20b10505ad1163
X-Mailman-Approved-At Sat, 18 Oct 2014 10:20:33 +0200
Cc "python-list@python.org" <python-list@python.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14963.1413620435.18130.python-list@python.org> (permalink)
Lines 102
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413620435 news.xs4all.nl 2962 [2001:888:2000:d::a6]:33823
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79263

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

So, the  Bit No. 2-5 for the following case is '1101', right?

1073741877: 1000000000000000000000000110101

 If my required bit combination for Bit No. 2-5 is '1011', then the above
number (1073741877) is not chosen, right??

Look forward to know your confirmation.

On Sat, Oct 18, 2014 at 3:50 PM, Chris Angelico <rosuav@gmail.com> wrote:

> On Sat, Oct 18, 2014 at 5:42 PM, Artur Bercik <vbubbly21@gmail.com> wrote:
> > I got some sense, but could not imagine if required Bit No. 2–5, and  Bit
> > Combination 0000.
> >
> > I hope example with the new case would make me more sense.
> >
>
> Just write the number in binary, with the bits you're interested in
> set to 1, and everything else 0:
>
> ... 876543210
> ... 000111100
>
> >>> 0b000111100
> 60
> >>> 1073741877 & 0b000111100
> 52
>
> So this number does _not_ have all zeroes there. If it did, the result
> would be zero. To look for some other pattern, just do the same thing
> - suppose we want to find numbers where it's 1001, we just look for
> the result to be 0b000100100, or 36.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Extract Indices of Numpy Array Based on Given Bit Information Artur Bercik <vbubbly21@gmail.com> - 2014-10-18 16:02 +0900

csiph-web