[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
• Status: Solved
• Priority: Medium
• Security: Public
• Views: 262

Find the smalles Keys in a Vector

Hi all

I have double vectors
****************************
a:: {78.00 43.00 10.00};
****************************

b::  (1...n) vectors in a set
Node 0: (0 0)
weight vector: 1.00 1.00 1.00
Genes
****************************
I have  a method get_weight_vector() ..  I can use this to get individual vectors
wVector = map(i).get_weight_vector(); // returns arrary of a vector e.g 1.00 1.00 1.00
****************************
I have another method that compare the value of a and b
and returns type double = 72.12489168102785
****************************

Now for all b's sets compared with static a :
I need to get the smallest value return:: and with the smalles values reference key..
Return the set that the smallest value belongs to..

``````public double (double map)
double[] staticVector = {78.00 43.00 10.00};
double[] wVector;
double startValue  =  0.0;
for(int i=0; i<map.length; i++){

// method get weight vector return series of : 78.00 43.00 10.00 ;78.00 43.00 10.00 .. 5
wVector = map[i].get_weight_vector(); // returns arrary of all the values  ALL

double returnedValue = (wVector,  staticVector);  // returns double in format 72.12489168102785
//for map[i] with the smallest retured key value.. return the corresponding map Items

//Node 0: (0 0)
//weight vector: 1.00 1.00 1.00
//Genes

if (startValue < returnedValue) // If start value is less than return value
{
startValue  = returnedValue; // somehow I need to change the startValue to the smallest value
// or keep a reference to the smallest key during the interation
}
sort map.. until we find the map with smalles key value
If we find the smallest.. return the set:
}
``````
0
ZURINET
• 2
1 Solution

Author Commented:
Hi all
For those who might be still working on this problem ..
This problem has been solved..
will close in in 5 mins  ... sorry
0

Author Commented:
Solve the problem
0

Featured Post

• 2
Tackle projects and never again get stuck behind a technical roadblock.