# Residency

> USearch for Wolfram

Where the payload lives is the constructor's name, as in the C lifecycle verbs, so a residency an index lacks has no constructor to call.

```wolfram
DenseInitRam["inner", "bf16", 768, "MemoryDomains"->{0, 1}, "Connectivity"->0, "ValuesPerKey"->0]
DenseInitVram["inner", "bf16", 768, "Devices"->{0, 1, 2, 3}]
DenseLoadRam["index.safegraphs", "Executor"->executor, "MemoryDomains"->{}, "ValuesPerKey"->0]
DenseLoadVram["index.safegraphs", "Executor"->gpu, "Devices"->{0}]
DenseViewRam["index.safegraphs"]                                   (* read-only, served from the mapping *)
DenseViewNvme["index.safegraphs", "Executor"->drives, "Paths"->{"/dev/nvme0n1"}]
```

`DenseInitRam[dimensions]` makes an `angular` `bf16` index.
A viewed index is read-only, and every mutating verb on it fails as `read-only`.
Until NVMe checkpoints carry keys, `DenseViewNvme` fails as `unsupported`.

`Needs["USearch`"]`

## DenseInitRam

`DenseInitRam[metric, quantization, dimensions]` creates an empty, mutable index in host memory, scoring by metric, "angular" by default, and storing quantization scalars, "bf16" by default.

```mathematica
DenseInitRam[metric, quantization, dimensions, OptionsPattern[]]
```

"Connectivity" bounds the connections per node, 0 deriving it; "ValuesPerKey" bounds the entries sharing one key, 0 leaving it unbounded; and "MemoryDomains" lists the NUMA nodes to place shards on, {} deriving every node the process may allocate on.

- `"Connectivity"`: Default: `0`
- `"ValuesPerKey"`: Default: `0`
- `"MemoryDomains"`: Default: `{}`

## DenseInitVram

`DenseInitVram[metric, quantization, dimensions]` creates an empty, mutable index in device memory, scoring by metric, "angular" by default, and storing quantization scalars, "bf16" by default.

```mathematica
DenseInitVram[metric, quantization, dimensions, OptionsPattern[]]
```

"Connectivity" bounds the connections per node, 0 deriving it; "ValuesPerKey" bounds the entries sharing one key, 0 leaving it unbounded; and "Devices" lists the device ordinals to place shards on, {} picking device zero.

- `"Connectivity"`: Default: `0`
- `"ValuesPerKey"`: Default: `0`
- `"Devices"`: Default: `{}`

## DenseReserve

`DenseReserve[receiver, capacity]` grows the index ahead of incoming vectors to capacity entries in total, the current ones included.

```mathematica
DenseReserve[receiver, capacity]
```

## DenseClear

`DenseClear[receiver]` erases every entry, keeping the reserved capacity and the frozen geometry.

```mathematica
DenseClear[receiver]
```

