TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches
GF reshaping and slicing

Detailed Description

Reshape, flatten and slice the data of a Green's function.

Utilities that reinterpret the data of a Green's function: flattening the target into a two-dimensional form (triqs::gfs::flatten_gf_2d), slicing the target space, transposing, and forming restricted or reinterpreted views.

Functions

template<int N = 0, nda::MemoryArray A>
auto triqs::gfs::flatten_2d (A const &v)
 Flatten an array into two dimensions, keeping one dimension and collapsing the rest.
template<int N = 0, MemoryGf G>
auto triqs::gfs::flatten_gf_2d (G const &g)
 Flatten a Green's function into a single-mesh, tensor-valued Green's function.
template<typename Gf>
requires (is_gf_v<Gf>)
auto triqs::gfs::make_const_view (Gf const &g)
 Make a const view of a Green's function.
template<typename G>
requires (is_gf_v<G>)
view_or_type_t< std::decay_t< G > > triqs::gfs::positive_freq_view (G &&g)
 Make a view of the positive-frequency part of a Matsubara Green's function.
gf< mesh::imtimetriqs::gfs::rebinning_tau (gf_const_view< mesh::imtime > const &g, size_t new_n_tau)
 Rebin an imaginary-time Green's function onto a coarser uniform mesh.
template<typename G, typename... Args>
auto triqs::gfs::reinterpret_scalar_valued_gf_as_matrix_valued (G &&g)
 Reinterpret a scalar-valued Green's function as a 1x1 matrix-valued one.
template<template< typename, typename, typename... > typename G, typename T>
auto triqs::gfs::restricted_view (G< mesh::imfreq, T > const &g, int n_max)
 Make a const view of a Matsubara Green's function restricted to the first n_max frequency indices.
template<typename G, typename... Args>
auto triqs::gfs::slice_target (G &&g, Args &&...1)
 Slice the target of a Green's function, keeping the result matrix- (or tensor-) valued.
template<typename G, typename... Args>
auto triqs::gfs::slice_target_to_scalar (G &&g, Args &&...1)
 Slice the target of a matrix-valued Green's function down to a scalar-valued one.
template<typename M>
gf< M, matrix_valuedtriqs::gfs::transpose (gf_view< M, matrix_valued > g)
 Transpose the target matrix of a matrix-valued Green's function, returning a new Green's function.
template<int N = 0>
void triqs::gfs::unflatten_2d (nda::MemoryArray auto &&out, nda::MemoryArray auto const &afl)
 Inverse of triqs::gfs::flatten_2d: scatter a two-dimensional array back into a higher-rank array.
template<int N = 0, MemoryGf Gfl>
void triqs::gfs::unflatten_gf_2d (MemoryGf auto &g, Gfl const &gfl)
 Inverse of triqs::gfs::flatten_gf_2d: scatter a flattened Green's function back into a higher-rank one.

Function Documentation

◆ flatten_2d()

template<int N = 0, nda::MemoryArray A>
auto triqs::gfs::flatten_2d ( A const & v)

#include <triqs/gfs/gf/flatten.hpp>

Flatten an array into two dimensions, keeping one dimension and collapsing the rest.

The result is a two-dimensional array whose first dimension is the \( N \)-th dimension of the input and whose second dimension is the flattening of all other dimensions, kept in their original order.

Template Parameters
NIndex of the dimension to preserve.
Anda::MemoryArray type of the input.
Parameters
vInput array.
Returns
A two-dimensional array.

Definition at line 50 of file flatten.hpp.

◆ flatten_gf_2d()

template<int N = 0, MemoryGf G>
auto triqs::gfs::flatten_gf_2d ( G const & g)

#include <triqs/gfs/gf/flatten.hpp>

Flatten a Green's function into a single-mesh, tensor-valued Green's function.

The result keeps the \( N \)-th mesh of the input Green's function and has a tensor_valued<1> target containing the flattening of all other data dimensions in their original order.

Template Parameters
NIndex of the mesh to keep.
Gtriqs::gfs::MemoryGf type of the input.
Parameters
gInput Green's function.
Returns
The single-mesh, tensor-valued Green's function.

Definition at line 85 of file flatten.hpp.

◆ make_const_view()

template<typename Gf>
requires (is_gf_v<Gf>)
auto triqs::gfs::make_const_view ( Gf const & g)

#include <triqs/gfs/functions/functions2.hpp>

Make a const view of a Green's function.

Template Parameters
GfThe type of the Green's function.
Parameters
gThe Green's function.
Returns
A triqs::gfs::gf_const_view of g.

Definition at line 53 of file functions2.hpp.

◆ positive_freq_view()

template<typename G>
requires (is_gf_v<G>)
view_or_type_t< std::decay_t< G > > triqs::gfs::positive_freq_view ( G && g)

#include <triqs/gfs/functions/imfreq.hpp>

Make a view of the positive-frequency part of a Matsubara Green's function.

Template Parameters
GThe type of the Green's function (must be an lvalue or a view).
Parameters
gThe Matsubara Green's function.
Returns
A view onto the positive-frequency part of g.

Definition at line 90 of file imfreq.hpp.

◆ rebinning_tau()

gf< mesh::imtime > triqs::gfs::rebinning_tau ( gf_const_view< mesh::imtime > const & g,
size_t new_n_tau )

#include <triqs/gfs/functions/imtime.cpp>

Rebin an imaginary-time Green's function onto a coarser uniform mesh.

The new mesh has new_n_tau points covering the same \( [0, \beta] \) interval. Each output point is an average of the input values whose \( \tau \) falls in the corresponding bin.

Parameters
gThe imaginary-time Green's function to rebin.
new_n_tauNumber of points of the output mesh.
Returns
A new imaginary-time Green's function on a mesh of size new_n_tau.

Definition at line 39 of file imtime.cpp.

◆ reinterpret_scalar_valued_gf_as_matrix_valued()

template<typename G, typename... Args>
auto triqs::gfs::reinterpret_scalar_valued_gf_as_matrix_valued ( G && g)

#include <triqs/gfs/functions/functions2.hpp>

Reinterpret a scalar-valued Green's function as a 1x1 matrix-valued one.

Template Parameters
GThe type of the (scalar-valued) Green's function.
ArgsUnused.
Parameters
gThe scalar-valued Green's function.
Returns
A 1x1 matrix-valued view of g.

Definition at line 254 of file functions2.hpp.

◆ restricted_view()

template<template< typename, typename, typename... > typename G, typename T>
auto triqs::gfs::restricted_view ( G< mesh::imfreq, T > const & g,
int n_max )

#include <triqs/gfs/functions/imfreq.hpp>

Make a const view of a Matsubara Green's function restricted to the first n_max frequency indices.

Template Parameters
GThe Green's function container template.
TThe target type of the Green's function.
Parameters
gThe Matsubara Green's function.
n_maxNumber of (positive) Matsubara indices to keep.
Returns
A const view on the restricted frequency range.

Definition at line 351 of file imfreq.hpp.

◆ slice_target()

template<typename G, typename... Args>
auto triqs::gfs::slice_target ( G && g,
Args &&... args )

#include <triqs/gfs/functions/functions2.hpp>

Slice the target of a Green's function, keeping the result matrix- (or tensor-) valued.

Template Parameters
GThe type of the Green's function.
ArgsTypes of the target slice arguments.
Parameters
gThe Green's function.
argsSlice arguments applied to the target indices.
Returns
A view of g sliced over its target space.

Definition at line 216 of file functions2.hpp.

◆ slice_target_to_scalar()

template<typename G, typename... Args>
auto triqs::gfs::slice_target_to_scalar ( G && g,
Args &&... args )

#include <triqs/gfs/functions/functions2.hpp>

Slice the target of a matrix-valued Green's function down to a scalar-valued one.

Template Parameters
GThe type of the Green's function.
ArgsTypes of the target slice arguments.
Parameters
gThe Green's function.
argsSlice arguments selecting a single target element.
Returns
A scalar-valued view of g.

Definition at line 235 of file functions2.hpp.

◆ transpose()

template<typename M>
gf< M, matrix_valued > triqs::gfs::transpose ( gf_view< M, matrix_valued > g)

#include <triqs/gfs/functions/functions2.hpp>

Transpose the target matrix of a matrix-valued Green's function, returning a new Green's function.

Template Parameters
MMesh type.
Parameters
gThe matrix-valued Green's function.
Returns
A new Green's function whose target matrix is transposed at every mesh point.

Definition at line 376 of file functions2.hpp.

◆ unflatten_2d()

template<int N = 0>
void triqs::gfs::unflatten_2d ( nda::MemoryArray auto && out,
nda::MemoryArray auto const & afl )

#include <triqs/gfs/gf/flatten.hpp>

Inverse of triqs::gfs::flatten_2d: scatter a two-dimensional array back into a higher-rank array.

Template Parameters
NIndex of the dimension that was preserved by the flattening.
Parameters
outOutput array, whose shape determines how the flattened data is reshaped (written into).
aflFlattened (two-dimensional) input array.

Definition at line 65 of file flatten.hpp.

◆ unflatten_gf_2d()

template<int N = 0, MemoryGf Gfl>
void triqs::gfs::unflatten_gf_2d ( MemoryGf auto & g,
Gfl const & gfl )

#include <triqs/gfs/gf/flatten.hpp>

Inverse of triqs::gfs::flatten_gf_2d: scatter a flattened Green's function back into a higher-rank one.

Template Parameters
NIndex of the mesh that was kept by the flattening.
Gfltriqs::gfs::MemoryGf type of the flattened Green's function (must have a non-product mesh).
Parameters
gOutput Green's function (written into).
gflFlattened input Green's function.

Definition at line 100 of file flatten.hpp.