Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8938589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:39:39+00:00 2026-06-15T10:39:39+00:00

I’ve reduced a compression problem I am working on to the following: You are

  • 0

I’ve reduced a compression problem I am working on to the following:

You are given as input two n-length vectors of floating point values:

float64 L1, L2, ..., Ln;
float64 U1, U2, ..., Un;

Such that for all i

0.0 <= Li <= Ui <= 1.0

(By the way, n is large: ~10^9)

The algorithm takes L and U as input and uses them to generate a program.

When executed the generated program outputs an n-length vector X:

float64 X1, X2, ..., Xn;

Such that for all i:

L1 <= Xi <= Ui

The generated program can output any such X that fits these bounds.

For example a generated program could simply store L as an array and output it. (Notice this would take 64n bits of space to store L and then a little extra for the program to output it)

The goal is that the generated program (including data) as small as possible, given L and U.

For example suppose that it happens that every element of L was less than 0.3 and every element of U was greater than 0.4 than the generated program could just be:

for i in 1 to n
    output 0.35

Which would be tiny.

Can anyone suggest a strategy, algorithm or architecture to tackle this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:39:40+00:00Added an answer on June 15, 2026 at 10:39 am

    This simple heuristic is very fast and should provide very good compression if the bounds allow for a very good compression:

    Prepare an arbitrary (virtual) binary search tree over all candidate values. float64s share the sorting order with signed int64s, so you can arbitrarily prefer (have nearer to the root) the values with more trailing zeroes.

    • For each pair of bounds
      • start at the root.
      • While the current node is larger than both bounds OR smaller than both bounds,
        • descend down the tree.
      • append the current node into the vector.

    For the tree mentioned above, this means

    • For each pair of bounds
      • find the (unique) number within the specified range that has as few significant bits as possible

      . That is, find the first bit where both bounds differ; set it to 1 and all following bits to 0; if the bit that’s set to 1 is the sign bit, set it to 0 instead.

    Then you can feed this to a deflateing library to compress (and build a self-extracting archive).


    A better compression might be possible to achieve if you analyse the data and build a different binary search tree. Since the data set is very large and arrives as a stream of data, it might not be feasible, but this is one such heuristic:

    • while the output is not fully defined
      • find any value that fits within the most undecided-for bounds:
        • sort all bounds together:
          • bounds with lower value sort before bounds with higher value.
          • lower bounds sort before upper bounds with the same value.
          • indistinguishable bounds are grouped together.
        • calculate the running total of open intervals.
        • pick the largest total. Either the upper or the lower bound will do. You could even try to make a “smart choice” by splitting the interval with the least amount of significant bits.
      • set this value as the output for all positions where it can be used.

    Instead of recalculating the sort order, you could cache the sort order and only remove from that, or even cache the running total as well (or switch from recalculating the running total to caching the running total at runtime). This does not change the result, only improve the running time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tracked down a weird MySQL problem to the two different ways I was
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I would like to count the length of a string with PHP. The string
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have been unable to fix a problem with Java Unicode and encoding. The
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.