Blocks
gpex.blocks
Structured functional, observation-design, and data blocks.
Locations
Bases: Module
Non-empty real locations in JAX's default floating precision.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
Points
|
Floating array of shape |
required |
Source code in src/gpex/blocks/functionals.py
FunctionalBlock
FunctionalBlock(
locations: Locations | Points,
operator: LinearOperator,
name: str,
)
Bases: Module
Named linear outputs at a set of locations, without observed values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
locations
|
Locations | Points
|
Floating coordinates with shape |
required |
operator
|
LinearOperator
|
Linear operator. Its output shape determines each location's
outputs: |
required |
name
|
str
|
Nonempty block name used to access results. |
required |
Source code in src/gpex/blocks/functionals.py
append
append(locations: Locations) -> FunctionalBlock
Return this block extended by locations, retaining its operator and name.
The new locations must have the same input dimension. Supports JIT and differentiation; the original block is unchanged.
Source code in src/gpex/blocks/functionals.py
FunctionalQuery
FunctionalQuery(blocks: Sequence[FunctionalBlock])
Bases: Module
An ordered collection of named outputs to predict or sample.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[FunctionalBlock]
|
Nonempty sequence of |
required |
Source code in src/gpex/blocks/queries.py
ObservationDesignBlock
ObservationDesignBlock(
functional: FunctionalBlock,
variance: PositiveParameter | Scalar | float,
*,
max_size: int | None = None,
count: Count | int | None = None,
)
Bases: Module
A functional block with measurement noise, but no observed outcome.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
functional
|
FunctionalBlock
|
Named outputs to measure, including their locations and operator. |
required |
variance
|
PositiveParameter | Scalar | float
|
One finite, nonnegative scalar measurement-error variance,
shared by every location and output component. A scalar array or
float is fixed. A scalar |
required |
max_size
|
int | None
|
Reserved number of locations, at least the supplied number.
Defaults to |
None
|
count
|
Count | int | None
|
Active prefix length. Defaults to all supplied locations. May be traced, unlike capacity. Inactive locations repeat the first supplied point, which must be valid for the operator and kernel even when the active count is zero. |
None
|
Source code in src/gpex/blocks/designs.py
functional
instance-attribute
functional: FunctionalBlock = eqx.tree_at(
lambda f: f.locations.points, functional, points
)
active_size
property
Number of active scalar observations, including operator components.
variances
property
The shared variance repeated over the functional output shape.
append
append(locations: Locations) -> ObservationDesignBlock
Fill unused locations, retaining operator, name, variance and capacity.
Locations have shape (m, d) with the existing input dimension d.
The returned design supports JIT and differentiation.
Source code in src/gpex/blocks/designs.py
replace
replace(points: Points) -> ObservationDesignBlock
Replace all active locations, preserving capacity and shared variance.
Empty contents retain the previous valid padding point. Supports JIT and differentiation. Different input shapes specialize this operation, but its result always has the original reserved shapes.
Source code in src/gpex/blocks/designs.py
ObservationDesign
ObservationDesign(blocks: Sequence[ObservationDesignBlock])
Bases: Module
An ordered measurement design without observed outcomes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[ObservationDesignBlock]
|
Nonempty sequence of design blocks with unique names and a common input dimension. Variances are flattened in the same order as outputs. |
required |
Source code in src/gpex/blocks/designs.py
index_map
class-attribute
instance-attribute
index_map: IndexMap = IndexMap.from_blocks(
self.functional_blocks
)
variance_flat
property
Measurement-error variances in canonical scalar-output order.
ObservationBlock
ObservationBlock(
design: ObservationDesignBlock, y: FunctionalValues
)
Bases: Module
A measurement design and its observed outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
design
|
ObservationDesignBlock
|
Functional outputs and their independent Gaussian noise variances. |
required |
y
|
FunctionalValues
|
Observed values with shape |
required |
Source code in src/gpex/blocks/datasets.py
y
instance-attribute
functional
property
functional: FunctionalBlock
The stored functional description, without noise or outcomes.
from_arrays
classmethod
from_arrays(
points: Points,
y: FunctionalValues,
*,
variance: PositiveParameter | Scalar | float,
name: str,
operator: LinearOperator | None = None,
max_size: int | None = None,
padding_point: Point | None = None,
) -> ObservationBlock
Construct observations directly from coordinates and outcomes.
points has shape (n, d). The default identity operator expects
y of shape (n,); otherwise use (n, *operator.output_shape(d)).
variance is one scalar measurement-error variance shared by the block.
Numerical values may be traced; the name and shapes must remain static.
max_size reserves locations, defaulting to max(1024, n).
Unused slots repeat the first point. For n=0, supply a
padding_point valid for the kernel, mean and operator, and an array
points with shape (0, d). Padding is excluded from inference.
Source code in src/gpex/blocks/datasets.py
replace
replace(
points: Points, y: FunctionalValues
) -> ObservationBlock
Replace contents within capacity, retaining operator, name and variance.
append
append(
locations: Locations, y: FunctionalValues
) -> ObservationBlock
Append outcomes using this block's operator and shared variance.
Locations have shape (m, d) with the existing input dimension d;
y must have shape (m, *output_shape). Returns a new block and
supports JIT and differentiation, including the shared variance parameter.
Source code in src/gpex/blocks/datasets.py
FunctionalDataset
FunctionalDataset(blocks: Sequence[ObservationBlock])
Bases: Module
An ordered collection of observed measurement blocks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blocks
|
Sequence[ObservationBlock]
|
Nonempty sequence of observation blocks with unique names and a common input dimension. Each block retains its own variance parameter. |
required |
Source code in src/gpex/blocks/datasets.py
index_map
class-attribute
instance-attribute
index_map: IndexMap = IndexMap.from_blocks(
self.functional_blocks
)
StructuredValues
StructuredValues(flat: FlatValues, index_map: IndexMap)
Bases: Module
Flat and named views of means, variances, or samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
flat
|
FlatValues
|
Numerical values with shape |
required |
index_map
|
IndexMap
|
Static mapping from names to flattened slices and shapes. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
flat |
FlatValues
|
Array of shape |
by_name |
Mapping[str, FunctionalValues]
|
Views derived from |
index_map |
IndexMap
|
Static mapping from names to flattened slices and shapes. |
Source code in src/gpex/blocks/indexing.py
IndexMap
dataclass
from_blocks
classmethod
from_blocks(blocks: Sequence[FunctionalBlock]) -> IndexMap
Source code in src/gpex/blocks/indexing.py
append
append(block: FunctionalBlock) -> IndexMap
Extend the public layout, requiring a new block name.
Source code in src/gpex/blocks/indexing.py
block
unpack
Source code in src/gpex/blocks/indexing.py
pack
Source code in src/gpex/blocks/indexing.py
ObservationDesignBlock.variance stores the scalar measurement-error variance.
Use a fixed scalar or a scalar PositiveParameter to fit it. The same variance
applies to every location and output component in that block.
The block's variances property evaluates that parameter and repeats it over
the functional output shape. Collections expose these measurement-error
variances in canonical scalar-output order through variance_flat.
Observation designs reserve max_size locations and keep a dynamic active
count. See JAX and observation capacity
for capacity, padding and compilation behavior. Functional queries are unreserved.