SyTen

◆ addScaled() [2/2]

template<Rank rank, typename Scalar >
void syten::GenericDenseTensorImpl::addScaled ( GenericDenseTensor< rank, Scalar > &  a,
GenericDenseTensor< rank, Scalar > const &  b,
typename IdentityType< Scalar >::type const  factor,
EliminateZeros const  ezeros 
)
inline

\( a_i = a_i + f b_i \) for generic dense tensors.

Will fail at runtime if inappropriate dense tensors are supplied.

Parameters
athe dense tensor to be updated during the call
bthe second dense tensor, to be scaled by the factor and added to a
factorthe scaling factor for the second dense tensor
ezerosif EliminateZeros::Yes, will set small resulting elements to zero
Remarks
If A is a CUDA tensor, smaller than the threshold size and B is not a CUDA tensor, A is turned into a standard tensor and the default functions are used. If A is a CUDA tensor and either larger than the threshold size or B is also a CUDA tensor, then A is kept as a CUDA tensor and the default functions are used.
If A is not a CUDA tensor but B is a CUDA tensor and smaller than the threshold size, then A and B are made standard tensors and the standard function is used. If A is not a CUDA tensor but B is a CUDA tensor and larger than the threshold size, A is made a CUDA tensor and the CUDA functions are used.
Otherwise, A is made a standard tensor and the default functions are used.

References addScaled(), syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::cuda(), syten::EnvVars::cuda_size_to_gpu, syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::is_cuda(), syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::make_cuda(), syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::make_standard(), syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::size(), and syten::GenericDenseTensorImpl::GenericDenseTensor< rank, Scalar >::standard().

+ Here is the call graph for this function: