Latin Square

If I was given two matrices X and Y of any size, what should my approach be to test that the superimposed X,Y matrix is a true Latin Square and that every pair in the resulting Matrix is a unique pair?
Any advice welcome.

10 件のコメント

Image Analyst
Image Analyst 2011 年 11 月 20 日
How are you superimposing the two matrices? Latin squares can be any size, though usually not too large. I'm not sure what you mean when you talk about pairs. In a 4 by 4 Latin Square for example, what is X, what is Y, and what is a "pair"?
Andrew
Andrew 2011 年 11 月 20 日
Andrew 3 minutes ago Delete
Andrew 1 minute ago Delete
if X = [1,2,3; 3,7,7; 9,1,2]
and Y = [4,2,5; 3,2,9; 6,1,2]
my resulting matrix would be
(1,4) (2,2) (3,5)
(3,3) (7,2) (7,9)
(9,6) (1,1) (2,2)
Walter Roberson
Walter Roberson 2011 年 11 月 20 日
Those are both good examples of things that are *not* Latin Squares.
Andrew
Andrew 2011 年 11 月 20 日
that's true. I'm trying to write a function that takes two matrices as input and would determine if the new matrix formed by (X,Y) forms a Latin Square.
Andrew
Andrew 2011 年 11 月 20 日
I just quickly typed up a bad description of a matrix in order to get the format question answered I guess
Andrew
Andrew 2011 年 11 月 20 日
any advice? point me in the right direction? reading material etc?
Image Analyst
Image Analyst 2011 年 11 月 20 日
I don't even see how your "matrix" is even a matrix. To me it looks more like a 3 by 3 cell array where each cell in the cell array contains a 2 by 1 array of numbers.
Image Analyst
Image Analyst 2011 年 11 月 20 日
Did you check Wikipedia or the Internet for Latin Square discussions and explanations?
Andrew
Andrew 2011 年 11 月 20 日
Yes now I have done some research, I now understand Latin Square better. I should rephrase my question. I would like to input two n-by-n matrices, check if each is a Latin Square. After that, superimpose the matrices and check if that n-by-n cell array contains unique 2-by-1 arrays.
Image Analyst
Image Analyst 2011 年 11 月 20 日
What have you tried? Have you called unique() and seen if the length of the unique numbers is equal to the length of the rows (or columns)?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

質問済み:

2011 年 11 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by