请输入您要查询的百科知识:

 

词条 Q Sharp
释义

  1. History

  2. Usage

  3. Features

  4. Documentation and Resources

  5. Syntax

      Similarities with C#    Similarities with F#    Differences  

  6. References

  7. External links

{{Correct title|title=Q#|reason=hash}}{{third-party|date=September 2018}}{{Infobox programming language
| title = Q#
| released = December 11th, 2017
| developer = Microsoft
| designer = Microsoft Research (quantum architectures and computation group; QuArC)
| influenced by = C#, F#
| File extensions = .qs
| platform = Common Language Infrastructure
| paradigm = multi-paradigm: quantum, functional, imperative
| typing = static, strong
| website= [https://docs.microsoft.com/en-us/quantum Microsoft Quantum] ([https://github.com/Microsoft/Quantum GitHub])
}}Q# (pronounced as Q sharp) is a domain-specific programming language used for expressing quantum algorithms.[1] It was initially released to the public by Microsoft as part of the Quantum Development Kit.[2]

History

During a Microsoft Ignite Keynote on {{formatDate|2017-09-26|mdy}}, Microsoft announced that they were going to release a new programming language geared specifically towards quantum computers.[3] On {{formatDate|2017-12-11|mdy}}, Microsoft released Q# as a part of the Quantum Development Kit.[2]

Usage

Q# is available as a separately downloaded extension for Visual Studio,[4] but it can also be run as an independent tool from the Command line and/or Visual Studio Code. The Quantum Development Kit ships with a quantum simulator which is capable of running Q#.

In order to invoke the quantum simulator, another .NET programming language, usually C#, is used, which provides the (classical) input data for the simulator and reads the (classical) output data from the simulator.

Features

A primary feature of Q# is the ability to create and use qubits for algorithms. As a consequence, some of the most prominent features of Q# are the ability to entangle and introduce superpositioning to qubits via Controlled NOT gates and Hadamard gates, respectively, as well as Toffoli Gates, Pauli X, Y, Z Gate, and many more which are used for a variety of operations; see the list at the article on quantum logic gates.

The hardware stack that will eventually come together with Q# is expected to implement Qubits as topological qubits. The quantum simulator that is shipped with the Quantum Development Kit today is capable of processing up to 32 qubits on a user machine and up to 40 qubits on Azure.

Documentation and Resources

Currently, the resources available for Q# are scarce, but the official documentation is published: [https://docs.microsoft.com/en-us/quantum/?view=qsharp-preview Microsoft Developer Network: Q#]. [https://github.com/Microsoft/Quantum/ Microsoft Quantum Github repository] is also a large collection of sample programs implementing a variety of Quantum algorithms and their tests.

Microsoft has also hosted a Quantum Coding contest on Codeforces here: http://codeforces.com/msqs2018, and also provided related material to help answer the questions in the blog posts, plus the detailed solutions in the tutorials.

Microsoft hosts a set of learning exercises to help learn Q# on github: https://github.com/Microsoft/QuantumKatas with links to resources, and answers to the problems.

Syntax

Q# is syntactically related to both C# and F# yet also has some significant differences.

Similarities with C#

  • Uses {{Code|namespace}} for code isolation
  • All statements end with a {{Code|;}}
  • Curly braces are used for statements of scope
  • Single line comments are done using {{Code|//}}
  • Variable data types such as {{Code|Int}} {{Code|Double}} {{Code|String}} and {{Code|Bool}} are similar, although capitalised (and Int is 64-bit)[5]
  • Qubits are allocated and disposed inside a {{Code|using}} block.
  • Lambda functions using the => operator.
  • Results are returned using the {{Code|return}} keyword.

Similarities with F#

  • Variables are declared using either {{Code|let}} or {{Code|mutable}}[1]
  • First-order functions
  • Modules, which are imported using the {{Code|open}} keyword
  • The datatype is declared after the variable name
  • The range operator {{Code|..}}
  • {{Code|for … in}} loops
  • Every operation/function has a return value, rather than {{Code|void}}. Instead of {{Code|void}}, an empty Tuple {{Code|()}} is returned.
  • Definition of record datatypes (using the {{Code|newtype}} keyword, instead of {{Code|type}}).

Differences

  • Functions are declared using the {{Code|function}} keyword
  • Operations on the quantum computer are declared using the {{Code|operation}} keyword
  • Lack of multiline comments
  • Asserts instead of throwing exceptions
  • Documentation is written in Markdown instead of XML-based documentation tags

References

1. ^{{Cite web|url=https://docs.microsoft.com/en-us/quantum/quantum-qr-intro?view=qsharp-preview|title=The Q# Programming Language|last=QuantumWriter|website=docs.microsoft.com|language=en-us|access-date=2017-12-11}}
2. ^{{Cite news|url=https://cloudblogs.microsoft.com/quantum/2017/12/11/announcing-microsoft-quantum-development-kit/|title=Announcing the Microsoft Quantum Development Kit|access-date=2017-12-11|language=en-US}}
3. ^{{Cite news|url=https://cloudblogs.microsoft.com/quantum/2017/09/26/microsoft-announces-quantum-computing-programming-language/|title=Microsoft announces quantum computing programming language|access-date=2017-12-14|language=en-US}}
4. ^{{Cite web|url=https://docs.microsoft.com/en-us/quantum/quantum-installconfig?view=qsharp-preview|title=Setting up the Q# development environment|last=QuantumWriter|website=docs.microsoft.com|language=en-us|access-date=2017-12-14}}
5. ^https://docs.microsoft.com/en-gb/quantum/language/type-model?view=qsharp-preview

External links

  • [https://docs.microsoft.com/en-us/quantum/quantum-qr-intro?view=qsharp-preview Official documentation]
{{quantum computing}}{{Common Language Infrastructure}}

4 : Programming languages|Microsoft|Quantum programming|Programming languages created in 2017

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/22 10:04:11