![]() |
A Modular Arbitrary-Order Ocean-Atmosphere Model -- Stochastic implementation
|
Tensor utility module. More...
Data Types | |
type | coolist |
Coordinate list. Type used to represent the sparse tensor. More... | |
type | coolist4 |
4d coordinate list. Type used to represent the rank-4 sparse tensor. More... | |
type | coolist_elem |
Coordinate list element type. Elementary elements of the sparse tensors. More... | |
type | coolist_elem4 |
4d coordinate list element type. Elementary elements of the 4d sparse tensors. More... | |
Functions/Subroutines | |
subroutine, public | copy_coo (src, dst) |
Routine to copy a coolist. More... | |
subroutine, public | mat_to_coo (src, dst) |
Routine to convert a matrix to a tensor. More... | |
subroutine, public | 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 | 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 | 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 | 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 | 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 | add_elem (t, i, j, k, v) |
Subroutine to add element to a coolist. More... | |
subroutine, public | 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 | add_to_tensor (src, dst) |
Routine to add a rank-3 tensor to another one. More... | |
subroutine, public | print_tensor (t, s) |
Routine to print a rank 3 tensor coolist. More... | |
subroutine, public | write_tensor_to_file (s, t) |
Load a rank-4 tensor coolist from a file definition. More... | |
subroutine, public | load_tensor_from_file (s, t) |
Load a rank-4 tensor coolist from a file definition. More... | |
subroutine, public | add_matc_to_tensor (i, src, dst) |
Routine to add a matrix to a rank-3 tensor. More... | |
subroutine, public | add_matc_to_tensor4 (i, j, src, dst) |
Routine to add a matrix to a rank-4 tensor. More... | |
subroutine, public | add_vec_jk_to_tensor (j, k, src, dst) |
Routine to add a vector to a rank-3 tensor. More... | |
subroutine, public | 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 | add_vec_ikl_to_tensor4 (i, k, l, src, dst) |
Routine to add a vector to a rank-4 tensor. More... | |
subroutine, public | add_vec_ijk_to_tensor4 (i, j, k, src, dst) |
Routine to add a vector to a rank-4 tensor. More... | |
subroutine, public | tensor_to_coo (src, dst) |
Routine to convert a rank-3 tensor from matrix to coolist representation. More... | |
subroutine, public | tensor4_to_coo4 (src, dst) |
Routine to convert a rank-4 tensor from matrix to coolist representation. More... | |
subroutine, public | print_tensor4 (t) |
Routine to print a rank-4 tensor coolist. More... | |
subroutine, public | 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 | 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 | 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 | 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 | 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 | 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 | 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 | coo_to_mat_i (i, src, dst) |
Routine to convert a rank-3 tensor coolist component into a matrix. More... | |
subroutine, public | coo_to_vec_jk (j, k, src, dst) |
Routine to convert a rank-3 tensor coolist component into a vector. More... | |
subroutine, public | coo_to_mat_j (j, src, dst) |
Routine to convert a rank-3 tensor coolist component into a matrix. More... | |
subroutine, public | 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 | 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 | 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 | matc_to_coo (src, dst) |
Routine to convert a matrix to a rank-3 tensor. More... | |
subroutine, public | scal_mul_coo (s, t) |
Routine to multiply a rank-3 tensor by a scalar. More... | |
logical function, public | tensor_empty (t) |
Test if a rank-3 tensor coolist is empty. More... | |
logical function, public | tensor4_empty (t) |
Test if a rank-4 tensor coolist is empty. More... | |
subroutine, public | load_tensor4_from_file (s, t) |
Load a rank-4 tensor coolist from a file definition. More... | |
subroutine, public | write_tensor4_to_file (s, t) |
Load a rank-4 tensor coolist from a file definition. More... | |
Variables | |
real(kind=8), parameter | real_eps = 2.2204460492503131e-16 |
Parameter to test the equality with zero. More... | |
Tensor utility module.
subroutine, public tensor::add_check | ( | type(coolist), dimension(ndim), intent(inout) | t, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer, intent(in) | k, | ||
real(kind=8), intent(in) | v, | ||
type(coolist), dimension(ndim), intent(inout) | 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.
t | temporary buffer tensor for the destination tensor |
i | tensor \(i\) index |
j | tensor \(j\) index |
k | tensor \(k\) index |
v | value to add |
dst | destination tensor |
Definition at line 332 of file tensor.f90.
subroutine, public tensor::add_elem | ( | type(coolist), dimension(ndim), intent(inout) | t, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer, intent(in) | k, | ||
real(kind=8), intent(in) | v | ||
) |
Subroutine to add element to a coolist.
t | destination tensor |
i | tensor \(i\) index |
j | tensor \(j\) index |
k | tensor \(k\) index |
v | value to add |
Definition at line 310 of file tensor.f90.
subroutine, public tensor::add_matc_to_tensor | ( | integer, intent(in) | i, |
real(kind=8), dimension(ndim,ndim), intent(in) | src, | ||
type(coolist), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a matrix to a rank-3 tensor.
i | Add to tensor component i |
src | Matrix to add |
dst | Destination tensor |
Definition at line 474 of file tensor.f90.
subroutine, public tensor::add_matc_to_tensor4 | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
real(kind=8), dimension(ndim,ndim), intent(in) | src, | ||
type(coolist4), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a matrix to a rank-4 tensor.
i | Add to tensor component i,j |
j | Add to tensor component i,j |
src | Matrix to add |
dst | Destination tensor |
Definition at line 537 of file tensor.f90.
subroutine, public tensor::add_to_tensor | ( | type(coolist), dimension(ndim), intent(in) | src, |
type(coolist), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a rank-3 tensor to another one.
src | Tensor to add |
dst | Destination tensor |
Definition at line 350 of file tensor.f90.
subroutine, public tensor::add_vec_ijk_to_tensor4 | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | k, | ||
real(kind=8), dimension(ndim), intent(in) | src, | ||
type(coolist4), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a vector to a rank-4 tensor.
i,j,k | Add to tensor component i,j and k |
src | Vector to add |
dst | Destination tensor |
Definition at line 785 of file tensor.f90.
subroutine, public tensor::add_vec_ikl_to_tensor4 | ( | integer, intent(in) | i, |
integer, intent(in) | k, | ||
integer, intent(in) | l, | ||
real(kind=8), dimension(ndim), intent(in) | src, | ||
type(coolist4), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a vector to a rank-4 tensor.
i,k,l | Add to tensor component i,k and l |
src | Vector to add |
dst | Destination tensor |
Definition at line 726 of file tensor.f90.
subroutine, public tensor::add_vec_ikl_to_tensor4_perm | ( | integer, intent(in) | i, |
integer, intent(in) | k, | ||
integer, intent(in) | l, | ||
real(kind=8), dimension(ndim), intent(in) | src, | ||
type(coolist4), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a vector to a rank-4 tensor plus permutation.
i,k,l | Add to tensor component i,k and l |
src | Vector to add |
dst | Destination tensor |
Definition at line 657 of file tensor.f90.
subroutine, public tensor::add_vec_jk_to_tensor | ( | integer, intent(in) | j, |
integer, intent(in) | k, | ||
real(kind=8), dimension(ndim), intent(in) | src, | ||
type(coolist), dimension(ndim), intent(inout) | dst | ||
) |
Routine to add a vector to a rank-3 tensor.
j,k | Add to tensor component j and k |
src | Vector to add |
dst | Destination tensor |
Definition at line 602 of file tensor.f90.
subroutine, public tensor::coo_to_mat_i | ( | integer, intent(in) | i, |
type(coolist), dimension(ndim), intent(in) | src, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor coolist component into a matrix.
i | Component to convert |
src | Source tensor |
dst | Destination matrix |
Definition at line 1112 of file tensor.f90.
subroutine, public tensor::coo_to_mat_ij | ( | type(coolist), dimension(ndim), intent(in) | src, |
real(kind=8), dimension(ndim,ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor coolist component into a matrix with i and j indices.
src | Source tensor |
dst | Destination matrix |
Definition at line 1079 of file tensor.f90.
subroutine, public tensor::coo_to_mat_ik | ( | type(coolist), dimension(ndim), intent(in) | src, |
real(kind=8), dimension(ndim,ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor coolist component into a matrix with i and k indices.
src | Source tensor |
dst | Destination matrix |
Definition at line 1063 of file tensor.f90.
subroutine, public tensor::coo_to_mat_j | ( | integer, intent(in) | j, |
type(coolist), dimension(ndim), intent(in) | src, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor coolist component into a matrix.
j | Component to convert |
src | Source tensor |
dst | Destination matrix |
Definition at line 1148 of file tensor.f90.
subroutine, public tensor::coo_to_vec_jk | ( | integer, intent(in) | j, |
integer, intent(in) | k, | ||
type(coolist), dimension(ndim), intent(in) | src, | ||
real(kind=8), dimension(ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor coolist component into a vector.
j | Component j,k to convert |
k | Component j,k to convert |
src | Source tensor |
dst | Destination vector |
Definition at line 1129 of file tensor.f90.
subroutine, public tensor::copy_coo | ( | type(coolist), dimension(ndim), intent(in) | src, |
type(coolist), dimension(ndim), intent(out) | dst | ||
) |
Routine to copy a coolist.
src | Source coolist |
dst | Destination coolist |
Definition at line 72 of file tensor.f90.
subroutine, public tensor::jsparse_mul | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
type(coolist), dimension(ndim), intent(out) | 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).
coolist_ijk | a coordinate list (sparse tensor) of which index 2 or 3 will be contracted. |
arr_j | the vector to be contracted with index 2 and then index 3 of ffi_coo_ijk |
jcoo_ij | a coolist (sparse tensor) to store the result of the contraction |
Definition at line 153 of file tensor.f90.
subroutine, public tensor::jsparse_mul_mat | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | 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.
coolist_ijk | a coordinate list (sparse tensor) of which index 2 or 3 will be contracted. |
arr_j | the vector to be contracted with index 2 and then index 3 of ffi_coo_ijk |
jcoo_ij | a matrix to store the result of the contraction |
Definition at line 196 of file tensor.f90.
subroutine, public tensor::load_tensor4_from_file | ( | character (len=*), intent(in) | s, |
type(coolist4), dimension(ndim), intent(out) | t | ||
) |
Load a rank-4 tensor coolist from a file definition.
s | Filename of the tensor definition file |
t | The loaded coolist |
Definition at line 1322 of file tensor.f90.
subroutine, public tensor::load_tensor_from_file | ( | character (len=*), intent(in) | s, |
type(coolist), dimension(ndim), intent(out) | t | ||
) |
Load a rank-4 tensor coolist from a file definition.
s | Filename of the tensor definition file |
t | The loaded coolist |
Definition at line 445 of file tensor.f90.
subroutine, public tensor::mat_to_coo | ( | real(kind=8), dimension(0:ndim,0:ndim), intent(in) | src, |
type(coolist), dimension(ndim), intent(out) | dst | ||
) |
Routine to convert a matrix to a tensor.
src | Source matrix |
dst | Destination tensor |
Definition at line 94 of file tensor.f90.
subroutine, public tensor::matc_to_coo | ( | real(kind=8), dimension(ndim,ndim), intent(in) | src, |
type(coolist), dimension(ndim), intent(out) | dst | ||
) |
Routine to convert a matrix to a rank-3 tensor.
src | Source matrix |
dst | Destination tensor |
Definition at line 1244 of file tensor.f90.
subroutine, public tensor::print_tensor | ( | type(coolist), dimension(ndim), intent(in) | t, |
character, intent(in), optional | s | ||
) |
Routine to print a rank 3 tensor coolist.
t | coolist to print |
Definition at line 399 of file tensor.f90.
subroutine, public tensor::print_tensor4 | ( | type(coolist4), dimension(ndim), intent(in) | t | ) |
Routine to print a rank-4 tensor coolist.
t | coolist to print |
Definition at line 922 of file tensor.f90.
subroutine, public tensor::scal_mul_coo | ( | real(kind=8), intent(in) | s, |
type(coolist), dimension(ndim), intent(inout) | t | ||
) |
Routine to multiply a rank-3 tensor by a scalar.
s | The scalar |
t | The tensor |
Definition at line 1274 of file tensor.f90.
subroutine, public tensor::simplify | ( | type(coolist), dimension(ndim), intent(inout) | 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.\]
.
tensor | a coordinate list (sparse tensor) which will be simplified. |
Definition at line 238 of file tensor.f90.
subroutine, public tensor::sparse_mul2 | ( | type(coolist), dimension(ndim), intent(in) | coolist_ij, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
real(kind=8), dimension(0:ndim), intent(out) | res | ||
) |
Sparse multiplication of a 2d sparse tensor with a vector: \({\displaystyle \sum_{j=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \).
coolist_ij | a coordinate list (sparse tensor) of which index 2 will be contracted. |
arr_j | the vector to be contracted with index 2 of coolist_ijk |
res | vector (buffer) to store the result of the contraction |
arr_j
as a result buffer, as this operation does multiple passes. Definition at line 221 of file tensor.f90.
subroutine, public tensor::sparse_mul2_j | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
real(kind=8), dimension(0:ndim), intent(out) | res | ||
) |
Sparse multiplication of a 3d sparse tensor with a vectors: \({\displaystyle \sum_{j=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \).
coolist_ijk | a coordinate list (sparse tensor) of which index 2 will be contracted. |
arr_j | the vector to be contracted with index 2 of coolist_ijk |
res | vector (buffer) to store the result of the contraction |
arr_j
as a result buffer, as this operation does multiple passes. Definition at line 1024 of file tensor.f90.
subroutine, public tensor::sparse_mul2_k | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_k, | ||
real(kind=8), dimension(0:ndim), intent(out) | 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 \).
coolist_ijk | a coordinate list (sparse tensor) of which index k will be contracted. |
arr_k | the vector to be contracted with index k of coolist_ijk |
res | vector (buffer) to store the result of the contraction |
arr_k
as a result buffer, as this operation does multiple passes. Definition at line 1045 of file tensor.f90.
subroutine, public tensor::sparse_mul3 | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
real(kind=8), dimension(0:ndim), intent(in) | arr_k, | ||
real(kind=8), dimension(0:ndim), intent(out) | res | ||
) |
Sparse multiplication of a tensor with two vectors: \({\displaystyle \sum_{j,k=0}^{ndim}} \mathcal{T}_{i,j,k} \, a_j \,b_k\).
coolist_ijk | a coordinate list (sparse tensor) of which index 2 and 3 will be contracted. |
arr_j | the vector to be contracted with index 2 of coolist_ijk |
arr_k | the vector to be contracted with index 3 of coolist_ijk |
res | vector (buffer) to store the result of the contraction |
arr_j
/arr_k
as a result buffer, as this operation does multiple passes. Definition at line 129 of file tensor.f90.
subroutine, public tensor::sparse_mul3_mat | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(0:ndim), intent(in) | arr_k, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | 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.
coolist_ijk | a coolist (sparse tensor) of which index k will be contracted. |
arr_k | the vector to be contracted with index k of coolist_ijk |
res | matrix (buffer) to store the result of the contraction |
arr_k
as a result buffer, as this operation does multiple passes. Definition at line 948 of file tensor.f90.
subroutine, public tensor::sparse_mul3_with_mat | ( | type(coolist), dimension(ndim), intent(in) | coolist_ijk, |
real(kind=8), dimension(ndim,ndim), intent(in) | mat_jk, | ||
real(kind=8), dimension(0:ndim), intent(out) | 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}\).
coolist_ijk | a coolist (sparse tensor) of which index j and k will be contracted. |
mat_jk | the matrix to be contracted with index j and k of coolist_ijk |
res | vector (buffer) to store the result of the contraction |
mat_jk
as a result buffer, as this operation does multiple passes. Definition at line 1220 of file tensor.f90.
subroutine, public tensor::sparse_mul4 | ( | type(coolist4), dimension(ndim), intent(in) | coolist_ijkl, |
real(kind=8), dimension(0:ndim), intent(in) | arr_j, | ||
real(kind=8), dimension(0:ndim), intent(in) | arr_k, | ||
real(kind=8), dimension(0:ndim), intent(in) | arr_l, | ||
real(kind=8), dimension(0:ndim), intent(out) | 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 \).
coolist_ijkl | a coolist (sparse tensor) of which index j, k and l will be contracted. |
arr_j | the vector to be contracted with index j of coolist_ijkl |
arr_k | the vector to be contracted with index k of coolist_ijkl |
arr_l | the vector to be contracted with index l of coolist_ijkl |
res | vector (buffer) to store the result of the contraction |
arr_j
/arr_k
/arr_l
as a result buffer, as this operation does multiple passes. Definition at line 974 of file tensor.f90.
subroutine, public tensor::sparse_mul4_mat | ( | type(coolist4), dimension(ndim), intent(in) | coolist_ijkl, |
real(kind=8), dimension(0:ndim), intent(in) | arr_k, | ||
real(kind=8), dimension(0:ndim), intent(in) | arr_l, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | 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 \).
coolist_ijkl | a coordinate list (sparse tensor) of which index 3 and 4 will be contracted. |
arr_k | the vector to be contracted with index 3 of coolist_ijkl |
arr_l | the vector to be contracted with index 4 of coolist_ijkl |
res | matrix (buffer) to store the result of the contraction |
arr_k
/arr_l
as a result buffer, as this operation does multiple passes. Definition at line 998 of file tensor.f90.
subroutine, public tensor::sparse_mul4_with_mat_jl | ( | type(coolist4), dimension(ndim), intent(in) | coolist_ijkl, |
real(kind=8), dimension(ndim,ndim), intent(in) | mat_jl, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | 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} \).
coolist_ijkl | a coolist (sparse tensor) of which index j and l will be contracted. |
mat_jl | the matrix to be contracted with indices j and l of coolist_ijkl |
res | matrix (buffer) to store the result of the contraction |
mat_jl
as a result buffer, as this operation does multiple passes. Definition at line 1169 of file tensor.f90.
subroutine, public tensor::sparse_mul4_with_mat_kl | ( | type(coolist4), dimension(ndim), intent(in) | coolist_ijkl, |
real(kind=8), dimension(ndim,ndim), intent(in) | mat_kl, | ||
real(kind=8), dimension(ndim,ndim), intent(out) | 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} \).
coolist_ijkl | a coolist (sparse tensor) of which index k and l will be contracted. |
mat_kl | the matrix to be contracted with indices k and l of coolist_ijkl |
res | matrix (buffer) to store the result of the contraction |
mat_kl
as a result buffer, as this operation does multiple passes. Definition at line 1194 of file tensor.f90.
logical function, public tensor::tensor4_empty | ( | type(coolist4), dimension(ndim), intent(in) | t | ) |
Test if a rank-4 tensor coolist is empty.
t | rank-4 tensor coolist to be tested |
Definition at line 1304 of file tensor.f90.
subroutine, public tensor::tensor4_to_coo4 | ( | real(kind=8), dimension(ndim,0:ndim,0:ndim,0:ndim), intent(in) | src, |
type(coolist4), dimension(ndim), intent(out) | dst | ||
) |
Routine to convert a rank-4 tensor from matrix to coolist representation.
src | Source matrix |
dst | Destination coolist |
Definition at line 883 of file tensor.f90.
logical function, public tensor::tensor_empty | ( | type(coolist), dimension(ndim), intent(in) | t | ) |
Test if a rank-3 tensor coolist is empty.
t | rank-3 tensor coolist to be tested |
Definition at line 1288 of file tensor.f90.
subroutine, public tensor::tensor_to_coo | ( | real(kind=8), dimension(ndim,0:ndim,0:ndim), intent(in) | src, |
type(coolist), dimension(ndim), intent(out) | dst | ||
) |
Routine to convert a rank-3 tensor from matrix to coolist representation.
src | Source matrix |
dst | Destination coolist |
Definition at line 847 of file tensor.f90.
subroutine, public tensor::write_tensor4_to_file | ( | character (len=*), intent(in) | s, |
type(coolist4), dimension(ndim), intent(in) | t | ||
) |
Load a rank-4 tensor coolist from a file definition.
s | Destination filename |
t | The coolist to write |
Definition at line 1349 of file tensor.f90.
subroutine, public tensor::write_tensor_to_file | ( | character (len=*), intent(in) | s, |
type(coolist), dimension(ndim), intent(in) | t | ||
) |
Load a rank-4 tensor coolist from a file definition.
s | Destination filename |
t | The coolist to write |
Definition at line 425 of file tensor.f90.
real(kind=8), parameter tensor::real_eps = 2.2204460492503131e-16 |
Parameter to test the equality with zero.
Definition at line 50 of file tensor.f90.