The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Photonic::Utils

VERSION

version 0.009

SYNOPSIS

    use Photonic::Utils qw(cmatmult);
    $c=cmatmult($a, $b);

DESCRIPTION

Utility functions that may be useful.

Exportable Functions

  • $r=linearCombine($c, $s)

    Complex linear combination of states. $c is an arrayref of 'complex' pdl scalars and $s is an arrayref of 'complex' states ('complex' multidimensional pdl).

  • $p=HProd($a, $b)

    Hermitean product <a|b> of two 2xNx... 'complex' pdls.

  • $psiG = RtoG($psiR, $ndims, $skip)

    Transforms a $ndims-dimensional 'complex' scalar, vector or tensor field $psiR that is a function of position within the unit cell to a complex field $psiG that is a function of the reciprocal vectors. The first dimension must be 2, as the values are complex. The next $skip dimensions are skiped (0 for a scalar, 1 for a vector, 2 for a 2-tensor field). The Fourier transform is performed over the following $ndims dimensions.

  • $psiR = GtoR($psiG, $ndims, $skip)

    The opposite transformation to RtoG. Transform a 'complex' scalara, vector or tensorial field from reciprocal to real space.

  • $b=tile($a, $nx, $ny,...)

    returns $a repeated periodically $nx times along the x direction, $ny along the y direction, etc. Useful for making plots.

  • $l=vectors2Dlist($f, $s, $d)

    Returns a 2D vector field ready for gnuplotting from a vector field $f scaling the result by $s and decimating the field by $d. The vectors are centered on the decimated lattice points.

  • $c=cmatmult($a, $b)

    Returns the matrix product of the complex matrices $a times $b, with signatures a(2,j,i), b(2,k,j), c(2,k,i). The first index is 2, corresponding to the real and imaginary parts, j denotes columns of a, rows of b, i denotes rows of a and of the result c, k denotes columns of b and the result c. Recall that in pdl the first (row) index is faster. May thread over extra dimensions.

NOTE

Uses Inline::Pdlpp, so the first time it is run it compiles itself, and would take a little longer than the following. To recompile, remove the directory _Inline/ before running.

You must make sure that the relative location of the libutils.so library is correct. See $Bin below.