[Scilab-users] need a little help

P M p.muehlmann at gmail.com
Mon Feb 18 20:38:10 CET 2019


@ Claus:

...well actually I wanted to treat every coordinate separatly....so A would
be my X coordinate of the map and B would be the x coordinate of the line.
Afterwarsd I would do the same with the Y-coordinate..

So I think my question expressed what I wanted to do in the beginning.

What I did not expect was, that the size of the arrays would matter  (did
not expect this memory issue).

Anyways....of course you are right.
Cheers,
Philipp



Am Mo., 18. Feb. 2019 um 18:32 Uhr schrieb Claus Futtrup <cfuttrup at gmail.com
>:

> Hi Philipp
>
> >problem solved.....I had to think differently than before.
>
> Heh!
>
> It helps to know what you actually want to do (and also the size of the
> problem).
>
> Cheers,
> Claus
>
> On 18.02.2019 18:08, P M wrote:
>
> problem solved.....I had to think differently than before.
>
> Actually my goal was to compare point coordinates to map coordinates and
> find the points on the map which are closest to the given point coordinates.
>
> The map is of width:    900    // in reality the map is based on an image
> with 900x1500 pixels
> The map is of height: 1500
>
> The points are building a line on the map...e.g: the line consists of 1076
> points
> So from the map I have build:
>
> x = map(1,:);   // contains all x coordinates of the map
> y = map(2,:);   // contains all y coordinates of the map
>
> points = [ lineX, lineY];      // points contain the X-Y-coordinates of
> the line
>
> for i = 1:n
>      actPoint = points(i,:);
>      [nearestX xInd]   = min(abs(actPoint(1)-x));
>      [nearestY yInd]  = min(abs(actPoint(2)-y));
>      nearestPoint(i,:) = [x(xInd) y(yInd)];
> end
>
>
> This is what works for now, though it is still slow.
>
> For searching 100 points of the line it needs about 10 seconds.
> For searching 200 points of the line it needs about 19 seconds.
> For searching 500 points of the line it needs about 45 seconds.
> For searching 1000 points of the line it needs about 98 seconds.
>
>
>
>
>
>
>
> Am Mo., 18. Feb. 2019 um 16:39 Uhr schrieb P M <p.muehlmann at gmail.com>:
>
>> Ok, thanks for your help..
>>
>> Actually the sizes I gave where just for demonstation.
>>
>> If I use the real array sizes, I get a message: can not allocate
>> 7469.60MB memory...which maybe is true.
>> available RAM after starting Scilab is 3701 MB
>>
>> actual array sizes:
>>
>> A has 1076 elements
>> B has 1'350'000 elements, with a lot of Nan's in it
>>
>> if I use thrownan(B) I can reduce the array size of B to 867751 elements
>> but still get the Message above.
>>
>> (without thrownan() the memory scilab wants to allocate is even bigger)
>>
>>
>>
>>
>> Am Fr., 15. Feb. 2019 um 23:25 Uhr schrieb Samuel Gougeon <
>> sgougeon at free.fr>:
>>
>>> ... and even clearer, with respect to your own notations:
>>>
>>> --> A = rand(1,1000);  // test's data
>>> --> B = rand(1,10000);
>>> --> [a, b] = ndgrid(A, B);
>>> --> size(a)  // same for b
>>>  ans  =
>>>    1000.   10000.
>>> --> [v, i] = min(abs(a-b), *"c"*);
>>>
>>> _______________________________________________
>>> users mailing list
>>> users at lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>>
> _______________________________________________
> users mailing listusers at lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
> <#m_-8272210635697132897_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190218/2bf3303d/attachment.htm>


More information about the users mailing list