einsums::create_random_definite#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/TensorUtilities/CreateRandomDefinite.hpp.

template<typename T = double>
Tensor<T, 2> create_random_definite(const std::string &name, int rows, int cols, RemoveComplexT<T> mean)#

Create a random positive or negative definite matrix. A positive definite matrix is a symmetric matrix whose eigenvalues are all positive. Similarly for negative definite matrices.

Random orthonormal eigenvectors P and Maxwell-Boltzmann eigenvalues D with mean mean give \(P^TDP\); a negative mean gives a negative definite matrix.

Added in version 1.0.0.

Parameters:
  • name – The name for the matrix.

  • rows – The number of rows.

  • cols – The number of columns. Should equal the number of rows.

  • mean – The mean for the eigenvalues. Defaults to 1.

Returns:

A new positive definite or negative definite matrix.

template<typename T = double>
RuntimeTensor<T> create_random_definite(const std::string &name, int n)#

Python-bindable runtime-rank create_random_definite.

Builds a square SPD (or SND if mean < 0) matrix and returns it as a RuntimeTensor. Adapter over the typed Tensor<T, 2> entry point.