Shared
inspeqtor.models.shared
inspeqtor.models.shared.mse
mse(x1: ndarray, x2: ndarray)
Source code in src/inspeqtor/v1/model.py
39 40 | |
inspeqtor.models.shared.hermitian
hermitian(U: ndarray, D: ndarray) -> ndarray
This is a function that parametrized Hermitian matrix
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
U
|
ndarray
|
Parameters for unitary operator with shape of (..., 3) |
required |
D
|
ndarray
|
Parameters for diagonal matrix with shape if (..., 2) |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
jnp.ndarray: Hermitian matrix of shape (..., 2, 2) |
Source code in src/inspeqtor/v1/model.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 | |
inspeqtor.models.shared.unitary
unitary(params: ndarray) -> ndarray
Create unitary matrix from parameters
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
ndarray
|
Parameters parametrize the unitary matrix |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
jnp.ndarray: Unitary matrix of shape (..., 2, 2) |
Source code in src/inspeqtor/v1/model.py
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
inspeqtor.models.shared.get_spam
get_spam(
params: VariableDict,
) -> tuple[list[ExpectationValue], dict[str, ndarray]]
Source code in src/inspeqtor/v1/model.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
inspeqtor.models.shared.model_parse_fn
model_parse_fn(key, value)
This is a parse function to be used with load_pytree_from_file function.
The function will skip parsing config and will return as it is load from file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
Any
|
description |
required |
value
|
Any
|
description |
required |
Returns:
| Type | Description |
|---|---|
|
typing.Any: description |
Source code in src/inspeqtor/v1/model.py
525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | |
inspeqtor.models.shared.ModelData
dataclass
Source code in src/inspeqtor/v1/model.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | |
inspeqtor.models.shared.HistoryEntryV3
dataclass
Source code in src/inspeqtor/v1/model.py
584 585 586 587 588 589 | |
inspeqtor.models.shared.get_predict_expectation_value
get_predict_expectation_value(
observable: dict[str, ndarray],
unitaries: ndarray,
order: list[ExpectationValue],
) -> ndarray
Calculate expectation values for given order
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observable
|
operators
|
observable operator |
required |
unitaries
|
ndarray
|
Unitary operators |
required |
order
|
list[ExpectationValue]
|
Order of expectation value to be calculated |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
jnp.ndarray: Expectation value with order as given with |
Source code in src/inspeqtor/v2/models/shared.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | |