tensorProduct is defined in RepresentationPackage1 but I can't find
cartesianProduct. Have I missed it? If not would it be possible to add
the following.
definition:
cartesianProduct : (M R, M R) -> M R
++ cartesianProduct(a,b) calculates the Kronecker sum
++ of the matrices {\em a} and b.
implementation:
cartesianProduct(a: M R, b: M R) ==
n : NNI := nrows a
m : NNI := nrows b
nc : NNI := ncols a
mc : NNI := ncols b
c : M R := zero(n * m, nc * mc)
indexr : NNI := 1 -- row index
for i in 1..n repeat
for k in 1..m repeat
indexc : NNI := 1 -- column index
for j in 1..nc repeat
for l in 1..mc repeat
if i = j then
c(indexr,indexc) := c(indexr,indexc) + b(k,l)
if k = l then
c(indexr,indexc) := c(indexr,indexc) + a(i,j)
indexc := indexc + 1
indexr := indexr + 1
c
The reason I would like this is to check the Cartesian product of the
graphs I am working on by taking Kronecker sum of adjacency matrix.
Martin
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fricas-devel?hl=en.