Skip to main contentIBM Quantum Documentation
This page is from an old version of Qiskit SDK and does not exist in the latest version. We recommend you migrate to the latest version. See the release notes for more information.

qiskit.finance.applications.ising.portfolio_diversification

portfolio diversification

Functions

get_operator(rho, n, q)Converts an instance of portfolio optimization into a list of Paulis.
get_portfoliodiversification_solution(rho, …)Tries to obtain a feasible solution (in vector form) of an instance of portfolio diversification from the results dictionary.
get_portfoliodiversification_value(rho, n, …)Evaluates an objective function of an instance of portfolio diversification and its solution (in vector form).

get_operator

get_operator(rho, n, q)

GitHub

Converts an instance of portfolio optimization into a list of Paulis.

Parameters

  • rho (ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (int) – the number of assets.
  • q (int) – the number of clusters of assets to output.

Return type

WeightedPauliOperator

Returns

operator for the Hamiltonian

get_portfoliodiversification_solution

get_portfoliodiversification_solution(rho, n, q, result)

GitHub

Tries to obtain a feasible solution (in vector form) of an instance of portfolio diversification from the results dictionary.

Parameters

  • rho (ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (int) – the number of assets.
  • q (int) – the number of clusters of assets to output.
  • result (MinimumEigensolverResult) – a result obtained by QAOA.run or VQE.run containing key ‘eigvecs’.

Return type

ndarray

Returns

a vector describing the solution.

get_portfoliodiversification_value

get_portfoliodiversification_value(rho, n, q, x_state)

GitHub

Evaluates an objective function of an instance of portfolio diversification and its solution (in vector form).

Parameters

  • rho (ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (int) – the number of assets.
  • q (int) – the number of clusters of assets to output.
  • x_state (ndarray) – a vector describing the solution.

Return type

float

Returns

cost of the solution.

Was this page helpful?
Report a bug or request content on GitHub.