drag.tensor {tensorA} | R Documentation |
Managing covariate and contravariate indices
Description
Each index of a tensor can be covariate or contravariate. The is.*
routines check the state of the individual indices based on the
tensor, its dimension or its index names. drag.tensor
can
change the state for the tensor and contraname for the names of the tensor.
Usage
drag.tensor(x,g,d)
contraname(x)
is.covariate(x,...)
## S3 method for class 'tensor'
is.covariate(x,...)
## S3 method for class 'numeric'
is.covariate(x,...)
## S3 method for class 'character'
is.covariate(x,...)
as.covariate(x,...)
## S3 method for class 'character'
as.covariate(x,...)
is.contravariate(x,...)
## S3 method for class 'numeric'
is.contravariate(x,...)
## S3 method for class 'character'
is.contravariate(x,...)
as.contravariate(x,...)
## S3 method for class 'character'
as.contravariate(x,...)
Arguments
x |
the tensor, its dimension (for |
g |
The geometry tensor |
d |
a vector (or list) of indices that should be dragged,
i.e. multiplied with |
... |
only for generic use |
Details
The covariate and contravariate state of a dimension corresponds to column and row vectors. The transformation between these type is done by a linear mapping give by the geometry tensor g, which is the identity matrix if the enclosing the geometry is represented by the orthonormal basis and ordinary scalar product.
Value
drag.tensor |
returns a tensor like x but with the dimension |
is.covariate |
returns a boolean vector giving true for every covariate index |
is.contravariate |
returns a boolean vector giving true for every contravariate index |
as.* |
changes the state of the indices |
contraname |
returns the names with opposite the opposite covariate and contravariate state |
Author(s)
K. Gerald van den Boogaart
See Also
riemann.tensor
, to.tensor
, Tensor
Examples
g <- to.tensor(c(1,2,0,1),c(i=2,j=2))
A <- to.tensor(rnorm(8),c(a=2,b=2,c=2))
A2 <- drag.tensor(A,g,c("b","c"))
A2
names(A2)
as.covariate(names(A2))
as.contravariate(names(A2))
is.covariate(A2)
is.contravariate(A2)
riemann.tensor(A2,g)