<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/multiply(_:_:)-993yp",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO8multiplyySaySfGSf_xtAA0A6BufferRzSf7ElementRtzlFZ"
  },
  "title" : "multiply(_:_:)"
}
-->

# multiply(_:_:)

Returns the single-precision element-wise product of a vector and a scalar value.

```
static func multiply<U>(_ scalar: Float, _ vector: U) -> [Float] where U : AccelerateBuffer, U.Element == Float
```

## Parameters

`scalar`

The input scalar value, `B`.

`vector`

The input vector, `A`.

## Return Value

The output vector, `C`.

## Discussion

This function calculates the element-wise product of vector `A` and scalar value `B`, and writes the result to vector `C`.

```swift
 for (n = 0; n < N; ++n)
    C[n] = A[n] * B;
```

![A diagram showing the operation of this function. There are three rows. The top row represents the input vector A with three boxes, and the scalar value B with one box. The middle row represents the operation as three boxes with multiplication signs. The bottom row represents the output vector C as three boxes. The diagram has connecting lines from the input vectors to the operation, and from the operation to the output vector.](images/com.apple.accelerate/media-4337183@2x.png)

The following code shows an example of using this function:

```swift
    let a: [Float] = [1, 2, 3, 4, 5]
    let b: Float = 10
    
    let c = vDSP.multiply(b, a)
    
    // Prints "[10.0, 20.0, 30.0, 40.0, 50.0]".
    print(c)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)