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

  • Home
  • SEARCH
  • 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 6552655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:29:11+00:00 2026-05-25T12:29:11+00:00

I have an array, whose size is 256. This array has elements which are

  • 0

I have an array, whose size is 256. This array has elements which are in 0 to 1 range. Now, i need an array whose size should be 65536, where each element should be interpolated or scaled from the original array of 256 values. I asked in another thread, but i wasnt clear enough 🙁

Some kind of mapping where, lets say, 10 values from the original image should match to more number values in the bigger array. Is it doable?

EDIT : lets say i have an array which is 256 floats, each float is in 0 to 1 range. Now, i need a new array, which should be 65536 floats again each float in 0 to 1 range. These new float values should be interpolated or scaled from original 256 floats.

  • 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-05-25T12:29:12+00:00Added an answer on May 25, 2026 at 12:29 pm

    Disclaimer: My C++ isn’t so great these days. This will look something more like Java. I’m assuming you weren’t planning on copying and pasting anyway: knowing the algorithm is much more important then the implementation language.

    The following algorithm does NOT make 65536 entries for a 256 entry input. Instead, it makes 65281. The reason for this is you need to scale FROM something TO something else. Consider a fence with 256 posts. You’ll only have 255 sections of fence. Each scaling corresponds to a section of fence. For simple math, I make the number of samples between each original sample equal to the number of original samples. So if you put a 4 entry input, you’ll get a 13 entry output. A 100 entry input will make a 9901 entry output.

    Enjoy!

    std::vector<double> sample(std::vector<double> orig) {
    
        std::vector<double> result(orig.size() * (orig.size() - 1) + 1);
    
        /* for each value, make that many values scaled between this and the last piece */
        for(int i = 0; i < orig.size() - 1; i++) {
            double last = orig[i];
            double curr = orig[i+1];
            double diff = curr - last;
            double step = diff / orig.size();
            int offset = i * orig.size();
            for(int j = 0; j < orig.size(); j++) {
                result[offset + j] = last + (step * j);
            }
        }
        result[result.size() - 1] = orig[orig.size() - 1];
        return result;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem initializing an array whose size is defined as extern const.
I have an array of RGB values, whose size I can guarantee to match
I have an array, called x, whose size is 6*sizeof(float). I'm aware that declaring:
I have a DataGrid whose dataProvider is an Array of int Arrays (each with
I have array like this: $path = array ( [0] => site\projects\terrace_and_balcony\mexico.jpg [1] =>
An array is defined of assumed elements like I have array like String[] strArray
VISUAL C++ Question Hi, I have array of 3 elements and I want to
i have a quite weird question which probably has no practical use but the
I have a third party C code which has large arrays of type float
I have a UILabel whose size is calculated with sizeWithFont: method. The line break

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.