A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
Data Types | Modules | Functions/Subroutines | Variables
tensor.f90 File Reference

Go to the source code of this file.

Data Types

type  tensor::coolist_elem
 Coordinate list element type. Elementary elements of the sparse tensors. More...
 
type  tensor::coolist_elem4
 4d coordinate list element type. Elementary elements of the 4d sparse tensors. More...
 
type  tensor::coolist
 Coordinate list. Type used to represent the sparse tensor. More...
 
type  tensor::coolist4
 4d coordinate list. Type used to represent the rank-4 sparse tensor. More...
 

Modules

module  tensor
 Tensor utility module.
 

Functions/Subroutines

subroutine, public tensor::copy_coo (src, dst)
 Routine to copy a coolist. More...
 
subroutine, public tensor::mat_to_coo (src, dst)
 Routine to convert a matrix to a tensor. More...
 
subroutine, public tensor::sparse_mul3 (coolist_ijk, arr_j, arr_k, res)
 Sparse multiplication of a tensor with two vectors: \({\displaystyle \sum_{j,k=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \,b_k\). More...
 
subroutine, public tensor::jsparse_mul (coolist_ijk, arr_j, jcoo_ij)
 Sparse multiplication of two tensors to determine the Jacobian:

\[J_{i,j} = {\displaystyle \sum_{k=0}^{ndim}} \left( \mathcal{T}_{i,j,k} + \mathcal{T}_{i,k,j} \right) \, a_k.\]

It's implemented slightly differently: for every \(\mathcal{T}_{i,j,k}\), we add to \(J_{i,j}\) as follows:

\[J_{i,j} = J_{i,j} + \mathcal{T}_{i,j,k} \, a_k \\ J_{i,k} = J_{i,k} + \mathcal{T}_{i,j,k} \, a_j\]

This version return a coolist (sparse tensor). More...

 
subroutine, public tensor::jsparse_mul_mat (coolist_ijk, arr_j, jcoo_ij)
 Sparse multiplication of two tensors to determine the Jacobian:

\[J_{i,j} = {\displaystyle \sum_{k=0}^{ndim}} \left( \mathcal{T}_{i,j,k} + \mathcal{T}_{i,k,j} \right) \, a_k.\]

It's implemented slightly differently: for every \(\mathcal{T}_{i,j,k}\), we add to \(J_{i,j}\) as follows:

\[J_{i,j} = J_{i,j} + \mathcal{T}_{i,j,k} \, a_k \\ J_{i,k} = J_{i,k} + \mathcal{T}_{i,j,k} \, a_j\]

This version return a matrix. More...

 
subroutine, public tensor::sparse_mul2 (coolist_ij, arr_j, res)
 Sparse multiplication of a 2d sparse tensor with a vector: \({\displaystyle \sum_{j=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \). More...
 
subroutine, public tensor::simplify (tensor)
 Routine to simplify a coolist (sparse tensor). For each index \(i\), it upper triangularize the matrix

\[\mathcal{T}_{i,j,k} \qquad 0 \leq j,k \leq ndim.\]

. More...

 
subroutine, public tensor::add_elem (t, i, j, k, v)
 Subroutine to add element to a coolist. More...
 
subroutine, public tensor::add_check (t, i, j, k, v, dst)
 Subroutine to add element to a coolist and check for overflow. Once the t buffer tensor is full, add it to the destination buffer. More...
 
subroutine, public tensor::add_to_tensor (src, dst)
 Routine to add a rank-3 tensor to another one. More...
 
subroutine, public tensor::print_tensor (t, s)
 Routine to print a rank 3 tensor coolist. More...
 
subroutine, public tensor::write_tensor_to_file (s, t)
 Load a rank-4 tensor coolist from a file definition. More...
 
subroutine, public tensor::load_tensor_from_file (s, t)
 Load a rank-4 tensor coolist from a file definition. More...
 
subroutine, public tensor::add_matc_to_tensor (i, src, dst)
 Routine to add a matrix to a rank-3 tensor. More...
 
subroutine, public tensor::add_matc_to_tensor4 (i, j, src, dst)
 Routine to add a matrix to a rank-4 tensor. More...
 
subroutine, public tensor::add_vec_jk_to_tensor (j, k, src, dst)
 Routine to add a vector to a rank-3 tensor. More...
 
subroutine, public tensor::add_vec_ikl_to_tensor4_perm (i, k, l, src, dst)
 Routine to add a vector to a rank-4 tensor plus permutation. More...
 
subroutine, public tensor::add_vec_ikl_to_tensor4 (i, k, l, src, dst)
 Routine to add a vector to a rank-4 tensor. More...
 
subroutine, public tensor::add_vec_ijk_to_tensor4 (i, j, k, src, dst)
 Routine to add a vector to a rank-4 tensor. More...
 
subroutine, public tensor::tensor_to_coo (src, dst)
 Routine to convert a rank-3 tensor from matrix to coolist representation. More...
 
subroutine, public tensor::tensor4_to_coo4 (src, dst)
 Routine to convert a rank-4 tensor from matrix to coolist representation. More...
 
subroutine, public tensor::print_tensor4 (t)
 Routine to print a rank-4 tensor coolist. More...
 
subroutine, public tensor::sparse_mul3_mat (coolist_ijk, arr_k, res)
 Sparse multiplication of a rank-3 tensor coolist with a vector: \({\displaystyle \sum_{k=0}^{ndim}} \mathcal{T}_{i,j,k} \, b_k\). Its output is a matrix. More...
 
subroutine, public tensor::sparse_mul4 (coolist_ijkl, arr_j, arr_k, arr_l, res)
 Sparse multiplication of a rank-4 tensor coolist with three vectors: \({\displaystyle \sum_{j,k,l=0}^{ndim}} \mathcal{T}_{i,j,k,l} \, a_j \,b_k \, c_l \). More...
 
subroutine, public tensor::sparse_mul4_mat (coolist_ijkl, arr_k, arr_l, res)
 Sparse multiplication of a tensor with two vectors: \({\displaystyle \sum_{k,l=0}^{ndim}} \mathcal{T}_{i,j,k,l} \,b_k \, c_l \). More...
 
subroutine, public tensor::sparse_mul2_j (coolist_ijk, arr_j, res)
 Sparse multiplication of a 3d sparse tensor with a vectors: \({\displaystyle \sum_{j=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \). More...
 
subroutine, public tensor::sparse_mul2_k (coolist_ijk, arr_k, res)
 Sparse multiplication of a rank-3 sparse tensor coolist with a vector: \({\displaystyle \sum_{k=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_k \). More...
 
subroutine, public tensor::coo_to_mat_ik (src, dst)
 Routine to convert a rank-3 tensor coolist component into a matrix with i and k indices. More...
 
subroutine, public tensor::coo_to_mat_ij (src, dst)
 Routine to convert a rank-3 tensor coolist component into a matrix with i and j indices. More...
 
subroutine, public tensor::coo_to_mat_i (i, src, dst)
 Routine to convert a rank-3 tensor coolist component into a matrix. More...
 
subroutine, public tensor::coo_to_vec_jk (j, k, src, dst)
 Routine to convert a rank-3 tensor coolist component into a vector. More...
 
subroutine, public tensor::coo_to_mat_j (j, src, dst)
 Routine to convert a rank-3 tensor coolist component into a matrix. More...
 
subroutine, public tensor::sparse_mul4_with_mat_jl (coolist_ijkl, mat_jl, res)
 Sparse multiplication of a rank-4 tensor coolist with a matrix : \({\displaystyle \sum_{j,l=0}^{ndim}} \mathcal{T}_{i,j,k,l} \, m_{j,l} \). More...
 
subroutine, public tensor::sparse_mul4_with_mat_kl (coolist_ijkl, mat_kl, res)
 Sparse multiplication of a rank-4 tensor coolist with a matrix : \({\displaystyle \sum_{j,l=0}^{ndim}} \mathcal{T}_{i,j,k,l} \, m_{k,l} \). More...
 
subroutine, public tensor::sparse_mul3_with_mat (coolist_ijk, mat_jk, res)
 Sparse multiplication of a rank-3 tensor coolist with a matrix: \({\displaystyle \sum_{j,k=0}^{ndim}} \mathcal{T}_{i,j,k} \, m_{j,k}\). More...
 
subroutine, public tensor::matc_to_coo (src, dst)
 Routine to convert a matrix to a rank-3 tensor. More...
 
subroutine, public tensor::scal_mul_coo (s, t)
 Routine to multiply a rank-3 tensor by a scalar. More...
 
logical function, public tensor::tensor_empty (t)
 Test if a rank-3 tensor coolist is empty. More...
 
logical function, public tensor::tensor4_empty (t)
 Test if a rank-4 tensor coolist is empty. More...
 
subroutine, public tensor::load_tensor4_from_file (s, t)
 Load a rank-4 tensor coolist from a file definition. More...
 
subroutine, public tensor::write_tensor4_to_file (s, t)
 Load a rank-4 tensor coolist from a file definition. More...
 

Variables

real(kind=8), parameter tensor::real_eps = 2.2204460492503131e-16
 Parameter to test the equality with zero. More...