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
On 9/8/2012 5:54 PM, pascha wrote:
Sorry for confusion. The "a" matrix is not what you've described.
I have to solve 49 independent equations
y = a1.x1
y = a2.x2
...
y = a49.x49
"y" in all the equations is fixed which is corresponds to the first column
of data and number of unknowns in "x" depends on the design matrix "a" that
has the same structure for all. In wider perspective each above equation has
two rows:
u = (x y 1 0 0 0 -ux -uy) . (a b c d e f g h)
v = (0 0 0 x y 1 -vx -vy) . (a b c d e f g h)
"u","v" are the values in first column
"x", "y" corresponds to values from other columns (from 2 to 50) and
a,b,c,..,h are unknowns.
The redundancy comes in because the data has 200 rows. So for each equation
(y = ax) we have 400 observations and 8 unknowns
In total we have 8 x 49 unknowns which are independent from each other.
To solve the first 8 unknowns I have to extract first column (corresponds to
left hand side of equation) and the second column (corresponds to right hand
side), for the second 8 unknowns I have to extract first column again (on
the left) and third column (on the right), etc.
Raul Miller-4 wrote:
I'm confused.
In your first message, you said that you are solving y=ax, and that
you had data for y and for a, and that y's shape was 200 while a's
shape was 200 49 (which would suggest that x has shape 49). And I
thought you were asking for help in extracting the data from a textual
format.
In this message you seem to say that you have x and y, and that you
have the numbers and just need to figure out how to use them. Also,
you seem to be suggesting that both x and y have a shape of 200 50,
which would suggest that "a" has a shape of 200 200.
Anyways, let's take the case described in the first message, where
your data is a 200 50 matrix representing y = ax.
Or, expressed in J, we want
Y -: A +/ .* X
The closest we can get to this would be:
Y=: {."1 data
A=: }."1 data
X=: (%.A)+/ .*Y
Except, of course, if we are working with completely random data (for
example: data=: ?200 50$0), Y -: A +/ .* X will almost certainly not
be valid (because we have 200 equations and only 49 unknowns and in
the completely random case that leaves 51 more degrees of freedom than
we can express). Still, we can get a least squares approximation...
From your description of the second case, the best I can come up with is:
Y=: 50 {."1 DATA
X=: 50 }."1 DATA
A=: Y +/ .*%.X
and if DATA=: ?200 100$0 the difference between Y and A +/ .* X should
be reasonably small, so that almost makes sense...
But, of course, these two concepts of X, Y and A are very different
from each other.
--
Raul
On Sat, Sep 8, 2012 at 4:31 PM, pascha <amirpasha...@gmail.com> wrote:
The content of the text is numbers (x y positions). I trimmed all the
unnecessary characters (like , ( ) = etc.) and what I got is a 200 x 50
matrix (or more precisely 200 x 100 because we have x and y). I managed
to
get and solve the equation for the 2nd column but I need strategy for
other
columns in a automatic way (i.e. in loop or without loop)
Raul Miller-4 wrote:
What does the text look like?
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm