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

# sparse_insert_col_float(_:_:_:_:_:)

Inserts a list of scalar entries into a single column of a single-precision sparse matrix.

```
func sparse_insert_col_float(_ A: sparse_matrix_float!, _ j: sparse_index, _ nz: sparse_dimension, _ val: UnsafePointer<Float>!, _ indx: UnsafePointer<sparse_index>!) -> sparse_status
```

## Parameters

`A`

The sparse matrix, *A*, which must have been created with [`sparse_matrix_create_float(_:_:)`](/documentation/Accelerate/sparse_matrix_create_float(_:_:)). [`SPARSE_ILLEGAL_PARAMETER`](/documentation/Accelerate/SPARSE_ILLEGAL_PARAMETER) is returned if not met.

`j`

The column for value insertion. Indices expected to be in the bounds of matrix dimensions, undefined behavior if not met.

`nz`

The number of values to insert into `A`.  Each of `indx` and `val` are of size `nz`.

`val`

Pointer to list of scalar values to insert into the sparse matrix.  The value is inserted into the location specified by the corresponding indices of `indx` and `j`.  Must hold `nz` values.

`indx`

An array of column indices that correspond to the values in val. Must hold `nz` values.

## Return Value

On successful insertion, `A` has been updated with the value and [`SPARSE_SUCCESS`](/documentation/Accelerate/SPARSE_SUCCESS) is returned.  If `A` creation requirements are not met, [`SPARSE_ILLEGAL_PARAMETER`](/documentation/Accelerate/SPARSE_ILLEGAL_PARAMETER) is returned and `A` is unchanged.

## Discussion

Use to build a sparse matrix by providing a list of point entries for a single column.  For each entry provided, update `A[indx[i],j] = val[i]`.  This will not replace the existing contents of the column, it appends new values and overwrites overlapping values.

Note that matrix properties cannot be modified after value insertion begins. This includes properties such as specifying a triangular matrix.

Insertion can be expensive, generally speaking it is best to do a batch update. Inserted values may be temporarily held internally within the object and only inserted into the sparse format when a later computation triggers a need to insert.

Indices in `indx` are always assumed to be stored in ascending order. Additionally, indices are assumed to be unique.  Finally, indices are assumed to be in the bounds of the matrix.  Undefined behavior if any of these assumptions are not met.All indices are 0 based (the first element of a pointer is `ptr[0]`).

> Important:
> Apple provides the BLAS and LAPACK libraries under the Accelerate framework to be in line with LAPACK 3.9.1. Starting with iOS 26, iPadOS 26, macOS 26, tvOS 26, visionOS 26, and watchOS 26, the libraries are in line with LAPACK 3.12.0. These new interfaces provide additional functionality, as well as a new ILP64 interface. To use the new interfaces, define `ACCELERATE_NEW_LAPACK` before including the Accelerate or vecLib headers. For ILP64 interfaces, also define `ACCELERATE_LAPACK_ILP64`. For Swift projects, specify `ACCELERATE_NEW_LAPACK=1` and `ACCELERATE_LAPACK_ILP64=1` as preprocessor macros in Xcode build settings under Apple Clang - Preprocessing > Preprocessor Macros.

---

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)