At this moment the function is used to query the database of spectra to find the big spectra 'similiar' to given small subspectrum. So i match nearly thousand of spectra (at the moment, the database is continiously increasing) against one subspectrum.

I did not think about any optimizations when i wrote the first version of the function (not shown here). But after a while i realized that most requests cause the server to hang and understood that the situation needs some improvement :) The function i demonstrated works about 400 times faster than the old one :)

The dynamic range and precision of the data are known. All signals in all spectra lie between 200 and 0. The precision is always the same, e.g. "%.2f".

But if you have any suggestions about how the function can be improved if i need to match e.g. 10_000 subspectra against one spectum, i'd be very glad to read them.


     s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print

In reply to Re^2: Calculate the similarity of two arrays of numbers by Ieronim
in thread Calculate the similarity of two arrays of numbers by Ieronim

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.