---
title: "vSgemm(_:_:_:_:_:_:_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vsgemm(_:_:_:_:_:_:_:_:_:_:_:)"
---

# vSgemm(_:_:_:_:_:_:_:_:_:_:_:)

Multiples two general matrices or their transposes, then scales and adds a third.

## Declaration

```swift
func vSgemm(_ l: Int32, _ m: Int32, _ n: Int32, _ a: UnsafePointer<vFloat>, _ forma: CChar, _ b: UnsafePointer<vFloat>, _ formb: CChar, _ c: UnsafeMutablePointer<vFloat>, _ alpha: Float, _ beta: Float, _ matrix: UnsafeMutablePointer<vFloat>)
```

## Parameters

- `l`: Number of rows in matrix c; must be a multiple of 4.
- `m`: If forma = ‘N’, m is the number of columns in matrix a ; if forma = ‘T’, m is the number of rows in matrix a. Also, if formb = ‘N’, m is the number of rows in matrix b; if formb = ‘T’, m is the number of columns in matrix b. m must be a multiple of 4.
- `n`: Number of columns in matrix c; must be a multiple of 4.
- `a`: A matrix with elements of type float. If forma = ‘N’, the matrix itself is used in the calculation and it has l rows and m columns. If forma = ‘T’, the transpose is used and a has m rows and l columns. Thus the matrix used in the calculation is l by n.
- `forma`: Selector with a value of ‘N’ or ‘T’.
- `b`: A matrix with elements of type float. If formb = ‘N’, the matrix itself is used in the calculation and it has m rows and n columns. If formb = ‘T’, the transpose is used and b has n rows and m columns. Thus the matrix used in the calculation is m by n.
- `formb`: Selector with a value of ‘N’ or ‘T’.
- `c`: An l by n matrix with elements of type float.
- `alpha`: Multiplier for matrix a.
- `beta`: Multiplier for matrix c.
- `matrix`: Destination matrix with l rows and n columns.

## Discussion

Discussion Matrix a (or its transpose) is multiplied by matrix b (or its transpose); matrix c is multiplied by beta, and the result is added to the result of the matrix multiplication; the result is stored in matrix matrix

## See Also

### Matrix Operations (from vectorOps.h)

- [vSgeadd(_:_:_:_:_:_:_:)](accelerate/vsgeadd(_:_:_:_:_:_:_:).md)
- [vSgesub(_:_:_:_:_:_:_:)](accelerate/vsgesub(_:_:_:_:_:_:_:).md)
- [vSgemul(_:_:_:_:_:_:_:_:)](accelerate/vsgemul(_:_:_:_:_:_:_:_:).md)
- [vSgetmi(_:_:)](accelerate/vsgetmi(_:_:).md)
- [vSgetmo(_:_:_:_:)](accelerate/vsgetmo(_:_:_:_:).md)
- [vSgevv(_:_:_:_:_:)](accelerate/vsgevv(_:_:_:_:_:).md)
