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.
Important

IBM Quantum Platform is moving and this version will be sunset on July 1. To get started on the new platform, read the migration guide.

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 (numpy.ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (integer) – the number of assets.
  • q (integer) – the number of clusters of assets to output.

Returns

operator for the Hamiltonian

Return type

WeightedPauliOperator

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 (numpy.ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (integer) – the number of assets.
  • q (integer) – the number of clusters of assets to output.
  • result (dictionary) – a dictionary obtained by QAOA.run or VQE.run containing key ‘eigvecs’.

Returns

a vector describing the solution.

Return type

numpy.ndarray

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 (numpy.ndarray) – an asset-to-asset similarity matrix, such as the covariance matrix.
  • n (integer) – the number of assets.
  • q (integer) – the number of clusters of assets to output.
  • x_state (numpy.ndarray) – a vector describing the solution.

Returns

cost of the solution.

Return type

float

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