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


Groups > comp.lang.python > #79265

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin3!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.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.040
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'referring': 0.07; 'typed': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'marker': 0.16; 'match:': 0.16; 'quoted': 0.16; 'right:': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'skip:1 30': 0.19; 'written': 0.21; '>>>': 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; "i've": 0.25; '&gt;': 0.26; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'url:wiki': 0.31; 'context,': 0.31; 'url:wikipedia': 0.31; 'text': 0.33; 'url:python': 0.33; 'something': 0.35; 'case,': 0.35; 'test': 0.35; 'received:google.com': 0.35; 'combination': 0.36; 'false': 0.36; 'right?': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'so,': 0.37; 'sometimes': 0.38; 'skip:& 10': 0.38; 'thank': 0.38; 'convention': 0.38; 'needed': 0.38; 'list,': 0.38; 'pm,': 0.38; 'mailing': 0.39; 'called': 0.40; 'url:mail': 0.40; 'most': 0.60; 'no.': 0.61; "you're": 0.61; "you'll": 0.62; 'more': 0.64; 'forward': 0.65; 'to:addr:gmail.com': 0.65; 'underneath': 0.84; 'absolutely': 0.87; '2-5': 0.91
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=v/XbZHLLxZkgKsDrjikK/i1goDmONd9qP92YpFwobFM=; b=kvxPdCz7iyzQWrh1Rj5XBMm54JGPIj936Oj55vFmw/1NPzmxPLQ1pQmYhZqSY5NfOz /PsEFYBAeYE9KHhIVtz21YFLB16m1sJrKWXAarWIUDadVoV4OdFhJvtitp9YBi37dyXY 0t3cjymrlPQCIhHHWPG9tgL5lP0VUFVGKjPHmfr/pczh01a+ZR7UebL1lH5ElhJtFjOp 8Jhb36xBxz5yrFj4byTNvfL7fOWG+0HLAqTFE1VT9pNvWhj73wdKia6slU4UvTV/OQgR ALYw7yeGFUS212P3yQuPUeq5LT+WujXYoUyi10m867/FxDKu1P6s4Krk39YxSWlo58XQ 02oA==
X-Received by 10.202.84.77 with SMTP id i74mr10621047oib.29.1413616882876; Sat, 18 Oct 2014 00:21:22 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmppVp=0JN6ZT68jBNdBw7pevCHjUkO=9gxxHyFAawVGmA@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> <CA+F4vimo358APcgCsPBAwzfDBcBFNczk=YD7+ODNtY2n9sEN_w@mail.gmail.com> <CAPTjJmppVp=0JN6ZT68jBNdBw7pevCHjUkO=9gxxHyFAawVGmA@mail.gmail.com>
From Artur Bercik <vbubbly21@gmail.com>
Date Sat, 18 Oct 2014 16:21:02 +0900
Subject Re: Extract Indices of Numpy Array Based on Given Bit Information
To Chris Angelico <rosuav@gmail.com>
Content-Type multipart/alternative; boundary=001a113b09382708970505ad54d2
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.14964.1413620435.18130.python-list@python.org> (permalink)
Lines 134
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1413620435 news.xs4all.nl 2964 [2001:888:2000:d::a6]:33824
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:79265

Show key headers only | View raw


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

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

> On Sat, Oct 18, 2014 at 6:02 PM, Artur Bercik <vbubbly21@gmail.com> wrote:
> > 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.
>
> (Side point: Please don't top-post. The convention on this mailing
> list, and most other technical mailing lists, is what's sometimes
> called "interleaved style"; you trim the quoted text to what's needed
> for context, and put your text underneath what you're referring to.
> See https://en.wikipedia.org/wiki/Posting_style#Interleaved_style for
> more info.)
>
> >>> 1073741877&60
> 52
> >>> bin(52)
> '0b110100'
>
> Everything I've written with the triple-angle-bracket marker can be
> typed in at the Python prompt, and you'll see exactly what it does. In
> this case, you can see that you're absolutely right: 1073741877 has
> 1101 in those positions, so if you're looking for 1011, it won't
> match:
>
> >>> 0b101100
> 44
>
> However, 1073741869 would:
>
> >>> 1073741869&60
> 44
>
> The way to test would be something like this:
>
> >>> (1073741877 & 0b111100) == 0b101100
> False
> >>> (1073741869 & 0b111100) == 0b101100
> True
>

Thank you very much Chris Angelico, I have come to know it.





>
> 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:21 +0900

csiph-web