Questions tagged [tensor]

For questions involving computational modeling with tensors. The most common definitions of a tensor are a multilinear map or simply a multilinear array.

Filter by
Sorted by
Tagged with
1 vote
0 answers
26 views

Normalisation in tensor networks

I am trying to implement the iTEBD algorithm for the $PXP$ model, i.e, the hamiltonian is $$H = \sum_iP_{i-1}X_iP_{i+1}.$$ Here $P$ is the projector onto the ground state and $X$ is the usual pauli x ...
  • 11
1 vote
1 answer
63 views

Computing material derivated of tensor quantity

I would like to compute the material derivated of a tensor quantity, in the context of the finite volume method (FVM): The equation is: $$ \frac{\mathrm{d} \textbf{T}}{\mathrm{d} t} = \frac{\partial \...
1 vote
1 answer
73 views

Converting a 4 rank matrix to 2 rank matrix after using tensorproduct

Let's say I have a 2x2 matrix (with symbols) called 'A'. Now, if do B = sympy.tensorproduct(A,A) print(sympy.shape(B)) I get, ...
1 vote
1 answer
255 views

Confusion about bilinear form for elasticity equation in deal.ii tutorial

I'm learning how to solve vector-valued problems with deal.II library. In particular, I'm looking at the following introduction from the official website https://www.dealii.org/current/doxygen/deal.II/...
  • 211
1 vote
0 answers
144 views

3D Matrix (Tensor) Operating On a 1D Vector

Say you have a tensor $T$ and the components are represented by a 3 by 3 by 3 matrix. And you want to use that tensor to map a vector $u$ into a new vector $s$, both of which are 3 by 1 column vectors....
  • 131
2 votes
0 answers
35 views

Scaling tensor approximation by symmetric tensor decomposition with SciPy's L-BFGS-B

I am trying to approximate a symmetric tensor of which the values are in the range of [1e-7,1e-4], by a symmetric tensor decomposition of lower rank. For this I am using the L-BFGS-B method in SciPy's ...
  • 21
6 votes
1 answer
2k views

4th order tensor rotation - sources to refer

I am trying to model a linear elastic material in Abaqus using a UMAT. For my application, I need to rotate the 6x6 compliance matrix for a given set of eigenvectors (or a rotation matrix). I came ...
1 vote
1 answer
174 views

Gradient of dot product of two tensors

Through obtaining an alternative form for force balance equation in a fluid mechanics problem, I stopped at a point where I have to prove this identity where $A$ and $B$ are second-order matrices:$$\...
  • 235
-1 votes
1 answer
232 views

Numpys `tensordot` and what is happening mathematically

I've encountered a program where np.tensordot was used, so I tried looking it up but I can't really understand what this function is doing... I feel rather ...
  • 131
4 votes
1 answer
75 views

Compute distances from a vector to a matrix of vectors

Let $\vec{a} \in \mathbb{R}^\alpha$, and let $H$ be a rank 3 tensor with dimensions $M_{[i \in \mathbb{N}]} \times N_{[j \in \mathbb{N}]} \times \alpha_{[k \in \mathbb{N}]}$ (where the subscript are ...
  • 143
1 vote
0 answers
45 views

Second fundamental form - Maple

I would like to know the command/line in Maple 16 or similar to obtain the second fundamental form tensor for a given metric. I've managed to obtain Rienmann and Ricci tensor, even Weyl, but I can't ...
4 votes
1 answer
1k views

Is there a library that allows einstein summation on dense, sparse, and LinearOperator type tensors

Numpy's einsum only works with dense tensors. Is there an alternative that also works with sparse tensors and linear operators? For example, I might have a ...
  • 777
1 vote
0 answers
171 views

How to get the derivatives of the determinant and inverse of 2nd-order tensor wrt itself in SymPy?

I have a second-order tensor for which I need to compute the derivatives of its determinant and inverse w.r.t. itself. The equations are as follows: $$\frac{\partial \, det(\mathbf{F})}{\partial F_{...
  • 810
0 votes
1 answer
345 views

Computing excited states using itensor (with DMRG)

I am trying to compute first few excited states of some Hamiltonian (I am using itensor and its DMRG algorithm). To do so, I am ...
0 votes
2 answers
142 views

Second derivative in coordinate invariant form

To solve stationary, incompressible, inviscid and irrotational flow around a circular cylinder, I am using general coordinates. Since the flow is symmetrical, we only consider the upper half of the ...
1 vote
1 answer
134 views

triple cross prouct of tensor

Im trying to compute a triple cross product of vectors a,b, and c in real space and integrate over the entire space. The result is a term in the hamiltonian for an electronic system so there are ...
  • 13
1 vote
2 answers
1k views

Derivative of the inverse of the Right Cauchy-Green Deformation Tensor wrt itself

In continuum mechanics, we define the Right-Cauchy-Green Deformation Tensor as $\boldsymbol{C}=\boldsymbol{F}^T\boldsymbol{F}$ I want to compute $\frac{\partial \boldsymbol{C}^{-1}}{\partial \...
1 vote
0 answers
101 views

Efficient out-of-place arbitrary rank GPU transpose

Summary: Is there an efficient out-of-place GPU tensor transpose operation that scales as $O(n)$ for tensors with $n$ total elements, regardless of the rank $d$? The naive algorithm costs $O(dn)$, ...
5 votes
3 answers
3k views

Efficiently computing the product of a multi-dimensional matrix (or tensor) and vectors

Update: Thank you very much for all of you who answered below. I'm studying each answer now. In the long term, I'm more interested in solutions that work for sparse tensors (sorry I should have ...
  • 515
1 vote
1 answer
115 views

Binary tensor operations in Nutils [closed]

How does one write general tensor contractions in the Python-based finite element package Nutils? For example, how does one write the contraction of a fourth-order elasticity tensor $\boldsymbol{C}$ ...
9 votes
3 answers
1k views

Second order tensor field visualization software

Is there an overview available over tensor visualization software? My personal preference is: A software which is free, well documented, and offers visualization techniques for different physical ...
  • 425
0 votes
2 answers
195 views

Vector and index notation equivalence

Given 2 vectors $\mathbf{u}$ and $\mathbf{v}$ the following are equivalent: $\mathbf{u}\cdot\mathbf{v}$ $\mathbf{u}^T \mathbf{v}$ $u_i v_i$ $v_i u_i$ $\mathbf{v}\cdot\mathbf{u}$ $\mathbf{v}^T\...
1 vote
0 answers
53 views

Optimization of nonlocal stencil-like operator on subset of regular grid

I am trying to optimize the execution time for this particular piece of fortran code. Details: i_gc is a (ngpts, 3) array of containing (i,j,k) indices for each grid point. This is a subset of the ...
0 votes
2 answers
106 views

Explain this multivariate differential identity

$$ \frac{\partial|\nabla\phi|^2}{\partial\phi}=-2\nabla\cdot\nabla\phi$$ I would very appreciate that you help me . Please do it in detail, I am quite not good at such problems. There is something ...
  • 11
1 vote
0 answers
204 views

What is the relation between Kruskal tensor and CP decomposition?

In Matlab Tensor Toolbox there is a tensor type called "Kruskal tensors", I found its form is similar to the CP decomposition. Wikipedia mentioned: "As such, many of the methods have been ...
1 vote
0 answers
217 views

4th order tensor [closed]

I'm new with FEniCS and Python and I'm stuck with this issue: is there a way to write a 4th order tensor in an easy way to implement? I have to compute the following stiffnes tensor: $A_{ijkl}= \...
1 vote
1 answer
53 views

Anisotropic invariant expansion

I am trying to calculate the second and third invariants for a turbulent flow. I have the second order statistics (both transient and averaged). i.e $uu$, $vv$, $ww$, $uv$, $vw$ and $uw$. These are ...
  • 21
1 vote
1 answer
600 views

Any relation between the singular values of each flattening matrices and the core tensor out of Tucker decomposition?

Before I know how to do tucker decomposition, I mistakenly thought the core tensor is only from combining the singular value matrices of the flattening matrices. Yes I know it is not now. For the ...
3 votes
1 answer
268 views

Is there a reference/source paper for the TUCKER_ALS() in Tensor Toolbox for MATLAB?

TUCKER_ALS computes the best rank-(R1,R2,..,Rn) approximation of tensor X, according to the specified dimensions. I am using MATLAB Tensor Toolbox Version 2.5. I am wondering if I write a paper, how ...
2 votes
0 answers
416 views

finite volume for diffusion equation with anisotropic (tensor) coefficient

Consider the scalar PDE for $u$ with Dirichlet boundary conditions: $\mathrm{div}(\mathcal{K}\nabla u) = f\; \forall x\; \in \Omega \subset R^2$, $u = 0 \; \forall \; x\;\in \partial\Omega$ ...
  • 435
29 votes
10 answers
20k views

Fast, lightweight C++ tensor library for dimension-agnostic code

I am looking for a C++ tensor library that supports dimension-agnostic code. Specifically, I need to perform operations along each dimension (up to 3), e.g. calculating a weighted sum. The dimensions ...