Posts

Showing posts from February 15, 2019

Parsing string into tokens

Image
up vote 0 down vote favorite I have a program that takes incoming text converts it to type Reader and returns the next token, be it a word, or a space (non-word). It is not behaving as expected. To be as specific as possible, here is my testing infrastructure in Eclipse using JUnit4: @Test public void testGetNextTokenWord() throws IOException { Reader in = new StringReader("Aren't you ntired"); TokenScanner d = new TokenScanner(in); try { assertTrue("has next", d.hasNext()); assertEquals("Aren't", d.next()); assertTrue("has next", d.hasNext()); assertEquals(" ", d.next()); assertTrue("has next", d.hasNext()); assertEquals("you", d.next());

Barbastella barbastellus

Image
.mw-parser-output h1 #sous_titre_h1{display:block;font-size:0.7em;line-height:1.3em;margin:0.2em 0 0.1em 0.5em} Barbastelle d'Europe, Barbastelle commune Cet article est une ébauche concernant les chiroptères. Vous pouvez partager vos connaissances en l’améliorant ( comment ? ) selon les recommandations des projets correspondants. Barbastella barbastellus Barbastelle commune ( Barbastella barbastellus ) Classification Règne Animalia Embranchement Chordata Sous-embr. Vertebrata Classe Mammalia Sous-classe Theria Infra-classe Eutheria Ordre Chiroptera Sous-ordre Yangochiroptera Famille Vespertilionidae Sous-famille Vespertilioninae Genre Barbastella Nom binominal Barbastella barbastellus (Schreber, 1774) Statut de conservation UICN NT  : Quasi menacé La Barbastelle d'Europe ou Barbastelle commune ( Barbastella barbastellus ), est une espèce de mammifère. C’est une chauve-sour

Fast element-wise division of matrix, generated from vector with `Outer`, and another matrix

Image
up vote 4 down vote favorite m = {a, b, c}; n = {{e, r, t}, {y, u, i}, {g, h, j}}; k = Outer[Divide, m, m]; k/n gives {{1/e, a/(b r), a/(c t)}, {b/(a y), 1/u, b/(c i)}, {c/(a g), c/(b h), 1/j}} I want to do this with very large matrices filled with numbers of arbitrary precision. Is there a faster way? EDIT The sizes I am looking at for my practical applications start at 20000 and 20000^2 for the vector and matrix, respectively (of course the examples don't have to be with that many). I am also interested in any method that might parallelise well. list-manipulation matrix performance-tuning array share | improve this question edited 1 hour ago