systemml-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthias Boehm" <mbo...@us.ibm.com>
Subject Re: Is there any equivalent of kron function in DML ?
Date Tue, 15 Dec 2015 13:09:20 GMT

just as an additional clarification: the construction of this permutation
matrix can also be vectorized as follows:

#construct permutation matrix
N = nrow(X)*ncol(X)*nrow(Y);
Xvs = matrix(X, rows=nrow(X)*ncol(X), cols=1);
XvsRep = Xvs%*%matrix(1, rows=1, cols=nrow(Y));
Xvl = matrix(XvsRep, rows=N, cols=1)
SRep = seq(1,nrow(Y))%*%matrix(1, rows=1, cols=nrow(X)*ncol(X));
Svl = matrix(SRep, rows=N, cols=1)
P = table(seq(1,N), Svl, N, nrow(Y)) * Xvl;

#scale and replicate Y
K = P %*% Y

Note that the subexpression (table(seq(1,N), Svl, N, nrow(Y)) * Xvl) is
just a workaround for an existing bug in certain algebraic simplification
rewrites. I'll deliver the fix in the next couple of days, which will allow
(table(seq(1,N), Svl, Xvl, N, nrow(Y))) as well.


Regards,
Matthias



From:	Matthias Boehm/Almaden/IBM@IBMUS
To:	dev@systemml.incubator.apache.org
Date:	12/15/2015 09:03 AM
Subject:	Re: Is there any equivalent of kron function in DML ?



Hi Sourav,

well, we do not support Kronecker products K = kron(X,Y) yet. However, as a
workaround you could indeed create a custom permutation matrix P from X,
where

P[1:nrow(Y),] = diag(matrix(as.scalar(X[1,1]),nrow(Y),1))
P[nrow(Y)+1:2*nrow(Y),] = diag(matrix(as.scalar(X[1,2]),nrow(Y),1))
...

and subsequently create a linearized output with

K = P %*% Y

Finally, we provide a reshape matrix constructor matrix(K, rows=...,
cols=...) that allows you to rearrange your entries as needed. If you run
this on large data for X, however, we might want to put this on the roadmap
for 2016. Could you share the characteristics of the workloads you have in
mind?


Regards,
Matthias

Sourav Mazumder ---12/14/2015 11:56:52 PM---Hi, Is there any equivalent to
kron function (of Matlab) in DML ?

From: Sourav Mazumder <sourav.mazumder00@gmail.com>
To: dev@systemml.incubator.apache.org
Date: 12/14/2015 11:56 PM
Subject: Is there any equivalent of kron function in DML ?



Hi,

Is there any equivalent to kron function (of Matlab) in DML ?

Can I use the matrix multiplication %*% for the same ?

Regards,
Sourav



Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message