Function

sparse_insert_entry_double

Inserts a single scalar entry into a double-precision sparse matrix.

Declaration

sparse_status sparse_insert_entry_double(sparse_matrix_double A, double val, sparse_index i, sparse_index j);

Parameters

A

The sparse matrix, A, which must have been created with sparse_matrix_create_double. SPARSE_ILLEGAL_PARAMETER is returned if not met.

val

The scalar value to insert into the sparse matrix.

i

The row location to insert the value. Indices are 0 based (first element of pointer is ptr[0]). Indices expected to be in the bounds of matrix dimensions, undefined behavior if not met.

j

The column location to insert the value. Indices are 0 based (first element of pointer is ptr[0]). Indices expected to be in the bounds of matrix dimensions, undefined behavior if not met.

Return Value

On successful insertion, A has been updated with the value and SPARSE_SUCCESS is returned. If A creation requirements are not met, SPARSE_ILLEGAL_PARAMETER is returned and A is unchanged.

Discussion

Use to build a sparse matrix by inserting one scalar entry at a time. This function is the equivalent of A[i,j] = val.

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.

See Also

Matrix Creation and Population

sparse_matrix_create_double

Returns a double-precision sparse matrix object.

sparse_matrix_create_float

Returns a single-precision sparse matrix object.

sparse_insert_entry_float

Inserts a single scalar entry into a single-precision sparse matrix.

sparse_insert_entries_double

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

sparse_insert_entries_float

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

sparse_insert_col_double

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

sparse_insert_col_float

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

sparse_insert_row_double

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

sparse_insert_row_float

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