# \#tensors

**URL:** https://discourse.julialang.org/tag/tensors/848.md

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

---

## [\[ANN\] LinearCombinations.jl: formal linear combinations + (multi)linear maps](https://discourse.julialang.org/t/ann-linearcombinations-jl-formal-linear-combinations-multi-linear-maps/129031)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 0\
**Last updated:** [May 15, 2025, 11:30am UTC](https://discourse.julialang.org/t/ann-linearcombinations-jl-formal-linear-combinations-multi-linear-maps/129031 "2025-05-15T11:30:59Z")

</div>

LinearCombinations.jl This package addresses a very specific part of symbolic computation: formal linear combinations and linear maps between them. Multilinear maps and tensors are also supported. Formal linear combinati…

---

## [Matrices and tensors with Symbolics.jl](https://discourse.julialang.org/t/matrices-and-tensors-with-symbolics-jl/119394)

<div class="topic-metadata">

**Author:** [@Damiano](https://discourse.julialang.org/u/Damiano)\
**Replies:** 6\
**Last updated:** [February 25, 2025, 1:29pm UTC](https://discourse.julialang.org/t/matrices-and-tensors-with-symbolics-jl/119394 "2025-02-25T13:29:04Z")

</div>

Hi all, three quick issues I encountered. Please correct me if I should have created different topics of if the Category is wrong. Best way to create a symmetric matrix This is the best I could come up with. A = Ar…

---

## [What is the best way to get a running matrix-product over a large 3D array](https://discourse.julialang.org/t/what-is-the-best-way-to-get-a-running-matrix-product-over-a-large-3d-array/125452)

<div class="topic-metadata">

**Author:** [@SanAlphaTau](https://discourse.julialang.org/u/SanAlphaTau)\
**Replies:** 9\
**Last updated:** [February 2, 2025, 4:44pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-get-a-running-matrix-product-over-a-large-3d-array/125452 "2025-02-02T16:44:16Z")

</div>

Heya, I am doing some markov process simulations which output NxN matrices these are stored (currently) in a 3D array X\[N, N, M) where M can be very large (1E6 or more). My code currently uses a reduce statement reduce…

---

## [Comparison of tensor packages?](https://discourse.julialang.org/t/comparison-of-tensor-packages/11425)

<div class="topic-metadata">

**Author:** [@tparker](https://discourse.julialang.org/u/tparker)\
**Replies:** 29\
**Last updated:** [November 27, 2024, 4:07pm UTC](https://discourse.julialang.org/t/comparison-of-tensor-packages/11425 "2024-11-27T16:07:12Z")

</div>

Julia seems to have many different packages for tensor operations, like TensorFlow, TensorOperations, Tensors, TensorToolbox, and TensorWorkbench. Is there a general consensus as to which one(s) are the most useful? Coul…

---

## [\[ANN\] TensorKit.jl v0.13](https://discourse.julialang.org/t/ann-tensorkit-jl-v0-13/122259)

<div class="topic-metadata">

**Author:** [@lkdvos](https://discourse.julialang.org/u/lkdvos)\
**Replies:** 0\
**Last updated:** [November 4, 2024, 9:19pm UTC](https://discourse.julialang.org/t/ann-tensorkit-jl-v0-13/122259 "2024-11-04T21:19:11Z")

</div>

Hi everyone, Together with @juthohaegeman, I’m excited to announce the release of TensorKit.jl v0.13﻿, a Julia package designed for large-scale tensor computations with a touch of category theory. This release brings a …

---

## [\[ANN\] Tensorial.jl: Statically sized tensors and related operations for Julia](https://discourse.julialang.org/t/ann-tensorial-jl-statically-sized-tensors-and-related-operations-for-julia/121588)

<div class="topic-metadata">

**Author:** [@KeitaNakamura](https://discourse.julialang.org/u/KeitaNakamura)\
**Replies:** 24\
**Last updated:** [October 25, 2024, 11:30am UTC](https://discourse.julialang.org/t/ann-tensorial-jl-statically-sized-tensors-and-related-operations-for-julia/121588 "2024-10-25T11:30:18Z")

</div>

Tensorial.jl I’d like to announce Tensorial.jl, a package I’ve developed and actively use in my research. Tensorial.jl provides statically sized Tensor similar to SArray from StaticArrays.jl, but with several additional …

---

## [How to measure the time taken by a part of the code excluding the disk operations](https://discourse.julialang.org/t/how-to-measure-the-time-taken-by-a-part-of-the-code-excluding-the-disk-operations/117469)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 5\
**Last updated:** [July 26, 2024, 9:30am UTC](https://discourse.julialang.org/t/how-to-measure-the-time-taken-by-a-part-of-the-code-excluding-the-disk-operations/117469 "2024-07-26T09:30:33Z")

</div>

I am trying to write a code that deals with repeated deserialization of tensors followed by contracting them and storing the result in another tensor. Here is an example of how the code looks like : I\_vvoo = zeros(F…

---

## [How to read a file and initialize tensors with it's values without having it in memory?](https://discourse.julialang.org/t/how-to-read-a-file-and-initialize-tensors-with-its-values-without-having-it-in-memory/117418)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 6\
**Last updated:** [July 25, 2024, 9:58am UTC](https://discourse.julialang.org/t/how-to-read-a-file-and-initialize-tensors-with-its-values-without-having-it-in-memory/117418 "2024-07-25T09:58:06Z")

</div>

I have a simple (but possibly enormous) text file which has five columns, the first one has a floating point value and the other four have integer values , it looks like F p q r s where basically I want to write a tens…

---

## [Reduce allocation in nested for loops](https://discourse.julialang.org/t/reduce-allocation-in-nested-for-loops/117428)

<div class="topic-metadata">

**Author:** [@EthanN](https://discourse.julialang.org/u/EthanN)\
**Replies:** 2\
**Last updated:** [July 24, 2024, 8:46pm UTC](https://discourse.julialang.org/t/reduce-allocation-in-nested-for-loops/117428 "2024-07-24T20:46:29Z")

</div>

I have a function that calculates the expectation and covariance of random variables on a grid with dimensions (nx, ny, nz). The variables y and z are Markovian, with Qy and Qz being their Markov matrices. Functions f an…

---

## [\[ANN\] TensorOperations v5](https://discourse.julialang.org/t/ann-tensoroperations-v5/117091)

<div class="topic-metadata">

**Author:** [@juthohaegeman](https://discourse.julialang.org/u/juthohaegeman)\
**Replies:** 0\
**Last updated:** [July 16, 2024, 8:35am UTC](https://discourse.julialang.org/t/ann-tensoroperations-v5/117091 "2024-07-16T08:35:11Z")

</div>

Together with @lkdvos , we are pleased to announce v5 of TensorOperations. In this version, we have further improved the AD support and further extended the support for different backends and allocation strategies to de…

---

## [Using Tensorial.jl to deal with Tensors with high symmetries](https://discourse.julialang.org/t/using-tensorial-jl-to-deal-with-tensors-with-high-symmetries/116360)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 1\
**Last updated:** [June 28, 2024, 3:32pm UTC](https://discourse.julialang.org/t/using-tensorial-jl-to-deal-with-tensors-with-high-symmetries/116360 "2024-06-28T15:32:35Z")

</div>

I am writing code that deals with contractions of large tensors which possess high symmetry. As an example, I have a tensor g whose certain entries are read from a data file. The remaining entries are entered using the …

---

## [Cannot install BliContractor.jl](https://discourse.julialang.org/t/cannot-install-blicontractor-jl/116251)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 8:04pm UTC](https://discourse.julialang.org/t/cannot-install-blicontractor-jl/116251 "2024-06-26T20:04:57Z")

</div>

I am trying to install BliContractor.jl , to replace all the tensor contractions in my code that used the @tensor macro with TBLIS. However, when I try to install it using the package manager, I am presented with the fol…

---

## [How to solve the non linear Coupled Cluster equations using Inexact Newton with DIIS?](https://discourse.julialang.org/t/how-to-solve-the-non-linear-coupled-cluster-equations-using-inexact-newton-with-diis/115291)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 1\
**Last updated:** [June 16, 2024, 12:02pm UTC](https://discourse.julialang.org/t/how-to-solve-the-non-linear-coupled-cluster-equations-using-inexact-newton-with-diis/115291 "2024-06-16T12:02:09Z")

</div>

I have been trying to solve the Coupled Cluster Amplitude Equations which are a set of non-linear equations using Julia. The aim is to find cluster amplitudes tensor T2 such that the residual tensor (defined below) is ze…

---

## [How to initialize a tensor with permutational symmetry?](https://discourse.julialang.org/t/how-to-initialize-a-tensor-with-permutational-symmetry/115390)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 1\
**Last updated:** [June 9, 2024, 1:52pm UTC](https://discourse.julialang.org/t/how-to-initialize-a-tensor-with-permutational-symmetry/115390 "2024-06-09T13:52:44Z")

</div>

I am working on a iterative solver for non linear Coupled Cluster equations that would require a computation of lot of tensor elements via tensor contractions. For now, I am using the TensorOperations.jl for this purpose…

---

## [Custom reshape() function for specific usage](https://discourse.julialang.org/t/custom-reshape-function-for-specific-usage/113382)

<div class="topic-metadata">

**Author:** [@Harrykjg-physics](https://discourse.julialang.org/u/Harrykjg-physics)\
**Replies:** 3\
**Last updated:** [April 25, 2024, 9:14am UTC](https://discourse.julialang.org/t/custom-reshape-function-for-specific-usage/113382 "2024-04-25T09:14:10Z")

</div>

Hi there ! Is there any way to minimize the memory usage of the following custom function graded\_reshape() ( Or even achieve the same performance as the Julia reshape function ) ? Suppose we have a usual Julia reshape…

---

## [How do I implement the fastest tensor contractions](https://discourse.julialang.org/t/how-do-i-implement-the-fastest-tensor-contractions/111007)

<div class="topic-metadata">

**Author:** [@Laura](https://discourse.julialang.org/u/Laura)\
**Replies:** 11\
**Last updated:** [April 18, 2024, 1:40pm UTC](https://discourse.julialang.org/t/how-do-i-implement-the-fastest-tensor-contractions/111007 "2024-04-18T13:40:53Z")

</div>

I am writing a program which has a tensor contraction with a 4d symmetrical tensor at it’s core. Needless to say, since it will be used inside a non linear problem solver in the future, I need this tensor contraction to …

---

## [Using TensorOperations.jl when contracting tensors not following strict Einstein summation convention](https://discourse.julialang.org/t/using-tensoroperations-jl-when-contracting-tensors-not-following-strict-einstein-summation-convention/113034)

<div class="topic-metadata">

**Author:** [@Gattu\_Mytraya](https://discourse.julialang.org/u/Gattu_Mytraya)\
**Replies:** 8\
**Last updated:** [April 17, 2024, 12:47pm UTC](https://discourse.julialang.org/t/using-tensoroperations-jl-when-contracting-tensors-not-following-strict-einstein-summation-convention/113034 "2024-04-17T12:47:46Z")

</div>

I am trying to implement the following computation on a GPU. @tensor S\[i,j\] = A\[a1,j\]\*F\[a1,i,a2\]\*B\[a2,j\] As per the strict Einstein summation convention, this is not a valid expression as the index j appears twice on t…

---

## [Represent multidimensional array at higher dimension](https://discourse.julialang.org/t/represent-multidimensional-array-at-higher-dimension/109889)

<div class="topic-metadata">

**Author:** [@croberts](https://discourse.julialang.org/u/croberts)\
**Replies:** 9\
**Last updated:** [February 7, 2024, 11:30pm UTC](https://discourse.julialang.org/t/represent-multidimensional-array-at-higher-dimension/109889 "2024-02-07T23:30:15Z")

</div>

suppose I have a 2x3 array called mat1. I would like to pretend that this 2x3 array is actually a 2x3x4 array called mat1\_3d\_representation, such that mat1\_3d\_representation\[i, j, k\] == mat1\[i, j\] for all valid scala…

---

## [How to Kronecker by row (one dimension only)](https://discourse.julialang.org/t/how-to-kronecker-by-row-one-dimension-only/33942)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 4\
**Last updated:** [February 5, 2024, 9:14pm UTC](https://discourse.julialang.org/t/how-to-kronecker-by-row-one-dimension-only/33942 "2024-02-05T21:14:29Z")

</div>

I have two matrices A and B. Rather than a full Kronecker product kron(A,B), I would like to Kronecker in a row-by-row fashion. That is, the first row of the resulting matrix should have kron(A\[1,:\],B\[1,:\]), the second r…

---

## [Creating a tensor (array) in the tensor product of super vector spaces](https://discourse.julialang.org/t/creating-a-tensor-array-in-the-tensor-product-of-super-vector-spaces/106657)

<div class="topic-metadata">

**Author:** [@Yue-Zhengyuan](https://discourse.julialang.org/u/Yue-Zhengyuan)\
**Replies:** 8\
**Last updated:** [November 26, 2023, 1:15am UTC](https://discourse.julialang.org/t/creating-a-tensor-array-in-the-tensor-product-of-super-vector-spaces/106657 "2023-11-26T01:15:54Z")

</div>

I want to create a custom array of arrays (each array is called a “block”) indexed by a list of 0 and 1’s. For example, suppose the array has 4 dimensions; then. The arrays are indexed by (0,0,0,0), (0,0,0,1), (0,0,1,0…

---

## [Memory allocation when using permutedims](https://discourse.julialang.org/t/memory-allocation-when-using-permutedims/105806)

<div class="topic-metadata">

**Author:** [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Replies:** 1\
**Last updated:** [November 5, 2023, 6:28am UTC](https://discourse.julialang.org/t/memory-allocation-when-using-permutedims/105806 "2023-11-05T06:28:20Z")

</div>

Hi, I am trying to do some operations on some large tensor (roughly 2^(24)-2^(26) complex elements). I need to use reshape and permutedims frequently. Considering the large size of the tensor I consider, I am a little w…

---

## [Similar thing to numpy's einsum in Julia](https://discourse.julialang.org/t/similar-thing-to-numpys-einsum-in-julia/103932)

<div class="topic-metadata">

**Author:** [@jisutich](https://discourse.julialang.org/u/jisutich)\
**Replies:** 6\
**Last updated:** [September 17, 2023, 2:30am UTC](https://discourse.julialang.org/t/similar-thing-to-numpys-einsum-in-julia/103932 "2023-09-17T02:30:11Z")

</div>

Hi, I am thinking about how to achieve something similar to numpy.einsum in Julia. For instance, if I have a tensor T\_{ijk} and a matrix u\_{jj'}, I want to get T'\_{ijk}= u\_{jj'}T\_{ij'k}. Also, I want to do things like H…

---

## [Convert matrix of 3D arrays to 3D array](https://discourse.julialang.org/t/convert-matrix-of-3d-arrays-to-3d-array/101888)

<div class="topic-metadata">

**Author:** [@mastrof](https://discourse.julialang.org/u/mastrof)\
**Replies:** 12\
**Last updated:** [July 23, 2023, 9:05am UTC](https://discourse.julialang.org/t/convert-matrix-of-3d-arrays-to-3d-array/101888 "2023-07-23T09:05:04Z")

</div>

I have N^2 3D arrays, all with size (nx, ny, nz). These arrays are arranged in a square matrix (N x N). I would like to expand the inner arrays concatenating them along the first two dimensions but not along the third, s…

---

## [Convert (N)D Array to (N-2)D Array of SMatrix elements](https://discourse.julialang.org/t/convert-n-d-array-to-n-2-d-array-of-smatrix-elements/85555)

<div class="topic-metadata">

**Author:** [@andrewkhardy](https://discourse.julialang.org/u/andrewkhardy)\
**Replies:** 3\
**Last updated:** [July 1, 2023, 10:45am UTC](https://discourse.julialang.org/t/convert-n-d-array-to-n-2-d-array-of-smatrix-elements/85555 "2023-07-01T10:45:28Z")

</div>

I want to do matrix inversion on a stack of matrices, based on this post. I’m having difficulty recasting the arrays though. In my case, the array will come as data or an input to a function, but here is a minimal exampl…

---

## [TensorKit efficiency](https://discourse.julialang.org/t/tensorkit-efficiency/59559)

<div class="topic-metadata">

**Author:** [@Nellatur](https://discourse.julialang.org/u/Nellatur)\
**Replies:** 11\
**Last updated:** [April 12, 2023, 5:40am UTC](https://discourse.julialang.org/t/tensorkit-efficiency/59559 "2023-04-12T05:40:20Z")

</div>

I tried to run a contraction A\[a,b\]\*B\[b,c,d\] = C\[a,c,d\], assume repeated index b as summation using TensorKit. By the following code, it seems TensorKit is even slower than nested loops. Does TensorKit use BLAS? or is…

---

## [Language: "tensor" vs "array"](https://discourse.julialang.org/t/language-tensor-vs-array/96590)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [March 27, 2023, 3:12pm UTC](https://discourse.julialang.org/t/language-tensor-vs-array/96590 "2023-03-27T15:12:32Z")

</div>

When (in which situations) would you employ the word “tensor” and when instead you would stick to “array” to describe a generic n-dimensional “matrix”, for example to describe your API ?

---

## [CUDA on slices](https://discourse.julialang.org/t/cuda-on-slices/86782)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 5\
**Last updated:** [September 6, 2022, 2:45am UTC](https://discourse.julialang.org/t/cuda-on-slices/86782 "2022-09-06T02:45:33Z")

</div>

Trying to apply a function to slices of a CuArray. Tried broadcasting, mapslices and various Tensor packages. Is there any way to do this? using CUDA, Pipe, Interpolations, TensorCast d = Uniform(1,30) x = Float64.(1…

---

## [Implementing the tensor algebra functor](https://discourse.julialang.org/t/implementing-the-tensor-algebra-functor/64433)

<div class="topic-metadata">

**Author:** [@choquet](https://discourse.julialang.org/u/choquet)\
**Replies:** 0\
**Last updated:** [July 10, 2021, 5:32pm UTC](https://discourse.julialang.org/t/implementing-the-tensor-algebra-functor/64433 "2021-07-10T17:32:28Z")

</div>

I’m trying to implement the free tensor algebra functor T: given a vector space V it creates another vector space T(V). This vector space T(V) has many nice properties, for example, T(V) is not just a vector space but al…

---

## [Using TensorCast with JuliaPy](https://discourse.julialang.org/t/using-tensorcast-with-juliapy/85588)

<div class="topic-metadata">

**Author:** [@andrewkhardy](https://discourse.julialang.org/u/andrewkhardy)\
**Replies:** 0\
**Last updated:** [August 10, 2022, 2:33pm UTC](https://discourse.julialang.org/t/using-tensorcast-with-juliapy/85588 "2022-08-10T14:33:16Z")

</div>

I am getting a world age bug when running TensorCast in JuliaPy, but not when using it normally. If I run an example function such as function testfunc() V = \[10,20,30\] M = collect(reshape(1:12, 3,4)) @cast…

---

## [Is there any way to optimize array additions and multiplications with transposes?](https://discourse.julialang.org/t/is-there-any-way-to-optimize-array-additions-and-multiplications-with-transposes/80268)

<div class="topic-metadata">

**Author:** [@Geositta](https://discourse.julialang.org/u/Geositta)\
**Replies:** 27\
**Last updated:** [August 2, 2022, 8:06am UTC](https://discourse.julialang.org/t/is-there-any-way-to-optimize-array-additions-and-multiplications-with-transposes/80268 "2022-08-02T08:06:32Z")

</div>

The question is related to python - Optimizing array additions and multiplications with transposes - Stack Overflow Given A is an array, I want to evaluate sum += p(A) \* factor(p) where p is a permutation/transpose, fa…

[Next page](https://discourse.julialang.org/tag/tensors/848.md?match_all_tags=true&page=1&tags%5B%5D=tensors)
