[Jprogramming] make equations without loop

Henry Rich HenryHRich at nc.rr.com
Sun Sep 9 01:34:18 UTC 2012


OK.  I will outline a solution that you can fill in

Given the table A:

u1 v1 (x1 y1) ... repeated for many images

0.  Create a verb 'solveeqn' that will solve one system, given

   x = 200x2 array of u v
   y = 2x200 array of x y

1.  Create
   uv =. 2 {."1 A
   xy =. 2 }. |: A

2.  Run
   _2 uv&solveeqn\ xy

You will get all your answers

Henry Rich

On 9/8/2012 8:35 PM, pascha wrote:
>
> My fault again. I had to make difference between y and yi
> a-h will be derived in least-square sense, which are the final result. There
> are 50 x (a-h) unknowns correspond to each equation.
> The structure of actual data is:
>
> u1         v1        x1,1      y1,1       ...  x1,50      y1,50
> u2         v2        x2,1      y2,1       ...  x2,50      y2,50
> u3         v3        x3,1      y3,1       ...  x3,50      y3,50
> ...                              ...                   ...
> u200     v200     x200,1   y200,1   ...  x200,50   y200,50
>
> e.g. x(200,1) means "x" value of point 200 in image 1 and y(200,1) means "y"
> value of point 200 in image number 1.
> x(200,50) means "x" value of point 200 in image number 50, etc. So each
> column corresponds to "x" or "y" in one image but the image has several
> points (200 points). u,v have the same structure as x,y but are referred to
> the image 0 (reference image).
> In general x(n,m) is "x" value of point 'n' in image 'm' and y(n,m) is "y"
> value of point 'n' in image 'm'
> In order to make system of equation for image 'm' we have:
>
> u1                    x1,m     y1,m       1      0           0           0
> -u1*x1,m         -u1*y1,m
> v1                    0           0            0      x1,m      y1,m     1
> -v1*x1,m         -v1*y1,m
> u2                    x2,m     y2,m       1      0           0           0
> -u2*x2,m         -u2*y2,m
> v2                    0           0            0      x2,m      y2,m     1
> -v2*x2,m         -v2*y2,m
>
> ...           =
>
> u200                 x200,m  y200,m   1      0            0           0
> -u200*x200,m   -u200*y200,m
> v200                 0           0            0      x200,m   y200,m  1
> -v200*x200,m   -v200*y200,m
>
> Considering Y=AX, left hand-side (above) is Y and right-hand side is A and
> obviously X can be derived as: X=: Y%.A
> We have 'm' system of equation (m=50) which I have to extract from the data
> and place them in the system of equation above.
>
>
> Henry Rich wrote:
>>
>>   From this I'm pretty sure that the problem can be solved without loops
>> or boxing, but I still have no idea what any of the values
>>
>> u v y xi a-h
>>
>> mean, or what their shapes are.  Also, the description uses 'row' and
>> 'column' to describes things that seem to be matrices rather than row
>> and column vectors.
>>
>> A small example would help.  Or the actual shapes of the entities
>> involved.
>>
>> Or, I suppose, someone who understands this description better than I
>> do...
>>
>> Henry Rich
>>
>>


More information about the Programming mailing list