API Reference
Tensor4all — Module
Tensor4allTensor4all.jl is in an API-skeleton review phase.
The previous implementation has been intentionally removed so the package can be rebuilt against the design documents in docs/design/ without stale public surface area leaking into the rework. Importing the package is expected to work, but the real backend-facing types and operations are deferred to a later phase.
Core
Tensor4all.SkeletonPhaseError — Type
SkeletonPhaseError(message)Raised when code expects functionality that is intentionally deferred during the review-first skeleton phase.
Examples
julia> using Tensor4all
julia> err = SkeletonPhaseError("not ready yet");
julia> sprint(showerror, err)
"not ready yet"Tensor4all.SkeletonNotImplemented — Type
SkeletonNotImplemented(api, layer)Raised by reviewable public APIs that are intentionally present before their backend behavior is implemented.
Examples
julia> using Tensor4all
julia> err = SkeletonNotImplemented(:contract, :core);
julia> sprint(showerror, err)
"Tensor4all skeleton phase: `contract` is planned in the `core` layer but not implemented yet."Tensor4all.BackendUnavailableError — Type
BackendUnavailableError(message)Raised when a backend-backed operation is requested but the tensor4all-rs shared library is not available.
Examples
julia> using Tensor4all
julia> err = BackendUnavailableError("backend missing");
julia> sprint(showerror, err)
"backend missing"Tensor4all.backend_library_path — Function
backend_library_path()Return the expected path to the tensor4all-rs C API shared library.
This helper is backend-free and can be used during the skeleton phase to inspect where the package would look for the compiled library.
Examples
julia> using Tensor4all
julia> backend_library_path() isa String
trueTensor4all.require_backend — Function
require_backend()Load and return the tensor4all-rs shared library handle.
This function is part of the skeleton API surface, but it only succeeds when a compiled backend is available.
Examples
julia> require_backend()
ERROR: BackendUnavailableError(...)Tensor4all.Index — Type
Index(dim; tags=String[], plev=0, id=next_index_id(), backend_handle=nothing)Create a Julia-side review skeleton for an indexed tensor leg.
The metadata behavior is implemented during the skeleton phase, while the optional backend handle keeps the public shape aligned with the eventual backend-facing design.
Examples
julia> using Tensor4all
julia> i = Index(4; tags=["x"], plev=1);
julia> (dim(i), tags(i), plev(i))
(4, ["x"], 1)Tensor4all.dim — Function
dim(i)Return the dimension of i.
Tensor4all.id — Function
id(i)Return the stable identifier of i.
Tensor4all.tags — Function
tags(i)Return a copy of the string tags attached to i.
Tensor4all.plev — Function
plev(i)Return the prime level of i.
Tensor4all.hastag — Function
hastag(i, tag)Return true when tag is attached to i.
Tensor4all.sim — Function
sim(i)Return a similar index with matching metadata and a fresh identifier.
Tensor4all.prime — Function
prime(i, n=1)Return i with its prime level increased by n.
prime(t, n=1)Return t with all attached indices primed by n.
Tensor4all.noprime — Function
noprime(i)Return i with prime level reset to zero.
Tensor4all.setprime — Function
setprime(i, n)Return i with prime level set to n.
Tensor4all.replaceind — Function
replaceind(xs, old, new)Replace old by new in the index collection xs.
Tensor4all.replaceinds — Function
replaceinds(xs, replacements...)Apply multiple index replacements in sequence to xs.
Tensor4all.commoninds — Function
commoninds(xs, ys)Return the indices in xs that also occur in ys, preserving the order from xs.
Tensor4all.uniqueinds — Function
uniqueinds(xs, ys)Return the indices in xs that do not occur in ys, preserving the order from xs.
Tensor4all.Tensor — Type
Tensor(data, inds; backend_handle=nothing)Create a tensor skeleton from Julia-owned dense array data and index metadata.
This constructor validates metadata and shape consistency during the skeleton phase. Backend-backed contraction and factorization behavior remains deferred.
Examples
julia> using Tensor4all
julia> i = Index(2; tags=["i"]);
julia> j = Index(3; tags=["j"]);
julia> t = Tensor(reshape(collect(1.0:6.0), 2, 3), [i, j]);
julia> (rank(t), dims(t))
(2, (2, 3))Tensor4all.inds — Function
inds(t)Return a copy of the index metadata attached to t.
Tensor4all.rank — Function
rank(t)Return the tensor rank of t.
Tensor4all.dims — Function
dims(t)Return the dense array dimensions of t.
Tensor4all.swapinds — Function
swapinds(t, a, b)Swap index metadata a and b on t.
Tensor4all.contract — Function
contract(a, b)Placeholder for tensor contraction.
Examples
julia> contract(a, b)
ERROR: SkeletonNotImplemented(...)contract(a, b)Placeholder for backend-backed TreeTN contraction.
TreeTN
Tensor4all.TreeTensorNetwork — Type
TreeTensorNetwork(tensors; adjacency, siteinds, linkinds, backend_handle=nothing)Create a TreeTN-general review skeleton from local tensor metadata and explicit topology maps.
The topology helpers are implemented during the skeleton phase, while numerical operations remain stub-only until backend integration.
Examples
julia> ttn = TreeTensorNetwork(...; adjacency=..., siteinds=..., linkinds=...)Tensor4all.TensorTrain — Type
TensorTrainAlias for TreeTensorNetwork{Int}, the primary chain-shaped network type in the Julia API.
Tensor4all.MPS — Type
MPSAlias for TensorTrain. MPS-ness is a runtime structural property rather than a separate type.
Tensor4all.MPO — Type
MPOAlias for TensorTrain. MPO-ness is a runtime structural property rather than a separate type.
Tensor4all.vertices — Function
vertices(ttn)Return the sorted vertex labels of ttn.
Tensor4all.neighbors — Function
neighbors(ttn, v)Return the neighboring vertices of v.
Tensor4all.siteinds — Function
siteinds(ttn, v)Return the site indices attached to vertex v.
Tensor4all.linkind — Function
linkind(ttn, a, b)Return the link index connecting vertices a and b.
Tensor4all.is_chain — Function
is_chain(ttn)Return true when ttn has integer vertices 1:n and chain connectivity.
Tensor4all.is_mps_like — Function
is_mps_like(ttn)Return true when each vertex carries exactly one site index.
Tensor4all.is_mpo_like — Function
is_mpo_like(ttn)Return true when each vertex carries exactly two site indices.
Tensor4all.orthogonalize! — Function
orthogonalize!(ttn, args...)Placeholder for backend-backed orthogonalization.
Tensor4all.truncate! — Function
truncate!(ttn, args...)Placeholder for backend-backed truncation.
Tensor4all.inner — Function
inner(a, b)Placeholder for backend-backed TreeTN inner products.
Tensor4all.norm — Function
norm(ttn)Placeholder for backend-backed TreeTN norms.
Tensor4all.to_dense — Function
to_dense(ttn)Placeholder for dense materialization of a TreeTN.
Tensor4all.evaluate — Function
evaluate(ttn, args...)Placeholder for backend-backed TreeTN evaluation.
Quantics
Adopted QuanticsGrids.jl Surface
The following names are re-exported through Tensor4all.jl for single-import usability, but their grid semantics and original documentation remain owned by QuanticsGrids.jl:
DiscretizedGridInherentDiscreteGridquantics_to_grididxquantics_to_origcoordgrididx_to_quanticsgrididx_to_origcoordorigcoord_to_quanticsorigcoord_to_grididx
Tensor4all.QuanticsTransform — Type
QuanticsTransform(kind, parameters)Metadata-only descriptor for a planned quantics transform.
The descriptor is reviewable during the skeleton phase, while transform materialization remains backend-backed and therefore stub-only.
Tensor4all.affine_transform — Function
affine_transform(; matrix, shift)Create an affine transform descriptor.
Tensor4all.shift_transform — Function
shift_transform(; offsets)Create a shift transform descriptor.
Tensor4all.flip_transform — Function
flip_transform(; variables)Create a flip transform descriptor.
Tensor4all.phase_rotation_transform — Function
phase_rotation_transform(; phase)Create a phase-rotation transform descriptor.
Tensor4all.cumsum_transform — Function
cumsum_transform(; variable)Create a cumulative-sum transform descriptor.
Tensor4all.fourier_transform — Function
fourier_transform(; variables)Create a Fourier transform descriptor.
Tensor4all.binaryop_transform — Function
binaryop_transform(; op, variables)Create a binary-operation transform descriptor.
Tensor4all.materialize_transform — Function
materialize_transform(transform)Placeholder for backend-backed transform materialization.
Tensor4all.QTCIOptions — Type
QTCIOptions(; tolerance=1.0e-8, max_rank=64, max_sweeps=10)Metadata-only placeholder for future QTCI configuration.
Tensor4all.QTCIDiagnostics — Type
QTCIDiagnostics(; converged=false, sweeps=0, final_error=Inf)Metadata-only placeholder for future QTCI diagnostics.
Tensor4all.QTCIResultPlaceholder — Type
QTCIResultPlaceholder(options, diagnostics)Placeholder container for future QTCI results.