Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensor multiplication library

Tags:

c

I am writing a scientific code in c which requires numerous tensor products, and higher-order tensor operations as well, e.g. contraction, kronecker product, etc. I am planning on implementing this myself using efficient algorithms as in the literature and employing a good BLAS library. I did some looking about and haven't really found anything for c (plenty for c++, python etc.). Am I missing something or has this really not been well implemented in c?

Thanks.

like image 480
Mosby Avatar asked Feb 13 '12 18:02

Mosby


People also ask

How do you multiply tensors?

Multiply two or more tensors using torch. mul() and assign the value to a new variable. You can also multiply a scalar quantity and a tensor. Multiplying the tensors using this method does not make any change in the original tensors.

What is Tensordot in Python?

Tensordot (also known as tensor contraction) sums the product of elements from a and b over the indices specified by axes . This operation corresponds to numpy. tensordot(a, b, axes) . Example 1: When a and b are matrices (order 2), the case axes=1 is equivalent to matrix multiplication.

What does TF multiply do?

TensorFlow multiply tensor by scaler In this section, we will discuss how to multiply tensor by scaler in Python TensorFlow. To do this task, we are going to use the tf. multiply() function and this function will help the user to multiply tensor by the scaler. In simple words, a scaler is a single value.

Which operator is used to perform matrix multiplication on tensors?

If you want to carry out matrix multiplication, this can be done with the function Dot and is described in the section "Matrix Multiplication". An example of element-wise multiplication is shown in the following example: Copy to clipboard.


1 Answers

There are many different uses of tensors in scientific computing, so this question is hard to answer without more details.

There is a related answer on SciComp that mentions Eigen, Armadillo, deal.II, libtensor and libdynd.

If you are interested in contracting large tensors in parallel, look at the Cyclops Tensor Framework (CTF), which is the back-end for multiple quantum chemistry codes. If you want to do a large number of small contractions, CTF may not help you.

Other open-source tensor libraries include libtensor and TiledArray, which are also used in quantum chemistry.

The MADNESS project has a tensor class that might meet your needs if small dimensions are of interest.

itensor is another tensor library, which aims to support DMRG computations.

FTensor is a C++ tensor library oriented at general relativity.

Because tensors operations are important to machine learning, companies like Facebook and Google have released tensor libraries such as THPP and TensorFlow, respectively.

There is a very old project called POOMA that might support small tensors to meet your needs, but this project is no longer active and you should expect no support whatsoever.

When all else fails, see Wikipedia or Google (about half of the information here was identified by searching for "tensor library" on Google, although I have historical familiarity with most of it).

like image 89
Jeff Hammond Avatar answered Sep 28 '22 02:09

Jeff Hammond