How to write a 'horizontal direct product' (*~) from Gauss in Matlab?

Asked by Patrick on 18 Aug 2012
Latest activity Answered by Patrick on 20 Aug 2012

Hi,

I am trying to write the 'horizontal direct product' (*~) from Gauss in Matlab. Anyone can help me?

E.g. Horizontal direct product z = x*~y;

x = [1 2; 3 4]; y = [5 6; 7 8];

z = [5 6 10 12; 21 24 28 32]

NB. The input matrices x and y must have the same number of rows. The result will have cols( x) * cols( y) columns.

Thanks!

0 Comments

Patrick

Products

No products are associated with this question.

3 Answers

Answer by Matt Fig on 18 Aug 2012
Accepted answer
z = repmat(y,1,size(x,2)).*kron(x,ones(1,size(y,2)))

0 Comments

Matt Fig
Answer by Walter Roberson on 18 Aug 2012

That is a subset of the output of kron(x,y)

2 Comments

Patrick on 18 Aug 2012

Thanks, Walter. I noted that, but do you know how to extract this subset?

Walter Roberson on 18 Aug 2012

Row indexing, but I do not know what the general pattern is (I would need a few additional examples of different lengths to go on.)

Walter Roberson
Answer by Patrick on 20 Aug 2012

Thanks, Matt. That's perfect.

0 Comments

Patrick

Contact us