<!--
{
  "availability" : [
    "iOS: 8.0.0 - 14.0.0",
    "iPadOS: 8.0.0 - 14.0.0",
    "macCatalyst: 13.1.0 - 14.0.0",
    "macOS: 10.10.0 - 11.0.0",
    "tvOS: 8.0.0 - 14.0.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 1.0.0 - 7.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/la_difference(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@la_difference"
  },
  "title" : "la_difference(_:_:)"
}
-->

# la_difference(_:_:)

```
func la_difference(_ obj_left: la_object_t, _ obj_right: la_object_t) -> la_object_t
```

## Discussion\abstract Compute the element-wise difference of two vectors or matrices.
\discussion If either source operand is not a vector or matrix or splat, or if both
operands are splats, the result has status LA_INVALID_PARAMETER_ERROR.

The two operands must have the same dimensions.  If they do not, the result
will have status LA_DIMENSION_MISMATCH_ERROR.  For simplicity, a vector
of length n, a 1xn matrix, and an nx1 matrix are all treated as having the
same dimensions.  If 1xn and nx1 or nx1 and 1xn vectors are passed, an nx1
vector will be created, otherwise orientation matches input.

The result has the same dimensions as the operands, and each element in
the result is given by subtracting the corresponding element of obj_right
from the corresponding element of obj_left.

---

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)