demo-variants API documentation
Project documentation Docs

File: include/demo/scale.hpp

1// --------------------------------------------------------------------------------------------------2// SPDX-License-Identifier: Apache-2.03// SPDX-FileCopyrightText: 2026 cpdocs developers4// --------------------------------------------------------------------------------------------------5#pragma once6 7#include <cstddef>8 9/// Scaling of vectors, on the host or on a GPU, optionally distributed with MPI.10namespace demo {11 12/// Multiply every element of a vector by a factor.13///14/// @param values  the elements, scaled in place15/// @param count   the number of elements16/// @param factor  the factor17void scale(double* values, std::size_t count, double factor);18 19#if DEMO_HAVE_MPI20/// Multiply every element of a vector distributed over the ranks of an MPI communicator.21///22/// @param values        the local elements, scaled in place23/// @param count         the number of local elements24/// @param factor        the factor25/// @param communicator  the MPI communicator, as a Fortran handle26void scale(double* values, std::size_t count, double factor, int communicator);27#endif28 29} // namespace demo