[R] about matrices merge and retrieve algorithm.

Petr Savicky savicky at praha1.ff.cuni.cz
Sat Jan 22 13:43:55 CET 2011


On Sat, Jan 22, 2011 at 12:13:35PM +0530, pratik wankhade wrote:
> I have a problem as follows:
> 
>  1. If we have 3 matrices A,B,C and we merge them in a single matrix ABC by
> any method like addition , subtraction division,multiplication,etc
>  2. and then we want to retrieve original 3 matrices A,B,C from single ABC
> matrix
> What will be the algorithm?

Hello.

Note that the above operations lose information. For example, if

  A <- matrix(2, nrow=2, ncol=2)
  B <- diag(2)
  C <- B[2:1, ]
  ABC <- A + B + C
  ABC
  #      [,1] [,2]
  # [1,]    3    3
  # [2,]    3    3

then ABC does not contain enough information to reconstruct the
original A, B, C.

If you want to get any three matrices A, B, C, whose sum is ABC,
then choose any two matrices A, B and compute C as ABC - A - B.

If it is known that the original matrices are not arbitrary and
satisfy some property, which allows to find a unique solution, then
the algorithm depends on what is known about the original matrices.

Hope this helps.

Petr Savicky.



More information about the R-help mailing list