<!--
{
  "availability" : [
    "iOS: 18.5.0 -",
    "iPadOS: 18.5.0 -",
    "macCatalyst: 18.5.0 -",
    "macOS: 15.5.0 -",
    "tvOS: 18.5.0 -",
    "visionOS: 2.5.0 -",
    "watchOS: 11.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/SparseRefactor(_:_:_:_:)-20xqc",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@SparseRefactor#$@SA@SparseMatrix_Complex_Double#*$@SA@SparseOpaqueFactorization_Complex_Double#$@SA@SparseNumericFactorOptions#*v#"
  },
  "title" : "SparseRefactor(_:_:_:_:)"
}
-->

# SparseRefactor(_:_:_:_:)

Reuses supplied factorization object’s storage to compute a new
factorization of the supplied matrix of complex double values, using updated options and
without any internal allocations.

```
func SparseRefactor(_ Matrix: SparseMatrix_Complex_Double, _ Factored: UnsafeMutablePointer<SparseOpaqueFactorization_Complex_Double>, _ nfoptions: SparseNumericFactorOptions, _ workspace: UnsafeMutableRawPointer)
```

## Parameters

`Matrix`

The matrix to be factorized.

`nfoptions`

Numeric factor options, for example pivoting parameters.

`workspace`

A pointer to a workspace of size at least
`Factorization->symbolicFactorization.workspaceSize_Double * 2` bytes.
This memory must be 16-byte aligned (any allocation returned
by `malloc` has this property).
This workspace may be reused or destroyed by the user as soon as the
function returns.

## Discussion

`Matrix` must have the same non-zero structure as that used for
the original factorization.

This call provides very similar behavior to that which can be achieved by
reusing explicit storage supplied to `SparseFactor` as the argument
`factorStorage`. However, in addition to providing a simplified call sequence,
this call can also reuse any additional storage allocated to accomodate
delayed pivots.

Note that internal memory allocations may occur in the case of
pivoted factorizations that result in delayed pivots. If you require closer
control over memory allocations, supply an `sfoptions.malloc` function that
implements the required behaviour, or use an alternative non-pivoted
factorization returns. Note that if `sfoptions.malloc` returns NULL the
factorization will abort immediately.

Note that if the reference count of the underlying object is not
exactly one (i.e. if there are any implict copies as a result of calls to
`SparseGetTranspose` or `SparseCreateSubfactor()` that have not been destroyed
through a call to `SparseCleanup`), then new storage will be allocated
regardless.

---

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)