Difference between revisions of "Tensor train module"

From Spinach Documentation Wiki
Jump to: navigation, search
(→‎User-space functions)
(sync with Spinach main f053e432: index polyadic/isreal.m)
 
(48 intermediate revisions by 2 users not shown)
Line 1: Line 1:
−
Tensor product expressions appear naturally in spin dynamics because the state space of a multi-spin system is a direct product of the state spaces of individual spins. A simple example is provided by the nuclear Zeeman interaction Hamiltonian
+
Kronecker product expressions appear naturally in spin dynamics because the state space of a multi-spin system is a direct product of the state spaces of individual spins. A simple example is provided by Cartesian projection operators:
−
 
 
−
<center>
 
−
<math>{{\hat{H}}_{\text{Z}}}=\sum\limits_{n=1}^{N}{{{{\vec{B}}}_{0}}\cdot {{\mathbf{A}}^{\left( n \right)}}\cdot {{{\hat{\vec{S}}}}^{\left( n \right)}}}</math>
 
−
</center>
 
−
 
 
−
where <math>N</math> is the number of spins, <math>{{\vec{B}}_{0}}</math> is the applied magnetic field,
 
−
<math>{{\mathbf{A}}^{\left( n \right)}}</math> are nuclear chemical shielding tensors, the sum runs over all nuclei, and the nuclear spin operators
 
−
 
 
−
<center>
 
−
<math>{{\hat{\vec{S}}}^{\left( n \right)}}=\left[ \begin{matrix}
 
−
  \hat{S}_{\text{X}}^{\left( n \right)} & \hat{S}_{\text{Y}}^{\left( n \right)} & \hat{S}_{\text{Z}}^{\left( n \right)}  \\
 
−
\end{matrix} \right]</math>
 
−
</center>
 
−
 
 
−
have the following direct product form
 
  
 
<center>
 
<center>
Line 20: Line 5:
 
</center>
 
</center>
  
−
where <math>\mathbf{1}</math> denotes a unit matrix of appropriate dimension and the Pauli matrices <math>\left\{ {{{\hat{\sigma }}}_{\text{X}}},{{{\hat{\sigma }}}_{\text{Y}}},{{{\hat{\sigma }}}_{\text{Z}}} \right\}</math> occur in the n-th position of the direct product sequence. This representation is known in numerical linear algebra as canonical polyadic (CP) format. Although CP representations have been known in magnetic resonance spectroscopy for a long time, they suffer in practice from rapid inflation – spin Hamiltonians encountered in NMR and ESR (electron spin resonance) systems can be complicated and, even for simple initial conditions, the number of terms in the canonical decomposition increases rapidly during system evolution. More ominously, the number of CP terms can change dramatically after small perturbations in the Hamiltonian or the system state, for example
+
where <math>\mathbf{1}</math> denotes a unit matrix of appropriate dimension and the Pauli matrices <math>\left\{ {{{\hat{\sigma }}}_{\text{X}}},{{{\hat{\sigma }}}_{\text{Y}}},{{{\hat{\sigma }}}_{\text{Z}}} \right\}</math> occur in the n-th position of the direct product sequence. If the Kronecker products are opened, the matrix is huge. But it is often possible to leave them closed.
  
−
<center>
+
Although such representations have been known for a long time, they are rather hard to work with. In ''Spinach'', we made an attempt. Two types of unopened Kronecker product formats are supported - tensor trains and polyadics. Both are very space-efficient: enormous matrices can be packed into a few kilobytes.
−
<math>\sum\limits_{n=1}^{N}{\hat{S}_{\text{Z}}^{\left( n \right)}}=\underset{\varepsilon \to 0}{\mathop{\lim }}\,\frac{{{(\mathbf{1}+\varepsilon {{{\hat{\sigma }}}_{Z}})}^{\otimes N}}-{{\mathbf{1}}^{\otimes N}}}{\varepsilon }</math>
 
−
</center>
 
  
−
where <math>{{\hat{a}}^{\otimes N}}=\hat{a}\otimes \cdots \otimes \hat{a}</math>. The left hand side of this equation contains <math>N</math> terms, but the expression approximating it on the right hand side has only two terms. The positive side of it is that we can approximate <math>N</math> terms by 2 terms with any accuracy <math>\varepsilon </math>, reducing storage and CPU time. The drawback is that both terms of the approximation grow to infinity when <math>\varepsilon \to 0</math>. Such instabilities in the CP format make it difficult to use – in the presence of numerical rounding noise the number of terms in the decomposition quickly becomes equal to the dimension of the full state space and any efficiency savings disappear.
+
The details are described in our paper on this subject: http://dx.doi.org/10.1126/sciadv.aaw8962
  
−
Unlike the CP format, which is an open tensor network, closed tensor network formats are stable to small perturbations. The most popular closed tensor network format was repeatedly rediscovered and is currently known under three different names: DMRG in condensed-matter physics, MPS (matrix product states) in computational physics and TT (tensor train) in numerical linear algebra. Having duly tossed our three-sided dice, we shall proceed to use the latter name. The general form of the tensor train format is:
+
==Creating tensor train and polyadic objects==
  
−
<center>
+
The function that creates tensor trains is [[ttclass.m]]. Use [[polyadic.m]] for polyadics.
−
<math>x=\tau ({{x}^{(1)}},\ldots ,{{x}^{(N)}})=\sum\limits_{{{\alpha }_{1}}=0}^{{{r}_{1}}}{\cdots }\sum\limits_{{{\alpha }_{N-1}}=0}^{{{r}_{N-1}}}{x_{{{\alpha }_{1}}}^{(1)}\otimes x_{{{\alpha }_{1}}{{\alpha }_{2}}}^{(2)}\otimes \cdots \otimes x_{{{\alpha }_{N-2}}{{\alpha }_{N-1}}}^{(N-1)}\otimes x_{{{\alpha }_{N-1}}}^{(N)}}</math>
 
−
</center>
 
  
−
For the total <math>{{\hat{S}}_{\text{Z}}}</math> operator the tensor train format is
+
[[polyadic.m]] - Creates a polyadic object representing a matrix as a sum of unopened Kronecker products, for example a two-term object with cores {A,B,C} and {D,E} represents A(x)B(x)C + D(x)E.
  
−
<center>
+
[[ttclass.m]] - Creates an object of a tensor train class.
−
<math>\begin{matrix}
 
−
  \hat{H}=\sum\limits_{{{\alpha }_{1}}=1}^{2}{\cdots }\sum\limits_{{{\alpha }_{N-1}}=1}^{2}{\hat{H}_{{{\alpha }_{1}}}^{(1)}\otimes \hat{H}_{{{\alpha }_{1}}{{\alpha }_{2}}}^{(2)}\otimes \cdots \otimes \hat{H}_{{{\alpha }_{N-2}}{{\alpha }_{N-1}}}^{(N-1)}\otimes \hat{H}_{{{\alpha }_{N-1}}}^{(N)}} \\
 
−
  \left[ \begin{matrix}
 
−
  \hat{H}_{1}^{(1)}  \\
 
−
  \hat{H}_{2}^{(1)}  \\
 
−
\end{matrix} \right]=\left[ \begin{matrix}
 
−
  {{{\hat{\sigma }}}_{\text{Z}}}  \\
 
−
  \mathbf{1}  \\
 
−
\end{matrix} \right],\text{    }\left[ \begin{matrix}
 
−
  \hat{H}_{11}^{(2)} & \hat{H}_{12}^{(2)}  \\
 
−
  \hat{H}_{21}^{(2)} & \hat{H}_{22}^{(2)}  \\
 
−
\end{matrix} \right]=\cdots =\left[ \begin{matrix}
 
−
  \hat{H}_{11}^{(N-1)} & \hat{H}_{12}^{(N-1)}  \\
 
−
  \hat{H}_{21}^{(N-1)} & \hat{H}_{22}^{(N-1)}  \\
 
−
\end{matrix} \right]=\left[ \begin{matrix}
 
−
  \mathbf{1} & 0  \\
 
−
  {{{\hat{\sigma }}}_{\text{Z}}} & \mathbf{1}  \\
 
−
\end{matrix} \right],\text{    }\left[ \begin{matrix}
 
−
  \hat{H}_{1}^{(N)}  \\
 
−
  \hat{H}_{2}^{(N)}  \\
 
−
\end{matrix} \right]=\left[ \begin{matrix}
 
−
  \mathbf{1}  \\
 
−
  {{{\hat{\sigma }}}_{\text{Z}}}  \\
 
−
\end{matrix} \right] \\
 
−
\end{matrix}</math>
 
−
</center>
 
  
−
Note that the number of terms in each summation (known as bond dimension) is two, and that all factors of the decomposition are now bounded. The tensor train representation in the right hand side of (5) has <math>4N-4</math> operators <math>\hat{H}_{{{\alpha }_{n-1}}{{\alpha }_{n}}}^{(n)}</math>, each of which is either zero, or the identity <math>\mathbf{1}</math>, or the Pauli matrix <math>{{\hat{\sigma }}_{Z}}</math>. The original representation of the Hamiltonian in Equation (3) has <math>{{N}^{2}}</math> such operators – the tensor train representation is clearly more memory-efficient.
+
==Tensor train functions==
  
−
Another notable example is the ZZ coupling Hamiltonian that often makes an appearance in simple linear spin chain models:
+
[[ttclass/amensolve.m]] - solves the linear system Ax=y using the AMEn iteration.
  
−
<center>
+
[[ttclass/amensum.m]] - tensor train summation without loss of accuracy.
−
<math>\hat{J}=\sum\limits_{m > n}{\hat{S}_{\text{Z}}^{(m)}\hat{S}_{\text{Z}}^{(n)}}</math>
 
−
</center>
 
−
 
 
−
This CP format with <math>N(N-1)/2</math> rank-one terms contains <math>{{N}^{2}}(N-1)</math> operators. The corresponding tensor train representation is:
 
−
 
 
−
<center>
 
−
<math>\begin{matrix}
 
−
  \hat{J}=\sum\limits_{{{\alpha }_{1}}=1}^{3}{\cdots }\sum\limits_{{{\alpha }_{N-1}}=1}^{3}{\hat{J}_{{{\alpha }_{1}}}^{(1)}\otimes \hat{J}_{{{\alpha }_{1}}{{\alpha }_{2}}}^{(2)}\otimes \cdots \otimes \hat{J}_{{{\alpha }_{N-2}}{{\alpha }_{N-1}}}^{(N-1)}\otimes \hat{J}_{{{\alpha }_{N-1}}}^{(N)}} \\
 
−
  {{{\hat{J}}}^{(1)}}=\left[ \begin{matrix}
 
−
  0  \\
 
−
  {{{\hat{\sigma }}}_{Z}}  \\
 
−
  \mathbf{1}  \\
 
−
\end{matrix} \right],\text{    }{{{\hat{J}}}^{(2)}}=\cdots ={{{\hat{J}}}^{(N-1)}}=\left[ \begin{matrix}
 
−
  \mathbf{1} & 0 & 0  \\
 
−
  {{{\hat{\sigma }}}_{Z}} & \mathbf{1} & 0  \\
 
−
  0 & {{{\hat{\sigma }}}_{Z}} & \mathbf{1}  \\
 
−
\end{matrix} \right],    {{{\hat{J}}}^{(N)}}=\left[ \begin{matrix}
 
−
  \mathbf{1}  \\
 
−
  {{{\hat{\sigma }}}_{Z}}  \\
 
−
  0  \\
 
−
\end{matrix} \right] \\
 
−
\end{matrix}</math>
 
−
</center>
 
−
 
 
−
Here each summation runs over three terms only, and the total number of <math>\hat{J}_{{{\alpha }_{n-1}}{{\alpha }_{n}}}^{(n)}</math> matrices is <math>9N-12</math>, which is much smaller than the storage requirements of the CP format.
 
−
 
 
−
The above stands in sharp contrast with the classical approach to magnetic resonance simulations, where the Hamiltonian is represented as a <math>{{2}^{N}}\times {{2}^{N}}</math> sparse matrix with all non-zero entries stored in memory. As soon as the sparse matrix is assembled, the CPU and memory resources grow exponentially with the number of spins <math>N</math>, making the simulation prohibitively difficult for large systems. To avoid this problem (known colloquially as the curse of dimensionality), all data should be kept in compressed tensor formats of the form given in the equations above, without ever expanding the Kronecker products.
 
−
 
 
−
A very considerable body of literature exists on manipulating expressions directly in tensor product formats. In particular, a given tensor may be converted into the TT format using sequential singular value decompositions. Given two tensors in the TT format, any bilinear operation (addition, element-wise multiplication, matrix-vector multiplication, etc.) may be carried out directly in the TT format. Efficient algorithms for Fourier transform and convolution have also recently emerged.
 
−
 
 
−
==Building tensor train objects==
 
−
 
 
−
The primary function that creates tensor trains is [[ttclass.m]].
 
−
 
 
−
==User-space functions==
 
  
 
[[ttclass/clearcoeff.m]] - absorbs the physical coefficient of the tensor train into its cores.
 
[[ttclass/clearcoeff.m]] - absorbs the physical coefficient of the tensor train into its cores.
Line 138: Line 58:
  
 
[[ttclass/nnz.m]] - number of non-zeros used by the TT object.
 
[[ttclass/nnz.m]] - number of non-zeros used by the TT object.
 +
 +
[[ttclass/numel.m]] - Number of elements in the matrix represented by a tensor train.
  
 
[[ttclass/norm.m]] – computes a norm of the ttclass object. Because of the internal structure of the tensor train format, only the Frobenius norm can be computed reasonably fast.
 
[[ttclass/norm.m]] – computes a norm of the ttclass object. Because of the internal structure of the tensor train format, only the Frobenius norm can be computed reasonably fast.
  
−
[[ttclass/ttclass_ort.m]] - TT orthogonalisation.
+
[[ttclass/ttort.m]] - TT orthogonalisation.
 +
 
 +
[[ttclass/pack.m]] - pack up the additions buffer.
  
 
[[ttclass/plus.m]] - tensor train addition.
 
[[ttclass/plus.m]] - tensor train addition.
Line 166: Line 90:
  
 
[[ttclass/transpose.m]] - transpose of a matrix represented by a tensor train.
 
[[ttclass/transpose.m]] - transpose of a matrix represented by a tensor train.
 +
 +
[[ttclass/truncate.m]] - performs right-to-left SVD recompression for a tensor train.
  
 
[[ttclass/unit_like.m]] - unit tensor train with the same topology as the one supplied.
 
[[ttclass/unit_like.m]] - unit tensor train with the same topology as the one supplied.
  
 
[[ttclass/vec.m]] – reshapes a ttclass matrix into the ttclass vector with the same elements.
 
[[ttclass/vec.m]] – reshapes a ttclass matrix into the ttclass vector with the same elements.
 +
 +
==Polyadic functions==
 +
 +
[[polyadic/allfinite.m]] - true if all numeric data in the polyadic object is finite
 +
 +
[[polyadic/ctranspose.m]] - conjugate-transpose operation.
 +
 +
[[polyadic/full.m]] - returns the matrix represented by the polyadic as a full matrix.
 +
 +
[[polyadic/gpuArray.m]] - uploads the components of the polyadic to GPU.
 +
 +
[[polyadic/inflate.m]] - returns the matrix represented by the polyadic as a sparse matrix.
 +
 +
[[polyadic/isempty.m]] - returns true for polyadics with zero dimensions.
 +
 +
[[polyadic/isreal.m]] - true if all numeric data in the polyadic object is real
 +
 +
[[polyadic/kron.m]] - concatenates polyadics, which is equivalent to a Kronecker product.
 +
 +
[[polyadic/minus.m]] - buffered subtraction operation.
 +
 +
[[polyadic/mtimes.m]] - polyadic-times-scalar and polyadic-times-matrix operation.
 +
 +
[[polyadic/nnz.m]] - number of non-zeros in the cores of the polyadic.
 +
 +
[[polyadic/plus.m]] - buffered addition operation.
 +
 +
[[polinfo.m]] - draws an ASCII diagram of a polyadic object.
 +
 +
[[polyadic/polinfo.m]] - draws an ASCII diagram of a polyadic object.
 +
 +
[[polyadic/prefix.m]] - buffered multiplication operation.
 +
 +
[[polyadic/simplify.m]] - internal structure simplification.
 +
 +
[[polyadic/size.m]] - size of the matrix represented by the polyadic.
 +
 +
[[polyadic/suffix.m]] - buffered multiplication operation.
 +
 +
[[polyadic/transpose.m]] - transpose operation.
 +
 +
[[polyadic/validate.m]] - polyadic object structure check.
 +
 +
Other overloaded Matlab functions (code inside [[polyadic.m]] file) are:
 +
 +
  isfloat    - always returns true
 +
 +
  ismatrix  - always returns true
 +
 +
  isnumeric  - always returns true
 +
 +
  numel      - number of elements inthe matrix represented by the polyadic
 +
 +
==OPIUM object==
 +
OPIUM (object pretending it's a unit matrix) is an auxiliary object used by polyadics to avoid explicit storage of unit matrices. It rarely needs to be called directly, but the associated functions are:
 +
 +
[[opium/full.m]] - convert into a full matrix
 +
 +
[[opium/kron.m]] - Kronecker product
 +
 +
[[opium/mtimes.m]] - matrix-vector product
 +
 +
[[opium/opium.m]] - constructor function
 +
 +
[[opium/size.m]] - matrix dimension information
 +
 +
Other overloaded Matlab functions (code inside [[opium/opium.m]] file) are:
 +
 +
  nnz        - always returns 1
 +
 +
  numel      - always returns 1
 +
 +
  isnumeric  - always returns true
 +
 +
  iseye      - returns true for opia with unit coefficients
 +
 +
  sparse    - converts into a sparse matrix
 +
 +
  conj      - complex conjugate
 +
 +
  ctranspose - conjugate-transpose
 +
 +
  gpuArray  - GPU upload
 +
 +
  gather    - GPU download
 +
 +
''Version 2.4, authors: [[Ilya Kuprov]], [[Dmitry Savostyanov]], [[Sergey Dolgov]]''

Latest revision as of 08:14, 30 August 2026

Kronecker product expressions appear naturally in spin dynamics because the state space of a multi-spin system is a direct product of the state spaces of individual spins. A simple example is provided by Cartesian projection operators:

\(\hat{S}_{\left\{ \text{X,Y,Z} \right\}}^{\left( n \right)}=\mathbf{1}\otimes \mathbf{1}\otimes ...\otimes {{\hat{\sigma }}_{\left\{ \text{X,Y,Z} \right\}}}\otimes ...\otimes \mathbf{1}\otimes \mathbf{1}\)

where \(\mathbf{1}\) denotes a unit matrix of appropriate dimension and the Pauli matrices \(\left\{ {{{\hat{\sigma }}}_{\text{X}}},{{{\hat{\sigma }}}_{\text{Y}}},{{{\hat{\sigma }}}_{\text{Z}}} \right\}\) occur in the n-th position of the direct product sequence. If the Kronecker products are opened, the matrix is huge. But it is often possible to leave them closed.

Although such representations have been known for a long time, they are rather hard to work with. In Spinach, we made an attempt. Two types of unopened Kronecker product formats are supported - tensor trains and polyadics. Both are very space-efficient: enormous matrices can be packed into a few kilobytes.

The details are described in our paper on this subject: http://dx.doi.org/10.1126/sciadv.aaw8962

Creating tensor train and polyadic objects

The function that creates tensor trains is ttclass.m. Use polyadic.m for polyadics.

polyadic.m - Creates a polyadic object representing a matrix as a sum of unopened Kronecker products, for example a two-term object with cores {A,B,C} and {D,E} represents A(x)B(x)C + D(x)E.

ttclass.m - Creates an object of a tensor train class.

Tensor train functions

ttclass/amensolve.m - solves the linear system Ax=y using the AMEn iteration.

ttclass/amensum.m - tensor train summation without loss of accuracy.

ttclass/clearcoeff.m - absorbs the physical coefficient of the tensor train into its cores.

ttclass/conj.m - element-wise conjugation of a matrix in a TT representation.

ttclass/ctranspose.m - conjugate-transpose of a matrix in a TT representation.

ttclass/diag.m – mimics diag for matrices. If an input is ttclass matrix, returns a ttclass vector (matrix with 1 column) containing the diagonal. If an input is a vector, returns a diagonal matrix.

ttclass/dot.m – mimics the dot product operation for matrices.

ttclass/full.m – mimics the corresponding operation for sparse matrices. Computes all Kronecker products and returns full matrix. May result in out-of-memory errors for large matrices.

ttclass/hdot.m – the Hadamard dot product operation.

ttclass/ismatrix.m - returns true for non-empty TT objects.

ttclass/isnumeric.m - returns true for non-empty TT objects

ttclass/isreal.m - returns true for real-valued ttclass objects.

ttclass/kron.m - Kronecker product of tensor train representation of matrices.

ttclass/mean.m – mimics the corresponding operation for matrices. If the input is a ttclass matrix, returns a vector of its mean values along the specified dimension. If the input is a ttclass vector, returns the mean value in a scalar.

ttclass/minus.m - tensor train subtraction.

ttclass/mldivide.m - matrix left divide for TT objects.

ttclass/mrdivide.m - divides a tensor train by a scalar.

ttclass/mtimes.m - matrix product in the TT representation.

ttclass/nnz.m - number of non-zeros used by the TT object.

ttclass/numel.m - Number of elements in the matrix represented by a tensor train.

ttclass/norm.m – computes a norm of the ttclass object. Because of the internal structure of the tensor train format, only the Frobenius norm can be computed reasonably fast.

ttclass/ttort.m - TT orthogonalisation.

ttclass/pack.m - pack up the additions buffer.

ttclass/plus.m - tensor train addition.

ttclass/rand.m - random tensor trains.

ttclass/ranks.m – returns tensor train ranks of the tensor trains buffered in the ttclass.

ttclass/rdivide.m - divides a tensor train by a scalar.

ttclass/revert.m - computes a bit-revert permutation of a tensor train.

ttclass/shrink.m – compresses a given ttclass object into a single tensor train with optimal ranks.

ttclass/sizes.m – returns mode sizes of a ttclass object (dimensions of elementary matrices).

ttclass/size.m - returns the size of the matrix represented by the tensor train.

ttclass/subsref.m - provides indexing functionality for tensor train objects.

ttclass/sum.m - mimics the corresponding operation for matrices. If the input is a ttclass matrix, returns a vector of its sums along the specified dimension. If an input is a ttclass vector, returns a sum of its values in a scalar.

ttclass/trace.m – returns the trace of a given matrix.

ttclass/transpose.m - transpose of a matrix represented by a tensor train.

ttclass/truncate.m - performs right-to-left SVD recompression for a tensor train.

ttclass/unit_like.m - unit tensor train with the same topology as the one supplied.

ttclass/vec.m – reshapes a ttclass matrix into the ttclass vector with the same elements.

Polyadic functions

polyadic/allfinite.m - true if all numeric data in the polyadic object is finite

polyadic/ctranspose.m - conjugate-transpose operation.

polyadic/full.m - returns the matrix represented by the polyadic as a full matrix.

polyadic/gpuArray.m - uploads the components of the polyadic to GPU.

polyadic/inflate.m - returns the matrix represented by the polyadic as a sparse matrix.

polyadic/isempty.m - returns true for polyadics with zero dimensions.

polyadic/isreal.m - true if all numeric data in the polyadic object is real

polyadic/kron.m - concatenates polyadics, which is equivalent to a Kronecker product.

polyadic/minus.m - buffered subtraction operation.

polyadic/mtimes.m - polyadic-times-scalar and polyadic-times-matrix operation.

polyadic/nnz.m - number of non-zeros in the cores of the polyadic.

polyadic/plus.m - buffered addition operation.

polinfo.m - draws an ASCII diagram of a polyadic object.

polyadic/polinfo.m - draws an ASCII diagram of a polyadic object.

polyadic/prefix.m - buffered multiplication operation.

polyadic/simplify.m - internal structure simplification.

polyadic/size.m - size of the matrix represented by the polyadic.

polyadic/suffix.m - buffered multiplication operation.

polyadic/transpose.m - transpose operation.

polyadic/validate.m - polyadic object structure check.

Other overloaded Matlab functions (code inside polyadic.m file) are:

  isfloat    - always returns true

  ismatrix   - always returns true

  isnumeric  - always returns true

  numel      - number of elements inthe matrix represented by the polyadic

OPIUM object

OPIUM (object pretending it's a unit matrix) is an auxiliary object used by polyadics to avoid explicit storage of unit matrices. It rarely needs to be called directly, but the associated functions are:

opium/full.m - convert into a full matrix

opium/kron.m - Kronecker product

opium/mtimes.m - matrix-vector product

opium/opium.m - constructor function

opium/size.m - matrix dimension information

Other overloaded Matlab functions (code inside opium/opium.m file) are:

  nnz        - always returns 1

  numel      - always returns 1

  isnumeric  - always returns true

  iseye      - returns true for opia with unit coefficients

  sparse     - converts into a sparse matrix

  conj       - complex conjugate

  ctranspose - conjugate-transpose

  gpuArray   - GPU upload

  gather     - GPU download

Version 2.4, authors: Ilya Kuprov, Dmitry Savostyanov, Sergey Dolgov