solve.tensor {tensorA} | R Documentation |
Solving linear equations with tensors
Description
We can formulate linear equation systems with tensors. This functions solves these systems or gives a least squares fit of minimal norm.
Usage
## S3 method for class 'tensor'
solve(a,b,i,j=i,...,allowSingular=FALSE,eps=1E-10,by=NULL)
Arguments
a |
The a of ax=b |
b |
The a of ax=b |
i |
The dimensions of the equation in a |
j |
The dimensions of the equation in b |
allowSingular |
A boolean, indicating the that a least squares fit should be generated with singular equations systems. |
... |
further arguments for generic use |
eps |
The limit for the smallest singular value in inversion |
by |
the operation is done in parallel for these dimensions |
Details
A tensor can be seen as a linear mapping of a tensor to a tensor. Let
denote R_i
the space of real tensors with dimensions
i_1...i_d
.
- solve.tensor
Solves the equation for
a_{i_1...i_dk_1...k_p}
,b_{j_1...j_dl_1...l_q}
andx_{k_1...k_pl_1...l_q}
the equation\sum_{k_1,...,k_p} a_{i_1...i_dk_1...k_p}x_{k_1...k_pl_1...l_q}= b_{j_1...j_dl_1...l_q}
.
Value
a tensor such that ax=b as good as possible for each combination of by values.
Author(s)
K. Gerald van den Boogaart
See Also
to.tensor
, svd.tensor
,
inv.tensor
, chol.tensor
,
power.tensor
Examples
R1 <- matrix(rnorm(9),nrow=3)
R1i <- solve(R1)
R2 <- to.tensor(R1,c(a=3,b=3),what=1:2)
R2i <- to.tensor(R1i,c(b=3,a=3),what=1:2)
inv.tensor(R2,"a","b") - R2i
inv.tensor(R2,"a","b",allowSingular=TRUE) - R2i
inv.tensor(rep(R2,4,1,"K"),"a","b",by="K") - rep(R2i,4,1,"K")
inv.tensor(rep(R2,4,1,"K"),"a","b",by="K",allowSingular=TRUE) - rep(R2i,4,3,"K")
R3 <- to.tensor(rnorm(15),c(a=3,z=5))
mul.tensor(R2i,"b",mul.tensor(R2,"a",R3)) # R3
solve.tensor(R2i,R3[[z=1]],"a")
mul.tensor(R2,"a",R3[[z=1]])
solve.tensor(R2i,R3,"a")
mul.tensor(R2,"a",R3)
solve.tensor(R2i,R3[[z=1]],"a",allowSingular=TRUE)
mul.tensor(R2,"a",R3[[z=1]])
solve.tensor(R2i,R3,"a",allowSingular=TRUE)
mul.tensor(R2,"a",R3)
solve.tensor(rep(R2i,4,1,"K"),R3[[z=1]],"a",by="K")
rep(mul.tensor(R2,"a",R3[[z=1]]),4,1,"K")
solve.tensor(rep(R2i,4,1,"K"),rep(R3[[z=1]],4,1,"K"),"a",by="K")
rep(mul.tensor(R2,"a",R3[[z=1]]),4,1,"K")