| ceed-tensor.c (49aac155e7a09736f56fb3abac0f57dab29f7cbf) | ceed-tensor.c (c4e3f59b2ea5a0c95cc0118aa5026c447cce3092) |
|---|---|
| 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 69 unchanged lines hidden (view full) --- 78**/ 79int CeedTensorContractApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt J, const CeedScalar *restrict t, 80 CeedTransposeMode t_mode, const CeedInt add, const CeedScalar *restrict u, CeedScalar *restrict v) { 81 CeedCall(contract->Apply(contract, A, B, C, J, t, t_mode, add, u, v)); 82 return CEED_ERROR_SUCCESS; 83} 84 85/** | 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 69 unchanged lines hidden (view full) --- 78**/ 79int CeedTensorContractApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt J, const CeedScalar *restrict t, 80 CeedTransposeMode t_mode, const CeedInt add, const CeedScalar *restrict u, CeedScalar *restrict v) { 81 CeedCall(contract->Apply(contract, A, B, C, J, t, t_mode, add, u, v)); 82 return CEED_ERROR_SUCCESS; 83} 84 85/** |
| 86 @brief Apply tensor contraction 87 88 Contracts on the middle index 89 NOTRANSPOSE: v_dajc = t_djb u_abc 90 TRANSPOSE: v_ajc = t_dbj u_dabc 91 If add != 0, "=" is replaced by "+=" 92 93 @param[in] contract CeedTensorContract to use 94 @param[in] A First index of u, second index of v 95 @param[in] B Middle index of u, one of last two indices of t 96 @param[in] C Last index of u, v 97 @param[in] D First index of v, first index of t 98 @param[in] J Third index of v, one of last two indices of t 99 @param[in] t Tensor array to contract against 100 @param[in] t_mode Transpose mode for t, \ref CEED_NOTRANSPOSE for t_jb \ref CEED_TRANSPOSE for t_bj 101 @param[in] add Add mode 102 @param[in] u Input array 103 @param[out] v Output array 104 105 @return An error code: 0 - success, otherwise - failure 106 107 @ref Backend 108**/ 109int CeedTensorContractStridedApply(CeedTensorContract contract, CeedInt A, CeedInt B, CeedInt C, CeedInt D, CeedInt J, const CeedScalar *restrict t, 110 CeedTransposeMode t_mode, const CeedInt add, const CeedScalar *restrict u, CeedScalar *restrict v) { 111 if (t_mode == CEED_TRANSPOSE) { 112 for (CeedInt d = 0; d < D; d++) { 113 CeedCall(contract->Apply(contract, A, J, C, B, t + d * B * J, t_mode, add, u + d * A * J * C, v)); 114 } 115 } else { 116 for (CeedInt d = 0; d < D; d++) { 117 CeedCall(contract->Apply(contract, A, B, C, J, t + d * B * J, t_mode, add, u, v + d * A * J * C)); 118 } 119 } 120 return CEED_ERROR_SUCCESS; 121} 122 123/** |
|
| 86 @brief Get Ceed associated with a CeedTensorContract 87 88 @param[in] contract CeedTensorContract 89 @param[out] ceed Variable to store Ceed 90 91 @return An error code: 0 - success, otherwise - failure 92 93 @ref Backend --- 73 unchanged lines hidden --- | 124 @brief Get Ceed associated with a CeedTensorContract 125 126 @param[in] contract CeedTensorContract 127 @param[out] ceed Variable to store Ceed 128 129 @return An error code: 0 - success, otherwise - failure 130 131 @ref Backend --- 73 unchanged lines hidden --- |