[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-PennyLaneAI--pennylane":3,"tool-PennyLaneAI--pennylane":64},[4,17,27,35,44,52],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":16},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,3,"2026-04-05T11:01:52",[13,14,15],"开发框架","图像","Agent","ready",{"id":18,"name":19,"github_repo":20,"description_zh":21,"stars":22,"difficulty_score":23,"last_commit_at":24,"category_tags":25,"status":16},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",140436,2,"2026-04-05T23:32:43",[13,15,26],"语言模型",{"id":28,"name":29,"github_repo":30,"description_zh":31,"stars":32,"difficulty_score":23,"last_commit_at":33,"category_tags":34,"status":16},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",107662,"2026-04-03T11:11:01",[13,14,15],{"id":36,"name":37,"github_repo":38,"description_zh":39,"stars":40,"difficulty_score":10,"last_commit_at":41,"category_tags":42,"status":16},4292,"Deep-Live-Cam","hacksider\u002FDeep-Live-Cam","Deep-Live-Cam 是一款专注于实时换脸与视频生成的开源工具，用户仅需一张静态照片，即可通过“一键操作”实现摄像头画面的即时变脸或制作深度伪造视频。它有效解决了传统换脸技术流程繁琐、对硬件配置要求极高以及难以实时预览的痛点，让高质量的数字内容创作变得触手可及。\n\n这款工具不仅适合开发者和技术研究人员探索算法边界，更因其极简的操作逻辑（仅需三步：选脸、选摄像头、启动），广泛适用于普通用户、内容创作者、设计师及直播主播。无论是为了动画角色定制、服装展示模特替换，还是制作趣味短视频和直播互动，Deep-Live-Cam 都能提供流畅的支持。\n\n其核心技术亮点在于强大的实时处理能力，支持口型遮罩（Mouth Mask）以保留使用者原始的嘴部动作，确保表情自然精准；同时具备“人脸映射”功能，可同时对画面中的多个主体应用不同面孔。此外，项目内置了严格的内容安全过滤机制，自动拦截涉及裸露、暴力等不当素材，并倡导用户在获得授权及明确标注的前提下合规使用，体现了技术发展与伦理责任的平衡。",88924,"2026-04-06T03:28:53",[13,14,15,43],"视频",{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":23,"last_commit_at":50,"category_tags":51,"status":16},3704,"NextChat","ChatGPTNextWeb\u002FNextChat","NextChat 是一款轻量且极速的 AI 助手，旨在为用户提供流畅、跨平台的大模型交互体验。它完美解决了用户在多设备间切换时难以保持对话连续性，以及面对众多 AI 模型不知如何统一管理的痛点。无论是日常办公、学习辅助还是创意激发，NextChat 都能让用户随时随地通过网页、iOS、Android、Windows、MacOS 或 Linux 端无缝接入智能服务。\n\n这款工具非常适合普通用户、学生、职场人士以及需要私有化部署的企业团队使用。对于开发者而言，它也提供了便捷的自托管方案，支持一键部署到 Vercel 或 Zeabur 等平台。\n\nNextChat 的核心亮点在于其广泛的模型兼容性，原生支持 Claude、DeepSeek、GPT-4 及 Gemini Pro 等主流大模型，让用户在一个界面即可自由切换不同 AI 能力。此外，它还率先支持 MCP（Model Context Protocol）协议，增强了上下文处理能力。针对企业用户，NextChat 提供专业版解决方案，具备品牌定制、细粒度权限控制、内部知识库整合及安全审计等功能，满足公司对数据隐私和个性化管理的高标准要求。",87618,"2026-04-05T07:20:52",[13,26],{"id":53,"name":54,"github_repo":55,"description_zh":56,"stars":57,"difficulty_score":23,"last_commit_at":58,"category_tags":59,"status":16},2268,"ML-For-Beginners","microsoft\u002FML-For-Beginners","ML-For-Beginners 是由微软推出的一套系统化机器学习入门课程，旨在帮助零基础用户轻松掌握经典机器学习知识。这套课程将学习路径规划为 12 周，包含 26 节精炼课程和 52 道配套测验，内容涵盖从基础概念到实际应用的完整流程，有效解决了初学者面对庞大知识体系时无从下手、缺乏结构化指导的痛点。\n\n无论是希望转型的开发者、需要补充算法背景的研究人员，还是对人工智能充满好奇的普通爱好者，都能从中受益。课程不仅提供了清晰的理论讲解，还强调动手实践，让用户在循序渐进中建立扎实的技能基础。其独特的亮点在于强大的多语言支持，通过自动化机制提供了包括简体中文在内的 50 多种语言版本，极大地降低了全球不同背景用户的学习门槛。此外，项目采用开源协作模式，社区活跃且内容持续更新，确保学习者能获取前沿且准确的技术资讯。如果你正寻找一条清晰、友好且专业的机器学习入门之路，ML-For-Beginners 将是理想的起点。",84991,"2026-04-05T10:45:23",[14,60,43,61,15,62,26,13,63],"数据工具","插件","其他","音频",{"id":65,"github_repo":66,"name":67,"description_en":68,"description_zh":69,"ai_summary_zh":69,"readme_en":70,"readme_zh":71,"quickstart_zh":72,"use_case_zh":73,"hero_image_url":74,"owner_login":75,"owner_name":75,"owner_avatar_url":76,"owner_bio":77,"owner_company":78,"owner_location":78,"owner_email":78,"owner_twitter":75,"owner_website":79,"owner_url":80,"languages":81,"stars":99,"forks":100,"last_commit_at":101,"license":102,"difficulty_score":103,"env_os":104,"env_gpu":104,"env_ram":104,"env_deps":105,"category_tags":114,"github_topics":115,"view_count":23,"oss_zip_url":78,"oss_zip_packed_at":78,"status":16,"created_at":134,"updated_at":135,"faqs":136,"releases":166},4213,"PennyLaneAI\u002Fpennylane","pennylane","PennyLane is an open-source quantum software platform for quantum computing, quantum machine learning, and quantum chemistry. Create meaningful quantum algorithms, from inspiration to implementation.","PennyLane 是一款专为量子计算、量子机器学习及量子化学打造的开源软件平台。它致力于降低量子编程的门槛，帮助用户将算法灵感快速转化为实际代码，解决了量子硬件碎片化以及经典与量子系统难以协同开发的痛点。\n\n这款工具特别适合科研人员、量子算法开发者以及对前沿技术感兴趣的学生使用。无论是探索含噪声中等规模量子（NISQ）设备，还是研究容错量子计算，PennyLane 都能提供强大的支持。其核心亮点在于卓越的跨平台兼容性：用户可以使用熟悉的 Python 机器学习框架（如 PyTorch、TensorFlow、JAX）构建混合模型，并无缝切换在后端模拟器或真实的量子硬件上运行。此外，PennyLane 还内置了丰富的量子化学工具库和高质量数据集，显著加速了科研进程。针对高性能需求，它还提供了即时编译（JIT）等进阶功能，支持自适应电路和实时测量反馈。作为由研究者为研究者打造的框架，PennyLane 让探索量子世界的奥秘变得更加直观且高效。","\u003Cp align=\"center\">\n  \u003C!-- Tests (GitHub actions) -->\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Factions?query=workflow%3ATests\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FPennyLaneAI\u002FPennyLane\u002Ftests.yml?branch=main&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- CodeCov -->\n  \u003Ca href=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002FPennyLaneAI\u002Fpennylane\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002FPennyLaneAI\u002Fpennylane\u002Fmain.svg?logo=codecov&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- ReadTheDocs -->\n  \u003Ca href=\"https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Flatest\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_337a1e47d97d.png\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- PyPI -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002FPennyLane\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002FPennyLane.svg?style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- Forum -->\n  \u003Ca href=\"https:\u002F\u002Fdiscuss.pennylane.ai\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fdiscourse\u002Fhttps\u002Fdiscuss.pennylane.ai\u002Fposts.svg?logo=discourse&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- License -->\n  \u003Ca href=\"https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fl\u002FPennyLane.svg?logo=apache&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\">PennyLane\u003C\u002Fa> is a cross-platform Python library for\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-computing\u002F\">quantum computing\u003C\u002Fa>,\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-machine-learning\u002F\">quantum machine learning\u003C\u002Fa>,\n  and\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-chemistry\u002F\">quantum chemistry\u003C\u002Fa>.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  The definitive open-source framework for quantum programming. Built by researchers, for research.\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_97b3341a4c69.png\" width=\"700px\">\n    \u003C!--\n    Use a relative import for the dark mode image. When loading on PyPI, this\n    will fail automatically and show nothing.\n    -->\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_25c9e84a32e2.png\" width=\"700px\" onerror=\"this.style.display='none'\" alt=\"\"\u002F>\n\u003C\u002Fp>\n\n\n## Key Features\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_dac0a72d4780.png\" width=\"400px\" align=\"right\">\n\n- \u003Cstrong>*Program quantum computers*\u003C\u002Fstrong>. Build quantum circuits with a wide range of state preparations, gates, and measurements. Run on [high-performance simulators](https:\u002F\u002Fpennylane.ai\u002Fperformance\u002F) or [various hardware devices](https:\u002F\u002Fpennylane.ai\u002Fplugins\u002F), with advanced features like mid-circuit measurements and error mitigation.\n\n- \u003Cstrong>*Master quantum algorithms*\u003C\u002Fstrong>. From NISQ to fault-tolerant quantum computing, unlock algorithms for research and application. Analyze performance, visualize circuits, and access tools for [quantum chemistry](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Fchemistry.html) and [algorithm development](https:\u002F\u002Fpennylane.ai\u002Fsearch\u002F?contentType=DEMO&categories=algorithms&sort=publication_date).\n\n- \u003Cstrong>*Machine learning with quantum hardware and simulators*\u003C\u002Fstrong>. Integrate with **PyTorch**, **TensorFlow**, **JAX**, **Keras**, or **NumPy** to define and train hybrid models using quantum-aware optimizers and hardware-compatible gradients for advanced research tasks. [Quantum machine learning quickstart](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Finterfaces.html).\n\n\n- \u003Cstrong>*Quantum datasets*\u003C\u002Fstrong>. Access high-quality, pre-simulated datasets to decrease time-to-research and accelerate algorithm development. [Browse the datasets](https:\u002F\u002Fpennylane.ai\u002Fdatasets\u002F) or contribute your own data.\n\n\n- \u003Cstrong>*Compilation and performance*\u003C\u002Fstrong>. Experimental support for just-in-time\n  compilation. Compile your entire hybrid workflow, with support for \n  advanced features such as adaptive circuits, real-time measurement \n  feedback, and unbounded loops. See\n  [Catalyst](https:\u002F\u002Fgithub.com\u002Fpennylaneai\u002Fcatalyst) for more details.\n\nFor more details and additional features, please see the [PennyLane website](https:\u002F\u002Fpennylane.ai\u002Ffeatures\u002F).\n\n## Installation\n\nPennyLane requires Python version 3.11 and above. Installation of PennyLane, as well as all\ndependencies, can be done using pip:\n\n```console\npython -m pip install pennylane\n```\n\n## Docker support\n\nDocker images are found on the [PennyLane Docker Hub page](https:\u002F\u002Fhub.docker.com\u002Fu\u002Fpennylaneai), where there is also a detailed description about PennyLane Docker support. [See description here](https:\u002F\u002Fdocs.pennylane.ai\u002Fprojects\u002Flightning\u002Fen\u002Fstable\u002Fdev\u002Fdocker.html) for more information.\n\n## Getting started\n\nGet up and running quickly with PennyLane by following our [quickstart guide](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Fpennylane.html), designed to introduce key features and help you start building quantum circuits right away.\n\nWhether you're exploring quantum machine learning (QML), quantum computing, or quantum chemistry, PennyLane offers a wide range of tools and resources to support your research:\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_4dec8e5baf1a.png\" align=\"right\" width=\"350px\">\n\n### Key Resources:\n\n* [Research-oriented Demos](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations)\n* [Learn Quantum Programming](https:\u002F\u002Fpennylane.ai\u002Fqml\u002F) with the [Codebook](https:\u002F\u002Fpennylane.ai\u002Fcodebook\u002F) and [Coding Challenges](https:\u002F\u002Fpennylane.ai\u002Fchallenges\u002F)\n* [Frequently Asked Questions](https:\u002F\u002Fpennylane.ai\u002Ffaq)\n* [Glossary](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fglossary)\n* [Videos](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fvideos)\n\n\nYou can also check out our [documentation](https:\u002F\u002Fpennylane.readthedocs.io) for [quickstart\nguides](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fintroduction\u002Fpennylane.html) to using PennyLane,\nand detailed developer guides on [how to write your\nown](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fdevelopment\u002Fplugins.html) PennyLane-compatible\nquantum device.\n\n## Demos\n\nTake a deeper dive into quantum computing by exploring cutting-edge algorithms using PennyLane and quantum hardware. [Explore PennyLane demos](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations).\n\n\u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_a4e2a155ddb8.png\" width=\"900px\">\n\u003C\u002Fa>\n\nIf you would like to contribute your own demo, see our [demo submission\nguide](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemos_submission).\n\n## Research Applications\n\nPennyLane is at the forefront of research in quantum computing, quantum machine learning, and quantum chemistry. Explore how PennyLane is used for research in the following publications:\n\n- **Quantum Computing**: [Fast quantum circuit cutting with randomized measurements](https:\u002F\u002Fquantum-journal.org\u002Fpapers\u002Fq-2023-03-02-934\u002F)\n\n- **Quantum Machine Learning**: [Better than classical? The subtle art of benchmarking quantum machine learning models](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.07059)\n\n- **Quantum Chemistry**: [Accelerating Quantum Computations of Chemistry Through Regularized Compressed Double Factorization](https:\u002F\u002Fquantum-journal.org\u002Fpapers\u002Fq-2024-06-13-1371\u002F)\n\nImpactful research drives PennyLane. Let us know what features you need for your research on [GitHub](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002Fnew?assignees=&labels=enhancement+%3Asparkles%3A&projects=&template=feature_request.yml) or on our [website](https:\u002F\u002Fpennylane.ai\u002Fresearch).\n\n\n\n## Contributing to PennyLane\n\nWe welcome contributions—simply fork the PennyLane repository, and then make a [pull\nrequest](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F) containing your contribution. All\ncontributors to PennyLane will be listed as authors on the releases. All users who contribute\nsignificantly to the code (new plugins, new functionality, etc.) will be listed on the PennyLane\narXiv paper.\n\nWe also encourage bug reports, suggestions for new features and enhancements, and even links to cool\nprojects or applications built on PennyLane.\n\nSee our [contributions\npage](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fblob\u002Fmain\u002F.github\u002FCONTRIBUTING.md) and our\n[Development guide](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fdevelopment\u002Fguide.html) for more\ndetails.\n\n## Support\n\n- **Source Code:** https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\n- **Issue Tracker:** https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\n\nIf you are having issues, please let us know by posting the issue on our GitHub issue tracker.\n\nJoin the [PennyLane Discussion Forum](https:\u002F\u002Fdiscuss.pennylane.ai\u002F) to connect with the quantum community, get support, and engage directly with our team. It’s the perfect place to share ideas, ask questions, and collaborate with fellow researchers and developers!\n\nNote that we are committed to providing a friendly, safe, and welcoming environment for all.\nPlease read and respect the [Code of Conduct](.github\u002FCODE_OF_CONDUCT.md).\n\n## Authors\n\nPennyLane is the work of [many contributors](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fgraphs\u002Fcontributors).\n\nIf you are doing research using PennyLane, please cite [our paper](https:\u002F\u002Farxiv.org\u002Fabs\u002F1811.04968):\n\n> Ville Bergholm et al. *PennyLane: Automatic differentiation of hybrid quantum-classical\n> computations.* 2018. arXiv:1811.04968\n\n## License\n\nPennyLane is **free** and **open source**, released under the Apache License, Version 2.0.\n","\u003Cp align=\"center\">\n  \u003C!-- 测试（GitHub Actions） -->\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Factions?query=workflow%3ATests\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002FPennyLaneAI\u002FPennyLane\u002Ftests.yml?branch=main&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- CodeCov -->\n  \u003Ca href=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002FPennyLaneAI\u002Fpennylane\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fcodecov\u002Fc\u002Fgithub\u002FPennyLaneAI\u002Fpennylane\u002Fmain.svg?logo=codecov&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- ReadTheDocs -->\n  \u003Ca href=\"https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Flatest\">\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_337a1e47d97d.png\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- PyPI -->\n  \u003Ca href=\"https:\u002F\u002Fpypi.org\u002Fproject\u002FPennyLane\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002FPennyLane.svg?style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- 论坛 -->\n  \u003Ca href=\"https:\u002F\u002Fdiscuss.pennylane.ai\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fdiscourse\u002Fhttps\u002Fdiscuss.pennylane.ai\u002Fposts.svg?logo=discourse&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n  \u003C!-- 许可证 -->\n  \u003Ca href=\"https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\">\n    \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fl\u002FPennyLane.svg?logo=apache&style=flat-square\" \u002F>\n  \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\">PennyLane\u003C\u002Fa> 是一个跨平台的 Python 库，用于\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-computing\u002F\">量子计算\u003C\u002Fa>、\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-machine-learning\u002F\">量子机器学习\u003C\u002Fa>，\n  以及\n  \u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fquantum-chemistry\u002F\">量子化学\u003C\u002Fa>。\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  量子编程的权威开源框架。由研究人员打造，服务于科研。\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_97b3341a4c69.png\" width=\"700px\">\n    \u003C!--\n    使用相对路径导入暗模式图像。在 PyPI 上加载时，此操作会自动失败，不会显示任何内容。\n    -->\n    \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_25c9e84a32e2.png\" width=\"700px\" onerror=\"this.style.display='none'\" alt=\"\"\u002F>\n\u003C\u002Fp>\n\n\n## 核心特性\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_dac0a72d4780.png\" width=\"400px\" align=\"right\">\n\n- \u003Cstrong>*编程量子计算机*\u003C\u002Fstrong>。使用多种态制备、门操作和测量构建量子线路。可在[高性能模拟器](https:\u002F\u002Fpennylane.ai\u002Fperformance\u002F)或[各类硬件设备](https:\u002F\u002Fpennylane.ai\u002Fplugins\u002F)上运行，并支持中途测量、误差缓解等高级功能。\n\n- \u003Cstrong>*掌握量子算法*\u003C\u002Fstrong>。从 NISQ 到容错量子计算，解锁适用于研究与应用的算法。分析性能、可视化线路，并获取用于[量子化学](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Fchemistry.html)和[算法开发](https:\u002F\u002Fpennylane.ai\u002Fsearch\u002F?contentType=DEMO&categories=algorithms&sort=publication_date)的工具。\n\n- \u003Cstrong>*结合量子硬件与模拟器的机器学习*\u003C\u002Fstrong>。与 **PyTorch**、**TensorFlow**、**JAX**、**Keras** 或 **NumPy** 集成，利用量子感知优化器和硬件兼容梯度定义并训练混合模型，以应对高级研究任务。[量子机器学习快速入门](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Finterfaces.html)。\n\n- \u003Cstrong>*量子数据集*\u003C\u002Fstrong>。访问高质量的预模拟数据集，缩短研究周期，加速算法开发。[浏览数据集](https:\u002F\u002Fpennylane.ai\u002Fdatasets\u002F)或贡献您自己的数据。\n\n- \u003Cstrong>*编译与性能*\u003C\u002Fstrong>。实验性支持即时编译。编译整个混合工作流，支持自适应线路、实时测量反馈和无界循环等高级功能。更多详情请参阅 [Catalyst](https:\u002F\u002Fgithub.com\u002Fpennylaneai\u002Fcatalyst)。\n\n有关更多详细信息及附加功能，请访问 [PennyLane 官网](https:\u002F\u002Fpennylane.ai\u002Ffeatures\u002F)。\n\n## 安装\n\nPennyLane 需要 Python 3.11 及以上版本。可通过 pip 安装 PennyLane 及其所有依赖项：\n\n```console\npython -m pip install pennylane\n```\n\n## Docker 支持\n\nDocker 镜像可在 [PennyLane Docker Hub 页面](https:\u002F\u002Fhub.docker.com\u002Fu\u002Fpennylaneai)找到，该页面还提供了关于 PennyLane Docker 支持的详细说明。[查看说明](https:\u002F\u002Fdocs.pennylane.ai\u002Fprojects\u002Flightning\u002Fen\u002Fstable\u002Fdev\u002Fdocker.html)以获取更多信息。\n\n## 入门指南\n\n按照我们的[快速入门指南](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Fpennylane.html)，您可以迅速上手并开始使用 PennyLane，该指南旨在介绍核心功能，帮助您立即开始构建量子线路。\n\n无论您是探索量子机器学习 (QML)、量子计算还是量子化学，PennyLane 都提供丰富的工具和资源来支持您的研究：\n\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_4dec8e5baf1a.png\" align=\"right\" width=\"350px\">\n\n### 核心资源：\n\n* [面向研究的演示](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations)\n* [学习量子编程](https:\u002F\u002Fpennylane.ai\u002Fqml\u002F)：通过 [代码手册](https:\u002F\u002Fpennylane.ai\u002Fcodebook\u002F) 和 [编程挑战](https:\u002F\u002Fpennylane.ai\u002Fchallenges\u002F)\n* [常见问题解答](https:\u002F\u002Fpennylane.ai\u002Ffaq)\n* [术语表](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fglossary)\n* [视频](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fvideos)\n\n\n您还可以查阅我们的[文档](https:\u002F\u002Fpennylane.readthedocs.io)，其中包含使用 PennyLane 的[快速入门指南](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fintroduction\u002Fpennylane.html)，以及关于如何编写您自己的[PennyLane 兼容量子设备插件](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fdevelopment\u002Fplugins.html)的详细开发者指南。\n\n## 演示\n\n通过使用 PennyLane 和量子硬件探索前沿算法，深入理解量子计算。[浏览 PennyLane 演示](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations)。\n\n\u003Ca href=\"https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemonstrations\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_readme_a4e2a155ddb8.png\" width=\"900px\">\n\u003C\u002Fa>\n\n如果您希望贡献自己的演示，请参阅我们的[演示提交指南](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemos_submission)。\n\n## 研究应用\n\nPennyLane 处于量子计算、量子机器学习和量子化学研究的最前沿。请参阅以下文献，了解 PennyLane 在这些领域的研究应用：\n\n- **量子计算**：[基于随机化测量的快速量子线路切割](https:\u002F\u002Fquantum-journal.org\u002Fpapers\u002Fq-2023-03-02-934\u002F)\n\n- **量子机器学习**：[优于经典吗？量子机器学习模型基准测试的微妙艺术](https:\u002F\u002Farxiv.org\u002Fabs\u002F2403.07059)\n\n- **量子化学**：[通过正则化压缩双分解加速量子化学计算](https:\u002F\u002Fquantum-journal.org\u002Fpapers\u002Fq-2024-06-13-1371\u002F)\n\n有影响力的科研推动着 PennyLane 的发展。请在 [GitHub](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002Fnew?assignees=&labels=enhancement+%3Asparkles%3A&projects=&template=feature_request.yml) 或我们的 [网站](https:\u002F\u002Fpennylane.ai\u002Fresearch) 上告诉我们您在研究中需要哪些功能。\n\n## 参与 PennyLane 贡献\n\n我们欢迎各类贡献——只需 fork PennyLane 仓库，然后提交包含您贡献的 [pull 请求](https:\u002F\u002Fhelp.github.com\u002Farticles\u002Fabout-pull-requests\u002F) 即可。所有为 PennyLane 做出贡献的开发者都将在发布版本中被列为作者。对代码做出重大贡献（如新增插件、新功能等）的用户还将被列入 PennyLane 的 arXiv 论文作者名单。\n\n我们也鼓励大家报告 bug、提出新功能和改进的建议，甚至分享基于 PennyLane 构建的精彩项目或应用链接。\n\n更多详情请参阅我们的 [贡献指南](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fblob\u002Fmain\u002F.github\u002FCONTRIBUTING.md) 和 [开发指南](https:\u002F\u002Fpennylane.readthedocs.io\u002Fen\u002Fstable\u002Fdevelopment\u002Fguide.html)。\n\n## 支持\n\n- **源代码**：https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\n- **问题追踪器**：https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\n\n如果您遇到任何问题，请在我们的 GitHub 问题追踪器上提交 issue，以便我们及时协助解决。\n\n加入 [PennyLane 讨论论坛](https:\u002F\u002Fdiscuss.pennylane.ai\u002F)，与量子社区互动、获取支持，并直接与我们的团队交流！这里是分享想法、提问以及与同行研究人员和开发者协作的理想平台。\n\n请注意，我们致力于为所有人提供友好、安全和包容的环境。请阅读并遵守我们的 [行为准则](.github\u002FCODE_OF_CONDUCT.md)。\n\n## 作者\n\nPennyLane 是由 [众多贡献者](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fgraphs\u002Fcontributors) 共同打造的成果。\n\n如果您正在使用 PennyLane 进行研究，请引用我们的论文：\n\n> Ville Bergholm 等人. *PennyLane：混合量子-经典计算的自动微分.* 2018. arXiv:1811.04968\n\n## 许可证\n\nPennyLane 是 **免费**且 **开源**的，采用 Apache License, Version 2.0 许可协议发布。","# PennyLane 快速上手指南\n\nPennyLane 是一个跨平台的 Python 库，专为量子计算、量子机器学习和量子化学研究设计。它支持与 PyTorch、TensorFlow、JAX 等主流机器学习框架无缝集成，是构建混合量子 - 经典模型的首选开源框架。\n\n## 环境准备\n\n在开始之前，请确保您的开发环境满足以下要求：\n\n*   **操作系统**：支持 Linux、macOS 和 Windows。\n*   **Python 版本**：需要 **Python 3.11** 或更高版本。\n*   **前置依赖**：建议预先安装 `pip` 包管理工具。国内用户若遇到网络延迟，可配置国内镜像源（如清华源或阿里源）以加速下载。\n\n## 安装步骤\n\n### 1. 基础安装\n使用 pip 直接安装 PennyLane 及其核心依赖：\n\n```console\npython -m pip install pennylane\n```\n\n> **提示**：国内开发者推荐使用国内镜像源加速安装，例如：\n> ```console\n> python -m pip install pennylane -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n### 2. Docker 支持（可选）\n如果您希望使用容器化环境，PennyLane 提供了官方 Docker 镜像。请访问 [PennyLane Docker Hub](https:\u002F\u002Fhub.docker.com\u002Fu\u002Fpennylaneai) 获取详细使用说明。\n\n## 基本使用\n\n以下是最简单的示例，展示如何构建一个量子电路并计算期望值。此示例演示了如何定义量子节点（QNode）、使用内置模拟器以及执行计算。\n\n```python\nimport pennylane as qml\nfrom pennylane import numpy as np\n\n# 1. 定义量子设备（使用默认的高性能模拟器）\ndev = qml.device(\"default.qubit\", wires=2)\n\n# 2. 构建量子电路\n@qml.qnode(dev)\ndef circuit(x):\n    qml.RX(x, wires=0)          # 旋转门\n    qml.CNOT(wires=[0, 1])      # 受控非门\n    return qml.expval(qml.PauliZ(0)) # 测量泡利 Z 算子的期望值\n\n# 3. 执行电路\ninput_param = 0.5\nresult = circuit(input_param)\n\nprint(f\"输入参数: {input_param}\")\nprint(f\"测量结果 (期望值): {result}\")\n```\n\n### 下一步\n*   **量子机器学习**：尝试将上述 `circuit` 嵌入到 PyTorch 或 TensorFlow 模型中进行训练。\n*   **真实硬件运行**：通过安装相应的插件（如 `pennylane-ionq`, `pennylane-qiskit`），即可将代码部署到真实的量子计算机上。\n*   **深入学习**：访问 [PennyLane 官方文档](https:\u002F\u002Fdocs.pennylane.ai) 查看详细的教程、演示代码和量子化学模块指南。","某制药公司的量子计算团队正尝试利用变分量子本征求解器（VQE）模拟小分子基态能量，以加速新药研发中的材料筛选过程。\n\n### 没有 pennylane 时\n- 研究人员需针对不同品牌的量子硬件编写完全不同的底层代码，导致算法无法在模拟器与真实设备间无缝迁移。\n- 构建混合量子 - 经典模型时，手动推导量子电路参数对损失函数的梯度极其繁琐且容易出错，严重拖慢训练迭代速度。\n- 缺乏与 PyTorch 或 TensorFlow 等主流深度学习框架的原生接口，难以复用现有的经典神经网络组件进行联合建模。\n- 验证量子化学算法需要从头搭建分子哈密顿量映射逻辑，耗费数周时间处理基础数据预处理而非核心算法研究。\n\n### 使用 pennylane 后\n- 借助其跨平台特性，团队只需编写一套代码即可直接在本地高性能模拟器或云端量子芯片上运行，实现了“一次编写，随处执行”。\n- 利用自动微分功能，pennylane 能直接计算量子电路梯度并兼容量子感知优化器，将模型训练周期从数天缩短至数小时。\n- 通过原生集成 PyTorch 和 JAX 等框架，研究人员轻松构建了混合神经网络，将量子层作为可训练模块嵌入现有深度学习流水线。\n- 调用内置的量子化学模块，团队仅需几行代码即可完成分子结构到量子线路的映射，迅速聚焦于提升算法精度的核心任务。\n\npennylane 通过统一编程接口与自动化微分能力，彻底消除了量子算法从理论构思到落地实现的工程壁垒。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FPennyLaneAI_pennylane_97b3341a.png","PennyLaneAI","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FPennyLaneAI_d104cdb1.png","PennyLane is a cross-platform Python library for differentiable programming of quantum computers. Train a quantum computer the same way as a neural network.",null,"https:\u002F\u002Fpennylane.ai","https:\u002F\u002Fgithub.com\u002FPennyLaneAI",[82,86,90,93,96],{"name":83,"color":84,"percentage":85},"Python","#3572A5",99.9,{"name":87,"color":88,"percentage":89},"OpenQASM","#AA70FF",0,{"name":91,"color":92,"percentage":89},"Dockerfile","#384d54",{"name":94,"color":95,"percentage":89},"Shell","#89e051",{"name":97,"color":98,"percentage":89},"Makefile","#427819",3136,763,"2026-04-05T11:34:53","Apache-2.0",1,"未说明",{"notes":106,"python":107,"dependencies":108},"PennyLane 是一个跨平台的量子计算、量子机器学习和量子化学库。支持在高性能模拟器或各种硬件设备上运行。可选安装 Catalyst 以支持即时编译（JIT）和高级功能。提供 Docker 镜像支持。","3.11+",[109,110,111,112,113],"PyTorch","TensorFlow","JAX","Keras","NumPy",[13],[116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133],"quantum","machine-learning","deep-learning","neural-network","optimization","quantum-computing","quantum-machine-learning","automatic-differentiation","tensorflow","pytorch","autograd","qiskit","cirq","differentiable-computing","quantum-chemistry","qml","jax","python","2026-03-27T02:49:30.150509","2026-04-06T14:04:01.540432",[137,142,147,152,157,162],{"id":138,"question_zh":139,"answer_zh":140,"source_url":141},19198,"为什么在计算 Hessian 矩阵时，某些新添加的操作不被 `param_shift_hessian()` 支持？","目前该功能不会按原建议实施。因为 PennyLane 正转向不可变对象（immutable objects），这将消除 `coeffs` 和 `data` 之间可能存在的 inconsistency。通常情况下，应使用 `h.data` 作为操作对象，而 `h.coeffs`（查找 `h._coeffs`）可能会产生过时的结果。因此，硬编码的支持列表将被新的架构逻辑取代，无需手动更新支持列表。","https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002F2195",{"id":143,"question_zh":144,"answer_zh":145,"source_url":146},19199,"如何让 `default.mixed` 模拟器支持 TensorFlow、PyTorch 和 JAX 的原生自动微分（backpropagation）？","该功能已在开发路线图中。维护者正在修改 `default.mixed` 设备以使用 `qml.math` 模块，从而通过 `autoray` 实现对不同框架的分发。一旦完成，用户即可在 `default.mixed` 上设置 `diff_method='backprop'`，并支持如 TensorFlow 的 Keras 混合模型、JAX 的 `jax.vmap` 并行计算等功能。目前可通过关注相关 Pull Request（如 #1801）获取最新进展。","https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002F1528",{"id":148,"question_zh":149,"answer_zh":150,"source_url":151},19200,"使用 `lightning.kokkos` 设备进行机器学习训练时出现内存泄漏，是 PennyLane 的 bug 吗？","经过排查，该内存泄漏问题并非由 PennyLane 或 `lightning.kokkos` 设备引起，而是源于 PyTorch 本身的使用方式（特别是与 `nn.Sequential` 相关的调用模式）。建议检查模型定义中是否正确管理了计算图和梯度追踪。若将量子网络架构移至其他模型结构中可避免该问题，则进一步证实是 PyTorch 上下文管理问题而非 PennyLane 缺陷。","https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002F6297",{"id":153,"question_zh":154,"answer_zh":155,"source_url":156},19201,"如何定义量子函数（QNode）的输入和输出格式？是否支持批量数据和多返回值？","当前 API 已基本确立：量子函数必须包含 `return` 语句以返回期望值；支持返回多个量子比特\u002F模式的期望值（例如用于变分本征求解器或多分类任务）；输入参数可分为数据输入和可调参数两类。虽然早期对批量数据处理存在讨论，但目前标准用法是逐个处理样本，若需批量加速需依赖设备自身的并行化能力。自定义分层参数结构可通过嵌套字典或列表传递。","https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002F11",{"id":158,"question_zh":159,"answer_zh":160,"source_url":161},19202,"第三方插件开发者如何应对 PennyLane 中 `Operation` 类的重构？","为确保平滑过渡，PennyLane 会在多个版本中提供弃用警告（deprecation warnings），让开发者有时间更新其自定义 `Operation` 和设备插件。建议插件开发者密切关注官方发布的迁移指南，并在代码中适配新的 `Operation` 接口规范。即使使用“旧风格”的自定义操作，系统也会暂时兼容并提示升级路径，至少支持数个主版本周期。","https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fissues\u002F2210",{"id":163,"question_zh":164,"answer_zh":165,"source_url":141},19203,"`.coeffs` 属性是否仍会返回预计算的旧值？是否有必要修复这种行为？","是的，`.coeffs` 目前仍返回预计算的 `._coeffs` 值，这可能导致获取到过时的结果。尽管社区有人提议实现动态更新机制，但由于整体架构正向不可变对象迁移，未来推荐直接使用 `h.data` 而非依赖 `.coeffs`。因此，短期内不会专门为此添加补丁，用户应调整代码习惯以避免潜在错误。",[167,172,177,182,187,192,197,202,207,212,217,222,227,232,237,242,247,252,257,262],{"id":168,"version":169,"summary_zh":170,"released_at":171},117192,"v0.43.3","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* `gast` 包现在已成为 PennyLane 的显式依赖项。此前，`gast` 包是由 `diastatic-malt` 间接引入的，但 `diastatic-malt==2.15.3` 已经将 `gast` 从其依赖列表中移除，这导致在导入 PennyLane 时出现错误。\n  [(#9160)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F9160)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本版本的贡献者（按字母顺序排列）如下：\n\nYushao Chen,\nAndrija Paurević,\nDavid Wierichs","2026-03-11T12:50:36",{"id":173,"version":174,"summary_zh":175,"released_at":176},117193,"v0.44.1","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* `gast` 包现在是 PennyLane 的显式依赖项。此前，`gast` 包是由 `diastatic-malt` 间接引入的，但 `diastatic-malt==2.15.3` 已经将 `gast` 从其依赖列表中移除，这导致在导入 PennyLane 时出现错误。\n  [(#9160)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F9160)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本版本的贡献者（按字母顺序排列）：\n\n陈宇绍，\n安德里亚·帕乌雷维奇，\n大卫·维里希斯","2026-03-10T20:20:46",{"id":178,"version":179,"summary_zh":180,"released_at":181},117194,"v0.44.0","\u003Ch3>自上次发布以来的新功能\u003C\u002Fh3>\n\n\u003Ch4>量子随机存取存储器（QRAM）💾\u003C\u002Fh4>\n\n* PennyLane 现在提供了三种 QRAM 实现，包括桶式 QRAM (`BBQRAM`)、仅选择型 QRAM (`SelectOnlyQRAM`) 以及结合了 `BBQRAM` 和 `SelectOnlyQRAM` 特性的混合型 QRAM (`HybridQRAM`)。具体选择哪种 QRAM 实现取决于应用场景，例如在宽度与深度之间的权衡，以及对噪声的鲁棒性等。[(#8670)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8670) [(#8679)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8679) [(#8680)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8680) [(#8801)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8801)\n\n无论采用哪种实现方式，QRAM 都能将与数据集中第 \\(i\\) 个条目对应的位串 \\(b_i\\) 编码起来，并且可以在叠加态中完成这一操作：\\(\\text{QRAM} \\sum_i c_i \\vert i \\rangle \\vert 0 \\rangle = \\sum_i c_i \\vert i \\rangle \\vert b_i \\rangle\\)。其中，表示 \\(\\vert i \\rangle\\) 的第一个寄存器称为“控制线”寄存器（文献中常被称为“地址”寄存器），而包含 \\(\\vert b_i \\rangle\\) 的第二个寄存器则称为“目标线”寄存器（用于加载数据集中的第 \\(i\\) 个条目）。\n\n本版本中提供的每种 QRAM 实现可简要描述如下：\n\n* `BBQRAM`：一种桶式结构的 QRAM 实现，同时具有抗噪声能力。\n* `SelectOnlyQRAM`：由一系列 `MultiControlledX` 门组成的 QRAM 实现。\n* `HybridQRAM`：结合了 `BBQRAM` 和 `SelectOnlyQRAM` 的特性，允许在深度和宽度之间进行权衡。\n\n下面给出一个使用 `BBQRAM` 将数据读入目标寄存器的示例，其中数据集由一个位串列表表示，我们希望读取其第二个条目（“110”）：\n\n```python\nimport pennylane as qml\n\nbitstrings = [\"010\", \"111\", \"110\", \"000\"]\nbitstring_size = 3\n\nnum_control_wires = 2 # len(bitstrings) = 4 = 2**2\nnum_work_wires = 1 + 3 * ((1 \u003C\u003C num_control_wires) - 1) # 10\n\nreg = qml.registers(\n    {\n        \"control\": num_control_wires,\n        \"target\": bitstring_size,\n        \"work_wires\": num_work_wires\n    }\n)\n\ndev = qml.device(\"default.qubit\")\n@qml.qnode(dev)\ndef bb_quantum():\n    # 准备一个地址，例如 |10>（索引为 2）\n    qml.BasisEmbedding(2, wires=reg[\"control\"])\n\n    qml.BBQRAM(\n        bitstrings,\n        control_wires=reg[\"control\"],\n        target_wires=reg[\"target\"],\n        work_wires=reg[\"work_wires\"],\n    )\n    return qml.probs(wires=reg[\"target\"])\n```\n\n```pycon\n>>> import numpy as np\n>>> print(np.round(bb_quantum()))  \n[0. 0. 0. 0. 0. 0. 1. 0.]\n```\n\n请注意，“110”用二进制表示等于十进制的 6，这正是目标寄存器中唯一非零概率所对应的位置。","2026-01-13T17:38:30",{"id":183,"version":184,"summary_zh":185,"released_at":186},117195,"v0.43.2","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* PennyLane 的代码已更新，以兼容 NumPy 2.4，从而解决了与弃用相关的错误和警告信息。\n  [(#8808)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8808)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本版本的贡献者（按字母顺序排列）如下：\n\n陈宇绍，\n安德里亚·保雷维奇。","2025-12-23T17:02:59",{"id":188,"version":189,"summary_zh":190,"released_at":191},117196,"v0.43.1","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* 修复了 :func:`~pennylane.to_openqasm` 输出中的一个 bug：电路中间测量的 `creg` 声明缺少分号，导致生成的 QASM 代码无效。\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本版本的贡献者（按字母顺序排列）：\n\n陈宇绍，\n马库斯·爱德华兹，\n内特·斯蒂门。","2025-11-06T22:53:57",{"id":193,"version":194,"summary_zh":195,"released_at":196},117197,"v0.43.0","\u003Ch3>自上次发布以来的新功能\u003C\u002Fh3>\n\n\u003Ch4>全新的资源估算模块 📖 \u003C\u002Fh4>\n\n`pennylane.estimator` 模块中现已推出一个专门用于资源估算的新工具包！该模块的功能旨在快速且灵活地估算在不同抽象层次上编写的程序所需的量子资源。此新模块包含以下特性：\n\n* 新的 `pennylane.estimator.estimate.estimate` 函数允许用户根据给定的门集和配置，估算执行电路或操作所需的量子资源。[(#8203)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8203) [(#8205)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8205) [(#8275)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8275) [(#8227)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8227) [(#8279)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8279) [(#8288)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8288) [(#8311)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8311) [(#8313)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8313) [(#8360)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8360)\n\n`pennylane.estimator.estimate.estimate` 函数可用于不同细节级别的电路，以快速获得门数和额外线路的高层次估算。对于已经详细定义的工作流，例如可执行的 QNode，`pennylane.estimator.estimate.estimate` 函数的工作方式如下：\n\n```python\nimport pennylane as qml\nimport pennylane.estimator as qre\n\ndev = qml.device(\"null.qubit\")\n\n@qml.qnode(dev)\ndef circ():\n    for w in range(2):\n        qml.Hadamard(wires=w)\n    qml.CNOT(wires=[0,1])\n    qml.RX(1.23*np.pi, wires=0)\n    qml.RY(1.23*np.pi, wires=1)\n    qml.QFT(wires=[0, 1, 2])\n    return qml.state()\n```\n\n```pycon\n>>> res = qre.estimate(circ)()\n>>> print(res)\n--- 资源：---\n    总线路数：3\n    算法线路数：3\n    分配线路数：0\n      零态：0\n      任意态：0\n    总门数：408\n    'T'门：396\n    'CNOT'门：9\n    'Hadamard'门：3\n```\n\n如果算子的确切参数值及其他细节未知或不可用，`pennylane.estimator.estimate.estimate` 也可以用于 PennyLane 操作的轻量级表示形式，这些形式只需最少的信息即可获得高层次的估算。作为本次发布的一部分，PennyLane 中的许多操作现在都有对应的轻量级版本，它们继承自名为 `pennylane.estimator.resource_operator.ResourceOperator` 的新类，该类位于 `pennylane.estimator` 模块中。\n\n例如，`QFT` 的轻量级表示为 `qre.QFT`。只需指定其作用的线路数，我们便可以得到资源估算：\n\n```pycon\n>>> qft = qre.QFT(num_wires=3)\n>>> res = qre.estimate(qft)\n>>> print(res)\n--- 资源：---\n    总线路数：3\n","2025-10-15T18:03:44",{"id":198,"version":199,"summary_zh":200,"released_at":201},117198,"v0.42.3","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* 由于 `v0.8.0` 引入了破坏性变更，已在 `pyproject.toml` 中设置了 `autoray` 包的版本上限。\n  [(#8111)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8111)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本次发布包含以下贡献者（按字母顺序排列）：\n\n安德里亚·保雷维奇。","2025-08-20T20:06:01",{"id":203,"version":204,"summary_zh":205,"released_at":206},117199,"v0.42.2","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* 修复了在简化被提升为整数幂的算子时出现的递归错误。例如：\n\n  ```pycon\n  >>> class DummyOp(qml.operation.Operator):\n  ...     pass\n  >>> (DummyOp(0) ** 2).simplify()\n  DummyOp(0) @ DummyOp(0)\n  ```\n\n  之前，这会导致递归错误而失败。\n  [(#8061)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8061)\n  [(#8064)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F8064)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本版本的贡献者（按字母顺序排列）：\n\nChristina Lee,\nAndrija Paurevic。","2025-08-11T22:13:16",{"id":208,"version":209,"summary_zh":210,"released_at":211},117200,"v0.42.1","\u003Ch3>错误修复 🐛\u003C\u002Fh3>\n\n* 如果导入 PennyLane 时安装的 JAX 版本高于 0.6.2，将会引发警告。\n  [(#7949)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7949)\n\n\u003Ch3>贡献者 ✍️\u003C\u002Fh3>\n\n本次发布包含以下贡献者（按字母顺序排列）：\n\n安德里亚·保雷维奇。","2025-07-24T17:45:43",{"id":213,"version":214,"summary_zh":215,"released_at":216},117201,"v0.42.0","\u003Ch3>自上次发布以来的新功能\u003C\u002Fh3>\n\n\u003Ch4>最先进的模板与分解方法 🐝\u003C\u002Fh4>\n\n* 在 `Select` 中新增了一种基于[一元迭代](https:\u002F\u002Farxiv.org\u002Fpdf\u002F1805.03662)的分解方法。这种最先进的分解显著降低了 `T` 门的数量，并且仅需使用 $c-1$ 条辅助线，其中 $c$ 是 `Select` 算子的控制线数量。[(#7623)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7623) [(#7744)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7744) [(#7842)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7842)\n\n  一元迭代利用辅助线来存储中间值，以便在不同的多控门操作之间复用，从而避免不必要的重复计算，得到更高效的基门分解方案。该分解方法使用了一个名为 `TemporaryAND` 的模板，该模板也在本次发布中加入（参见下一条变更记录）。\n\n  当通过 `decomposition.enable_graph()` 启用基于图的分解系统时，`Select` 的这一分解规则即可使用：\n\n  ```python\n  import pennylane as qml\n  from functools import partial\n\n  qml.decomposition.enable_graph()\n  ```\n\n  为了展示这种新分解方法的资源效率，我们使用 `transforms.decompose` 将一个 `Select` 实例按照新的一元迭代分解规则进行分解，然后再将其进一步分解为 Clifford+T 门集，以便统计所需的 `T` 门数量：\n\n  ```python\n  reg = qml.registers({\"targ\": 2, \"control\": 2, \"work\": 1})\n  targ, control, work = (reg[k] for k in reg.keys())\n\n  dev = qml.device('default.qubit')\n  ops = [qml.X(targ[0]), qml.X(targ[1]), qml.Y(targ[0]), qml.SWAP(targ)]\n\n  @qml.clifford_t_decomposition\n  @partial(qml.transforms.decompose, gate_set={\n          qml.X, qml.CNOT, qml.TemporaryAND, \"Adjoint(TemporaryAND)\", \"CY\", \"CSWAP\"\n      }\n  )\n  @qml.qnode(dev)\n  def circuit():\n      qml.Select(ops, control=control, work_wires=work)\n      return qml.state()\n  ```\n\n  ```pycon\n  >>> unary_specs = qml.specs(circuit)()\n  >>> print(unary_specs['resources'].gate_types[\"T\"])\n  16\n  >>> print(unary_specs['resources'].gate_types[\"Adjoint(T)\"])\n  13\n  ```\n\n  更多信息请查看 `Select` 文档中的“一元迭代分解”章节！\n\n* 新增了一个名为 `TemporaryAND` 的模板。`TemporaryAND` 能够实现更高效的电路分解，例如 `Select` 模板的最新分解方案。[(#7472)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7472)\n\n  `TemporaryAND` 是一个三量子比特门，等价于逻辑 `AND` 运算（或可逆的 `Toffoli` 门）：它假设目标量子比特被初始化为 `|0〉` 态；而 `Adjoint(TemporaryAND)` 则假设目标量子比特最终会被输出为 `|0〉` 态。更多细节请参阅 [arXiv:1805.03662](https:\u002F\u002Farxi","2025-07-15T16:24:05",{"id":218,"version":219,"summary_zh":220,"released_at":221},117202,"v0.41.1","\u003Ch3>Bug fixes 🐛\u003C\u002Fh3>\r\n\r\n* A warning is raised if PennyLane is imported and a version of JAX greater than 0.4.28 is installed.\r\n  [(#7369)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7369)\r\n\r\n\u003Ch3>Contributors ✍️\u003C\u002Fh3>\r\n\r\nThis release contains contributions from (in alphabetical order):\r\n\r\nPietropaolo Frisoni","2025-05-02T20:01:44",{"id":223,"version":224,"summary_zh":225,"released_at":226},117203,"v0.41.0","\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Resource-efficient Decompositions 🔎\u003C\u002Fh4>\r\n\r\nA new, experimental graph-based decomposition system is now available in PennyLane, offering more resource-efficiency and versatility. [(#6950)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6950) [(#6951)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6951) [(#6952)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6952) [(#7028)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7028) [(#7045)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7045) [(#7058)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7058) [(#7064)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7064) [(#7149)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7149) [(#7184)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7184) [(#7223)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7223) [(#7263)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F7263)\r\n\r\nPennyLane's new experimental graph decomposition system offers a resource-efficient and versatile alternative  to the current system. This is done by traversing an internal graph structure that is weighted by the  resources (e.g., gate counts) required to decompose down to a given set of gates. \r\n\r\nThe graph-based system is experimental and is disabled by default, but it can be enabled by adding  `qml.decomposition.enable_graph()` to the top of your  program. Conversely, `qml.decomposition.disable_graph()`  disables the new system from being active.\r\n\r\nWith `qml.decomposition.enable_graph()`, the following  new features are available:\r\n\r\n* Operators in PennyLane can now accommodate multiple decompositions, which can be queried with the  new `qml.list_decomps` function:\r\n\r\n  ```pycon\r\n  >>> import pennylane as qml\r\n  >>> qml.decomposition.enable_graph()\r\n  >>> qml.list_decomps(qml.CRX)\r\n  [\u003Cpennylane.decomposition.decomposition_rule.DecompositionRule at 0x136da9de0>,\r\n    \u003Cpennylane.decomposition.decomposition_rule.DecompositionRule at 0x136da9db0>,\r\n    \u003Cpennylane.decomposition.decomposition_rule.DecompositionRule at 0x136da9f00>]\r\n  >>> decomp_rule = qml.list_decomps(qml.CRX)[0]\r\n  >>> print(decomp_rule, \"\\n\")\r\n  @register_resources(_crx_to_rx_cz_resources)\r\n  def _crx_to_rx_cz(phi: TensorLike, wires: WiresLike, **__):\r\n      qml.RX(phi \u002F 2, wires=wires[1])\r\n      qml.CZ(wires=wires)\r\n      qml.RX(-phi \u002F 2, wires=wires[1])\r\n      qml.CZ(wires=wires) \r\n\r\n  >>> print(qml.draw(decomp_rule)(0.5, wires=[0, 1]))\r\n  0: ───────────╭●────────────╭●─┤\r\n  1: ──RX(0.25)─╰Z──RX(-0.25)─╰Z─┤\r\n  ```\r\n\r\n  When an operator within a circuit needs to be decomposed (e.g., when  `qml.transforms.decompose` is present), the chosen decomposition rule is that which is most resource efficient (results in the smallest gate count).\r\n\r\n* New decomposition rules can be globally added to operators in PennyLane with the new  `qml.add_decomps` function. Creating a valid decomposition rule requires:\r\n\r\n  * Defining a quantum function that represents the decomposition.\r\n  * Adding resource requirements (gate counts) to the above quantum function by decorating it with the  new `qml.register_resources` function, which requires a dictionary  mapping operator types present in the quantum function to their number of occurrences.\r\n\r\n  ```python\r\n  qml.decomposition.enable_graph()\r\n\r\n  @qml.register_resources({qml.H: 2, qml.CZ: 1})\r\n  def my_cnot(wires):\r\n      qml.H(wires=wires[1])\r\n      qml.CZ(wires=wires)\r\n      qml.H(wires=wires[1])\r\n\r\n  qml.add_decomps(qml.CNOT, my_cnot)\r\n  ```\r\n\r\n  This newly added rule for `qml.CNOT` can be verified as being available to use:\r\n\r\n  ```pycon\r\n  >>> my_new_rule = qml.list_decomps(qml.CNOT)[-1]\r\n  >>> print(my_new_rule)\r\n  @qml.register_resources({qml.H: 2, qml.CZ: 1})\r\n  def my_cnot(wires):\r\n      qml.H(wires=wires[1])\r\n      qml.CZ(wires=wires)\r\n      qml.H(wires=wires[1])\r\n  ```\r\n\r\n  Operators with dynamic resource requirements must be declared in a resource estimate using the new `qml.resource_rep` function. For each operator class, the set of parameters  that affects the type of gates and their number of occurrences in its decompositions is given by the  `resource_keys` attribute.\r\n\r\n  ```pycon\r\n  >>> qml.MultiRZ.resource_keys\r\n  {'num_wires'}\r\n  ```\r\n\r\n  The output of `resource_keys` indicates that custom decompositions for the operator should be registered  to a resource function (as opposed to a static dictionary) that accepts those exact arguments and  returns a dictionary. Consider this dummy example of a fictitious decomposition rule comprising three  `qml.MultiRZ` gates:\r\n\r\n  ```python\r\n  qml.decomposition.enable_graph()\r\n\r\n  def resource_fn(num_wires):\r\n      return {\r\n          qml.resource_rep(qml.MultiRZ, num_wires=num_wires - 1): 1,\r\n          qml.resource_rep(qml.MultiRZ, num_wires=3): 2\r\n      }\r\n  \r\n  @qml.register_resources(resource_fn)\r\n  def my_decomp(theta, wires):\r\n      qml.MultiRZ(theta, wires=wires[:3])\r\n      qml.MultiRZ(theta, wires=wires[1:])\r\n      qml.MultiRZ(theta, wires=wires[:3])\r\n","2025-04-15T19:02:31",{"id":228,"version":229,"summary_zh":230,"released_at":231},117204,"v0.40.0","\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Efficient state preparation methods 🦾\u003C\u002Fh4>\r\n\r\n* State preparation tailored for matrix product states (MPS) is now supported with  :class:`qml.MPSPrep \u003Cpennylane.MPSPrep>` on the `lightning.tensor` device. [(#6431)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6431)\r\n\r\n  Given a list of $n$ tensors that represents an MPS, $[A^{(0)}, ..., A^{(n-1)}]$,  :class:`qml.MPSPrep \u003Cpennylane.MPSPrep>` lets you directly inject the MPS into a QNode as the initial  state of the circuit without any need for pre-processing. The first and last tensors in the list  must be rank-2, while all intermediate tensors should be rank-3.\r\n\r\n  ```python\r\n  import pennylane as qml\r\n  import numpy as np\r\n\r\n  mps = [\r\n      np.array([[0.0, 0.107], [0.994, 0.0]]),\r\n      np.array(\r\n          [\r\n              [[0.0, 0.0, 0.0, -0.0], [1.0, 0.0, 0.0, -0.0]],\r\n              [[0.0, 1.0, 0.0, -0.0], [0.0, 0.0, 0.0, -0.0]],\r\n          ]\r\n      ),\r\n      np.array(\r\n          [\r\n              [[-1.0, 0.0], [0.0, 0.0]],\r\n              [[0.0, 0.0], [0.0, 1.0]],\r\n              [[0.0, -1.0], [0.0, 0.0]],\r\n              [[0.0, 0.0], [1.0, 0.0]],\r\n          ]\r\n      ),\r\n      np.array([[-1.0, -0.0], [-0.0, -1.0]]),\r\n  ]\r\n\r\n  dev = qml.device(\"lightning.tensor\", wires = [0, 1, 2, 3])\r\n  @qml.qnode(dev)\r\n  def circuit():\r\n      qml.MPSPrep(mps, wires = [0,1,2])\r\n      return qml.state()\r\n  ```\r\n\r\n  ```pycon\r\n  >>> print(circuit())\r\n  [ 0.    +0.j  0.    +0.j  0.    +0.j -0.1066+0.j  0.    +0.j  0.    +0.j\r\n    0.    +0.j  0.    +0.j  0.    +0.j  0.    +0.j  0.    +0.j  0.    +0.j\r\n    0.9943+0.j  0.    +0.j  0.    +0.j  0.    +0.j]\r\n  ```\r\n\r\n  At this time, :class:`qml.MPSPrep \u003Cpennylane.MPSPrep>` is only supported on the `lightning.tensor` device.\r\n\r\n* Custom-made state preparation for linear combinations of quantum states is now available with  :class:`qml.Superposition \u003Cpennylane.Superposition>`. [(#6670)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6670)\r\n\r\n  Given a list of $m$ coefficients $c_i$ and basic states $|b_i\\rangle$,  :class:`qml.Superposition \u003Cpennylane.Superposition>` prepares  $|\\phi\\rangle = \\sum_i^m c_i |b_i\\rangle$. Here is a simple example showing how to use  :class:`qml.Superposition \u003Cpennylane.Superposition>` to prepare  $\\tfrac{1}{\\sqrt{2}} |00\\rangle + \\tfrac{1}{\\sqrt{2}} |10\\rangle$.\r\n\r\n  ```python\r\n  coeffs = np.array([0.70710678, 0.70710678])\r\n  basis =  np.array([[0, 0], [1, 0]])\r\n\r\n  @qml.qnode(qml.device('default.qubit'))\r\n  def circuit():\r\n      qml.Superposition(coeffs, basis, wires=[0, 1], work_wire=[2])\r\n      return qml.state()\r\n  ```\r\n\r\n  ```\r\n  >>> circuit()\r\n  Array([0.7071068 +0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j,\r\n         0.70710677+0.j, 0.        +0.j, 0.        +0.j, 0.        +0.j],      dtype=complex64)\r\n  ```\r\n\r\n  Note that specification of one `work_wire` is required.\r\n\r\n\u003Ch4>Enhanced QSVT functionality 🤩\u003C\u002Fh4>\r\n\r\n* New functionality to calculate and convert phase angles for QSP and QSVT has been added with :func:`qml.poly_to_angles \u003Cpennylane.poly_to_angles>` and  :func:`qml.transform_angles \u003Cpennylane.transform_angles>`. [(#6483)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6483)\r\n\r\n  The :func:`qml.poly_to_angles \u003Cpennylane.poly_to_angles>` function calculates phase angles  directly given polynomial coefficients and the routine in which the angles will be used (`\"QSVT\"`,  `\"QSP\"`, or `\"GQSP\"`): \r\n  ```pycon\r\n  >>> poly = [0, 1.0, 0, -1\u002F2, 0, 1\u002F3]\r\n  >>> qsvt_angles = qml.poly_to_angles(poly, \"QSVT\")\r\n  >>> print(qsvt_angles)\r\n  [-5.49778714  1.57079633  1.57079633  0.5833829   1.61095884  0.74753829]\r\n  ```\r\n\r\n  The :func:`qml.transform_angles \u003Cpennylane.transform_angles>` function can be used to convert  angles from one routine to another: \r\n  \r\n  ```pycon\r\n  >>> qsp_angles = np.array([0.2, 0.3, 0.5])\r\n  >>> qsvt_angles = qml.transform_angles(qsp_angles, \"QSP\", \"QSVT\")\r\n  >>> print(qsvt_angles)\r\n  [-6.86858347  1.87079633 -0.28539816]\r\n  ```\r\n\r\n* The :func:`qml.qsvt \u003Cpennylane.qsvt>` function has been improved to be more user-friendly, with enhanced capabilities. [(#6520)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6520) [(#6693)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6693)\r\n\r\n  Block encoding and phase angle computation are now handled automatically, given a matrix to encode, polynomial coefficients, and a block encoding method (`\"prepselprep\"`, `\"qubitization\"`, `\"embedding\"`, or `\"fable\"`, all implemented with their  corresponding operators in PennyLane). \r\n  ```python\r\n  # P(x) = -x + 0.5 x^3 + 0.5 x^5\r\n  poly = np.array([0, -1, 0, 0.5, 0, 0.5])\r\n  hamiltonian = qml.dot([0.3, 0.7], [qml.Z(1), qml.X(1) @ qml.Z(2)])\r\n  \r\n  dev = qml.device(\"default.qubit\")\r\n  @qml.qnode(dev)\r\n  def circuit():\r\n      qml.qsvt(hamiltonian, poly, encoding_wires=[0], block_encoding=\"prepselprep\")\r\n      return qml.state()\r\n  \r\n  matrix = qml.matrix(circuit, wire_order=[0, 1, 2])()\r\n  ``` \r\n  \r\n  ```pycon\r\n  >>> print(matrix[:4, :4].real)\r\n  [[-0","2025-01-14T20:40:00",{"id":233,"version":234,"summary_zh":235,"released_at":236},117205,"v0.39.0","\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Creating spin Hamiltonians on lattices 💞\u003C\u002Fh4>\r\n\r\n* Functionality for creating custom Hamiltonians on arbitrary lattices has been added. [(#6226)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6226) [(#6237)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6237)\r\n\r\n  Hamiltonians beyond the available boiler-plate ones in the `qml.spin` module can be created with the  addition of three new functions:\r\n\r\n  * `qml.spin.Lattice`: a new object for instantiating customized lattices via primitive translation vectors and unit cell parameters,\r\n  * `qml.spin.generate_lattice`: a utility function for creating standard `Lattice` objects, including `'chain'`, `'square'`, `'rectangle'`, `'triangle'`, `'honeycomb'`, `'kagome'`, `'lieb'`, `'cubic'`, `'bcc'`, `'fcc'`, and `'diamond'`,\r\n  * `qml.spin.spin_hamiltonian`: generates a spin `Hamiltonian` object given a `Lattice` object with custom edges\u002Fnodes.\r\n\r\n  An example is shown below for a $3 \\times 3$ triangular lattice with open boundary conditions.\r\n\r\n  ```python\r\n  lattice = qml.spin.Lattice(\r\n      n_cells=[3, 3],\r\n      vectors=[[1, 0], [np.cos(np.pi\u002F3), np.sin(np.pi\u002F3)]],\r\n      positions=[[0, 0]],\r\n      boundary_condition=False\r\n  )\r\n  ```\r\n\r\n  We can validate this `lattice` against `qml.spin.generate_lattice('triangle', ...)` by checking the  `lattice_points` (the $(x, y)$ coordinates of all sites in the lattice):\r\n\r\n  ```pycon\r\n  >>> lp = lattice.lattice_points\r\n  >>> triangular_lattice = qml.spin.generate_lattice('triangle', n_cells=[3, 3])\r\n  >>> np.allclose(lp, triangular_lattice.lattice_points)\r\n  True\r\n  ```\r\n\r\n  The `edges` of the `Lattice` object are nearest-neighbour by default, where we can add edges by using its `add_edge` method. \r\n\r\n  Optionally, a `Lattice` object can have interactions and fields endowed to it by specifying values  for its `custom_edges` and `custom_nodes` keyword arguments. The Hamiltonian can then be extracted with the `qml.spin.spin_hamiltonian` function. An example is shown below for the transverse-field  Ising model Hamiltonian on a $3 \\times 3$ triangular lattice. Note that the `custom_edges` and  `custom_nodes` keyword arguments only need to be defined for one unit cell repetition.\r\n\r\n  ```python\r\n  edges = [\r\n      (0, 1), (0, 3), (1, 3)\r\n  ]\r\n\r\n  lattice = qml.spin.Lattice(\r\n      n_cells=[3, 3],\r\n      vectors=[[1, 0], [np.cos(np.pi\u002F3), np.sin(np.pi\u002F3)]],\r\n      positions=[[0, 0]],\r\n      boundary_condition=False,\r\n      custom_edges=[[edge, (\"ZZ\", -1.0)] for edge in edges], \r\n      custom_nodes=[[i, (\"X\", -0.5)] for i in range(3*3)],\r\n  )\r\n  ```\r\n\r\n  ```pycon\r\n  >>> tfim_ham = qml.spin.transverse_ising('triangle', [3, 3], coupling=1.0, h=0.5)\r\n  >>> tfim_ham == qml.spin.spin_hamiltonian(lattice=lattice)\r\n  True\r\n  ```\r\n\r\n* More industry-standard spin Hamiltonians have been added in the `qml.spin` module. [(#6174)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6174) [(#6201)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6201)\r\n\r\n  Three new industry-standard spin Hamiltonians are now available with PennyLane v0.39:\r\n\r\n  * `qml.spin.emery` : the [Emery model](https:\u002F\u002Fjournals.aps.org\u002Fprl\u002Fabstract\u002F10.1103\u002FPhysRevLett.58.2794)\r\n  * `qml.spin.haldane` : the [Haldane model](https:\u002F\u002Fjournals.aps.org\u002Fprl\u002Fpdf\u002F10.1103\u002FPhysRevLett.61.2015)\r\n  * `qml.spin.kitaev` : the [Kitaev model](https:\u002F\u002Farxiv.org\u002Fabs\u002Fcond-mat\u002F0506438)\r\n\r\n  These additions accompany `qml.spin.heisenberg`, `qml.spin.transverse_ising`, and `qml.spin.fermi_hubbard`,  which were introduced in v0.38. \r\n\r\n\u003Ch4>Calculating Polynomials 🔢\u003C\u002Fh4>\r\n\r\n* Polynomial functions can now be easily encoded into quantum circuits with `qml.OutPoly`. [(#6320)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6320)\r\n\r\n  A new template called `qml.OutPoly` is available, which provides the ability to encode a polynomial function in a quantum circuit. Given a polynomial function $f(x_1, x_2, \\cdots, x_N)$, `qml.OutPoly`  requires:\r\n\r\n  * `f` : a standard Python function that represents $f(x_1, x_2, \\cdots, x_N)$,\r\n  * `input_registers` ($\\vert x_1 \\rangle$, $\\vert x_2 \\rangle$, ..., $\\vert x_N \\rangle$) : a list\u002Ftuple containing ``Wires`` objects that correspond to the embedded numeric values of $x_1, x_2, \\cdots, x_N$,\r\n  * `output_wires` : the `Wires` for which the numeric value of $f(x_1, x_2, \\cdots, x_N)$ is stored.\r\n\r\n  Here is an example of using `qml.OutPoly` to calculate $f(x_1, x_2) = 3x_1^2 - x_1x_2$ for $f(1, 2) = 1$.\r\n\r\n  ```python\r\n  wires = qml.registers({\"x1\": 1, \"x2\": 2, \"output\": 2})\r\n\r\n  def f(x1, x2):\r\n      return 3 * x1 ** 2 - x1 * x2\r\n\r\n  @qml.qnode(qml.device(\"default.qubit\", shots = 1))\r\n  def circuit():\r\n      # load values of x1 and x2\r\n      qml.BasisEmbedding(1, wires=wires[\"x1\"])\r\n      qml.BasisEmbedding(2, wires=wires[\"x2\"])\r\n\r\n      # apply the polynomial\r\n      qml.OutPoly(\r\n          f,\r\n          input_registers = [wires[\"x1\"], wires[\"x2\"]],\r\n          output_wires = wires[\"output\"])\r\n\r\n      return qml.sample(wi","2024-11-05T19:09:46",{"id":238,"version":239,"summary_zh":240,"released_at":241},117206,"v0.38.0","\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Registers of wires 🧸\u003C\u002Fh4>\r\n\r\n* A new function called `qml.registers` has been added that lets you seamlessly create registers of  wires. [(#5957)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5957) [(#6102)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6102)\r\n\r\n  Using registers, it is easier to build large algorithms and circuits by applying gates and operations  to predefined collections of wires. With `qml.registers`, you can create registers of wires by providing  a dictionary whose keys are register names and whose values are the number of wires in each register.\r\n\r\n  ```python\r\n  >>> wire_reg = qml.registers({\"alice\": 4, \"bob\": 3})\r\n  >>> wire_reg\r\n  {'alice': Wires([0, 1, 2, 3]), 'bob': Wires([4, 5, 6])}\r\n  ```\r\n\r\n  The resulting data structure of `qml.registers` is a dictionary with the same register names as keys,  but the values are `qml.wires.Wires` instances.\r\n\r\n  Nesting registers within other registers can be done by providing a nested dictionary, where the ordering  of wire labels is based on the order of appearance and nestedness.\r\n\r\n  ```python\r\n  >>> wire_reg = qml.registers({\"alice\": {\"alice1\": 1, \"alice2\": 2}, \"bob\": {\"bob1\": 2, \"bob2\": 1}})\r\n  >>> wire_reg\r\n  {'alice1': Wires([0]), 'alice2': Wires([1, 2]), 'alice': Wires([0, 1, 2]), 'bob1': Wires([3, 4]), 'bob2': Wires([5]), 'bob': Wires([3, 4, 5])}\r\n  ```\r\n\r\n  Since the values of the dictionary are `Wires` instances, their use within quantum circuits is very  similar to that of a `list` of integers.\r\n\r\n  ```python\r\n  dev = qml.device(\"default.qubit\")\r\n\r\n  @qml.qnode(dev)\r\n  def circuit():\r\n      for w in wire_reg[\"alice\"]:\r\n          qml.Hadamard(w)\r\n\r\n      for w in wire_reg[\"bob1\"]:\r\n          qml.RX(0.1967, wires=w)\r\n\r\n      qml.CNOT(wires=[wire_reg[\"alice1\"][0], wire_reg[\"bob2\"][0]])\r\n\r\n      return [qml.expval(qml.Y(w)) for w in wire_reg[\"bob1\"]]\r\n\r\n  print(qml.draw(circuit)())\r\n  ```\r\n\r\n  ```pycon\r\n  0: ──H────────╭●─┤     \r\n  1: ──H────────│──┤     \r\n  2: ──H────────│──┤     \r\n  3: ──RX(0.20)─│──┤  \u003CY>\r\n  4: ──RX(0.20)─│──┤  \u003CY>\r\n  5: ───────────╰X─┤  \r\n  ```\r\n\r\n  In tandem with `qml.registers`, we've also made the following improvements to `qml.wires.Wires`:\r\n\r\n  * `Wires` instances now have a more copy-paste friendly representation when printed. [(#5958)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5958)\r\n\r\n    ```python\r\n    >>> from pennylane.wires import Wires\r\n    >>> w = Wires([1, 2, 3])\r\n    >>> w\r\n    Wires([1, 2, 3])\r\n    ```\r\n\r\n  * Python set-based combinations are now supported by `Wires`. [(#5983)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5983)\r\n\r\n    This new feature unlocks the ability to combine `Wires` instances in the following ways:\r\n\r\n    * intersection with `&` or `intersection()`:\r\n\r\n      ```python\r\n      >>> wires1 = Wires([1, 2, 3])\r\n      >>> wires2 = Wires([2, 3, 4])\r\n      >>> wires1.intersection(wires2) # or wires1 & wires2\r\n      Wires([2, 3])\r\n      ```\r\n\r\n    * symmetric difference with `^` or `symmetric_difference()`:\r\n\r\n      ```python\r\n      >>> wires1.symmetric_difference(wires2) # or wires1 ^ wires2\r\n      Wires([1, 4])\r\n      ```\r\n\r\n    * union with `|` or `union()`:\r\n\r\n      ```python\r\n      >>> wires1.union(wires2) # or wires1 | wires2\r\n      Wires([1, 2, 3, 4])\r\n      ```\r\n\r\n    * difference with `-` or `difference()`:\r\n\r\n      ```python\r\n      >>> wires1.difference(wires2) # or wires1 - wires2\r\n      Wires([1])\r\n      ```\r\n\r\n\u003Ch4>Quantum arithmetic operations 🧮\u003C\u002Fh4>\r\n\r\n* Several new operator templates have been added to PennyLane that let you perform quantum arithmetic  operations. [(#6109)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6109) [(#6112)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6112) [(#6121)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F6121)\r\n\r\n  * `qml.Adder` performs in-place modular addition:  $\\text{Adder}(k, m)\\vert x \\rangle = \\vert x + k \\; \\text{mod} \\; m\\rangle$. \r\n\r\n  * `qml.PhaseAdder` is similar to `qml.Adder`, but it performs in-place modular addition in the Fourier  basis. \r\n\r\n  * `qml.Multiplier` performs in-place multiplication:  $\\text{Multiplier}(k, m)\\vert x \\rangle = \\vert x \\times k \\; \\text{mod} \\; m \\rangle$.\r\n\r\n  * `qml.OutAdder` performs out-place modular addition: $\\text{OutAdder}(m)\\vert x \\rangle \\vert y \\rangle \\vert b \\rangle = \\vert x \\rangle \\vert y \\rangle \\vert b + x + y \\; \\text{mod} \\; m \\rangle$.\r\n\r\n  * `qml.OutMultiplier` performs out-place modular multiplication:  $\\text{OutMultiplier}(m)\\vert x \\rangle \\vert y \\rangle \\vert b \\rangle = \\vert x \\rangle \\vert y \\rangle \\vert b + x \\times y \\; \\text{mod} \\; m \\rangle$.\r\n\r\n  * `qml.ModExp` performs modular exponentiation:  $\\text{ModExp}(base, m) \\vert x \\rangle \\vert k \\rangle = \\vert x \\rangle \\vert k \\times base^x \\; \\text{mod} \\; m \\rangle$.\r\n\r\n  Here is a comprehensive example that performs the following calculation: `(2 + 1) * 3 mod 7 = 2` (or  `010` in binary).\r\n\r\n  ```python\r\n  dev = qml.device(\"default.qubit\", shots","2024-09-03T22:39:43",{"id":243,"version":244,"summary_zh":245,"released_at":246},117207,"v0.37.0","# Release 0.37.0\r\n\r\n\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Execute wide circuits with Default Tensor 🔗\u003C\u002Fh4>\r\n\r\n* A new `default.tensor` device is now available for performing [tensor network](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FTensor_network) and [matrix product state](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMatrix_product_state) simulations of quantum circuits using the [quimb backend](https:\u002F\u002Fquimb.readthedocs.io\u002Fen\u002Flatest\u002F). [(#5699)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5699) [(#5744)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5744) [(#5786)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5786) [(#5795)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5795)\r\n\r\n  Either method can be selected when instantiating the `default.tensor` device by setting the `method` keyword argument to `\"tn\"` (tensor network) or `\"mps\"` (matrix product state).\r\n  \r\n  There are [several templates in PennyLane](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Ftemplates.html#tensor-networks) that are tensor-network focused, which are excellent candidates for the `\"tn\"` method for `default.tensor`. The following example shows how a circuit comprising gates in a tree tensor network architecture can be efficiently simulated using `method=\"tn\"`.\r\n\r\n  ```python\r\n  import pennylane as qml\r\n\r\n  n_wires = 16\r\n  dev = qml.device(\"default.tensor\", method=\"tn\")\r\n\r\n  def block(weights, wires):\r\n      qml.CNOT(wires=[wires[0], wires[1]])\r\n      qml.RY(weights[0], wires=wires[0])\r\n      qml.RY(weights[1], wires=wires[1])\r\n\r\n  n_block_wires = 2\r\n  n_params_block = 2\r\n  n_blocks = qml.TTN.get_n_blocks(range(n_wires), n_block_wires)\r\n  template_weights = [[0.1, -0.3]] * n_blocks\r\n\r\n  @qml.qnode(dev)\r\n  def circuit(template_weights):\r\n      for i in range(n_wires):\r\n          qml.Hadamard(i)\r\n      qml.TTN(range(n_wires), n_block_wires, block, n_params_block, template_weights)\r\n      return qml.expval(qml.Z(n_wires - 1))\r\n  ```\r\n\r\n  ```pycon\r\n  >>> circuit(template_weights)\r\n  0.3839174759751649\r\n  ```\r\n\r\n  For matrix product state simulations (`method=\"mps\"`), we can make the execution be approximate by setting `max_bond_dim` (see the [device's documentation](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fcode\u002Fapi\u002Fpennylane.devices.default_tensor.DefaultTensor.html) for more details). The maximum bond dimension has implications for the speed of the simulation and lets us control the degree of the approximation, as shown in the following example. First, set up the circuit:\r\n\r\n  ```python \r\n  import numpy as np\r\n\r\n  n_layers = 10 \r\n  n_wires = 10\r\n  initial_shape, weights_shape = qml.SimplifiedTwoDesign.shape(n_layers, n_wires) \r\n  np.random.seed(1967) \r\n  initial_layer_weights = np.random.random(initial_shape) \r\n  weights = np.random.random(weights_shape)\r\n\r\n  def f(): \r\n      qml.SimplifiedTwoDesign(initial_layer_weights, weights, range(n_wires)) \r\n      return qml.expval(qml.Z(0)) \r\n  ```\r\n\r\n  The `default.tensor` device is instantiated with a `max_bond_dim` value:\r\n\r\n  ```python \r\n  dev_dq = qml.device(\"default.qubit\") \r\n  value_dq = qml.QNode(f, dev_dq)()\r\n\r\n  dev_mps = qml.device(\"default.tensor\", max_bond_dim=5) \r\n  value_mps = qml.QNode(f, dev_mps)() \r\n  ```\r\n\r\n  With this bond dimension, the expectation values calculated for `default.qubit` and `default.tensor` are different:\r\n\r\n  ```pycon \r\n  >>> np.abs(value_dq - value_mps) \r\n  tensor(0.0253213, requires_grad=True) \r\n  ```\r\n\r\n  Learn more about `default.tensor` and how to configure it by [visiting the how-to guide](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemos\u002Ftutorial_How_to_simulate_quantum_circuits_with_tensor_networks\u002F).\r\n\r\n\u003Ch4>Add noise models to your quantum circuits 📺\u003C\u002Fh4>\r\n\r\n* Support for building noise models and applying them to a quantum circuit has been added via the `NoiseModel` class and an `add_noise` transform. [(#5674)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5674) [(#5684)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5684) [(#5718)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5718)\r\n\r\n  Under the hood, PennyLane's approach to noise models is insertion-based, meaning that noise is included by *inserting* additional operators (gates or channels) that describe the noise into the quantum circuit. Creating a `NoiseModel` boils down to defining Boolean conditions under which specific noisy operations are inserted. There are several ways to specify conditions for adding noisy operations:\r\n\r\n  * `qml.noise.op_eq(op)`: if the operator `op` is encountered in the circuit, add noise. \r\n  * `qml.noise.op_in(ops)`: if any operators in `ops` are encountered in the circuit, add noise. \r\n  * `qml.noise.wires_eq(wires)`: if an operator is applied to `wires`, add noise. \r\n  * `qml.noise.wires_in(wires)`: if an operator is applied to any wire in `wires`, add noise. \r\n  * custom noise conditions: custom conditions can be defined as functions decorated with `qml.BooleanFn` that return a Boolean value. For example, the following function will insert noise if a `qml.RY` operator is encountered with an a","2024-07-08T22:37:35",{"id":248,"version":249,"summary_zh":250,"released_at":251},117208,"v0.36.0","# Release 0.36.0\r\n\r\n\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Estimate errors in a quantum circuit 🧮\u003C\u002Fh4>\r\n\r\n * This version of PennyLane lays the foundation for estimating the total error in a quantum circuit from the combination of individual gate errors. [(#5154)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5154) [(#5464)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5464) [(#5465)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5465) [(#5278)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5278) [(#5384)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5384)\r\n\r\n Two new user-facing classes enable calculating and propagating gate errors in PennyLane:\r\n\r\n * `qml.resource.SpectralNormError`: the spectral norm error is defined as the distance, in [spectral norm](https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FMatrix_norm), between the true unitary we intend to apply and the approximate unitary that is actually applied.\r\n\r\n * `qml.resource.ErrorOperation`: a base class that inherits from `qml.operation.Operation` and represents quantum operations which carry some form of algorithmic error.\r\n\r\n   `SpectralNormError` can be used for back-of-the-envelope type calculations like obtaining the spectral norm error between two unitaries via `get_error`:\r\n  \r\n   ```python \r\n   import pennylane as qml \r\n   from pennylane.resource import ErrorOperation, SpectralNormError\r\n  \r\n   intended_op = qml.RY(0.40, 0) \r\n   actual_op = qml.RY(0.41, 0) # angle of rotation is slightly off\r\n   ``` \r\n   ```pycon \r\n   >>> SpectralNormError.get_error(intended_op, actual_op) \r\n   0.004999994791668309 \r\n   ``` \r\n  \r\n   `SpectralNormError` is also a key tool to specify errors in larger quantum circuits:\r\n\r\n * For operations representing a major building block of an algorithm, we can create a custom operation that inherits from `ErrorOperation`. This child class must override the `error` method and should return a `SpectralNormError` instance:\r\n\r\n   ```python \r\n   class MyErrorOperation(ErrorOperation):\r\n      \r\n      def __init__(self, error_val, wires): \r\n          self.error_val = error_val \r\n          super().__init__(wires=wires)\r\n  \r\n      def error(self): \r\n          return SpectralNormError(self.error_val)\r\n   ```\r\n\r\n    In this toy example, `MyErrorOperation` introduces an arbitrary `SpectralNormError` when called in a QNode. It does not require a decomposition or matrix representation when used with `null.qubit` (suggested for use with resource and error estimation since circuit executions are not required to calculate resources or errors). \r\n  \r\n   ```python \r\n   dev = qml.device(\"null.qubit\")\r\n  \r\n   @qml.qnode(dev) \r\n   def circuit(): \r\n      MyErrorOperation(0.1, wires=0) \r\n      MyErrorOperation(0.2, wires=1) \r\n      return qml.state() \r\n   ```\r\n\r\n   The total spectral norm error of the circuit can be calculated using `qml.specs`:\r\n  \r\n   ```pycon \r\n   >>> qml.specs(circuit)()['errors'] \r\n   {'SpectralNormError': SpectralNormError(0.30000000000000004)} \r\n   ```\r\n\r\n * PennyLane already includes a number of built-in building blocks for algorithms like `QuantumPhaseEstimation` and `TrotterProduct`. `TrotterProduct` now propagates errors based on the number of steps performed in the Trotter product. `QuantumPhaseEstimation` now propagates errors based on the error of its input unitary.\r\n\r\n   ```python\r\n   dev = qml.device('null.qubit') \r\n   hamiltonian = qml.dot([1.0, 0.5, -0.25], [qml.X(0), qml.Y(0), qml.Z(0)])\r\n  \r\n   @qml.qnode(dev) \r\n   def circuit(): \r\n      qml.TrotterProduct(hamiltonian, time=0.1, order=2) \r\n      qml.QuantumPhaseEstimation(MyErrorOperation(0.01, wires=0), estimation_wires=[1, 2, 3]) \r\n      return qml.state()\r\n   ```\r\n  \r\n   Again, the total spectral norm error of the circuit can be calculated using `qml.specs`:\r\n  \r\n   ```pycon\r\n   >>> qml.specs(circuit)()[\"errors\"] \r\n   {'SpectralNormError': SpectralNormError(0.07616666666666666)} \r\n   ```\r\n  \r\n   Check out our [error propagation demo](https:\u002F\u002Fpennylane.ai\u002Fqml\u002Fdemos\u002Ftutorial_error_prop\u002F) to see how to use these new features in a real-world example!\r\n\r\n\u003Ch4>Access an extended arsenal of quantum algorithms 🏹\u003C\u002Fh4>\r\n\r\n* The Fast Approximate BLock-Encodings (FABLE) algorithm for embedding a matrix into a quantum circuit as outlined in [arXiv:2205.00081](https:\u002F\u002Farxiv.org\u002Fabs\u002F2205.00081) is now accessible via the `qml.FABLE` template. [(#5107)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5107)\r\n\r\n   The usage of `qml.FABLE` is similar to `qml.BlockEncode` but provides a more efficient circuit construction at the cost of a user-defined approximation level, `tol`. The number of wires that `qml.FABLE` operates on is `2*n + 1`, where `n` defines the dimension of the $2^n \\times 2^n$ matrix that we want to block-encode.\r\n  \r\n   ```python \r\n   import numpy as np\r\n  \r\n   A = np.array([[0.1, 0.2], [0.3, 0.4]]) \r\n   dev = qml.device('default.qubit', wires=3)\r\n  \r\n   @qml.qnode(dev) \r\n   def circuit(): \r\n      qml.FABLE(A, tol = 0.001, wires=range(3)) \r\n      return qml.state() \r","2024-05-06T22:02:48",{"id":253,"version":254,"summary_zh":255,"released_at":256},117209,"v0.35.1","\u003Ch3>Bug fixes 🐛\u003C\u002Fh3>\r\n\r\n* Lightning simulators need special handling of diagonalizing gates when performing sampling measurements. [(#5343)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5343)\r\n\r\n* Updated the lower bound on the required Catalyst version to `v0.5.0`. [(#5320)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5320)\r\n\r\n\u003Ch3>Contributors ✍️\u003C\u002Fh3>\r\n\r\nThis release contains contributions from (in alphabetical order):\r\n\r\nVincent Michaud-Rioux, Erick Ochoa Lopez.","2024-03-11T21:09:24",{"id":258,"version":259,"summary_zh":260,"released_at":261},117210,"v0.35.0","\u003Ch3>New features since last release\u003C\u002Fh3>\r\n\r\n\u003Ch4>Qiskit 1.0 integration 🔌\u003C\u002Fh4>\r\n\r\n* This version of PennyLane makes it easier to import circuits from Qiskit. [(#5218)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5218) [(#5168)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5168)\r\n\r\n  The `qml.from_qiskit` function converts a Qiskit [QuantumCircuit](https:\u002F\u002Fdocs.quantum.ibm.com\u002Fapi\u002Fqiskit\u002Fqiskit.circuit.QuantumCircuit) into a PennyLane [quantum function](https:\u002F\u002Fdocs.pennylane.ai\u002Fen\u002Fstable\u002Fintroduction\u002Fcircuits.html#quantum-functions). Although `qml.from_qiskit` already exists in PennyLane, we have made a number of improvements to make importing from Qiskit easier. And yes — `qml.from_qiskit` functionality is compatible with both Qiskit [1.0](https:\u002F\u002Fdocs.quantum.ibm.com\u002Fapi\u002Fqiskit\u002Frelease-notes\u002F1.0) and earlier versions! Here's a comprehensive list of the improvements:\r\n\r\n  * You can now append PennyLane measurements onto the quantum function returned by `qml.from_qiskit`. Consider this simple Qiskit circuit:\r\n\r\n    ```python \r\n    import pennylane as qml \r\n    from qiskit import QuantumCircuit\r\n\r\n    qc = QuantumCircuit(2) \r\n    qc.rx(0.785, 0) \r\n    qc.ry(1.57, 1) \r\n    ```\r\n\r\n    We can convert it into a PennyLane QNode in just a few lines, with PennyLane `measurements` easily included:\r\n\r\n    ```pycon \r\n    >>> dev = qml.device(\"default.qubit\") \r\n    >>> measurements = qml.expval(qml.Z(0) @ qml.Z(1)) \r\n    >>> qfunc = qml.from_qiskit(qc, measurements=measurements) \r\n    >>> qnode = qml.QNode(qfunc, dev) \r\n    >>> qnode() \r\n    tensor(0.00056331, requires_grad=True) \r\n    ```\r\n\r\n  * Quantum circuits that already contain Qiskit-side measurements can be faithfully converted with `qml.from_qiskit`. Consider this example Qiskit circuit:\r\n\r\n    ```python \r\n    qc = QuantumCircuit(3, 2) # Teleportation\r\n \r\n    qc.rx(0.9, 0) # Prepare input state on qubit 0\r\n\r\n    qc.h(1) # Prepare Bell state on qubits 1 and 2 qc.cx(1, 2)\r\n\r\n    qc.cx(0, 1) # Perform teleportation \r\n    qc.h(0) \r\n    qc.measure(0, 0) \r\n    qc.measure(1, 1)\r\n\r\n    with qc.if_test((1, 1)): # Perform first conditional \r\n        qc.x(2) \r\n    ```\r\n \r\n    This circuit can be converted into PennyLane with the Qiskit measurements still accessible. For example, we can use those results as inputs to a mid-circuit measurement in PennyLane:\r\n\r\n    ```python \r\n    @qml.qnode(dev) \r\n    def teleport(): \r\n        m0, m1 = qml.from_qiskit(qc)() \r\n        qml.cond(m0, qml.Z)(2) \r\n        return qml.density_matrix(2) \r\n    ```\r\n\r\n    ```pycon \r\n    >>> teleport() \r\n    tensor([[0.81080498+0.j , 0. +0.39166345j], \r\n    [0. -0.39166345j, 0.18919502+0.j ]], requires_grad=True) \r\n    ```\r\n\r\n  * It is now more intuitive to handle and differentiate parametrized Qiskit circuits. Consider the following circuit:\r\n\r\n    ```python \r\n    from qiskit.circuit import Parameter \r\n    from pennylane import numpy as np\r\n\r\n    angle0 = Parameter(\"x\") angle1 = Parameter(\"y\")\r\n\r\n    qc = QuantumCircuit(2, 2) \r\n    qc.rx(angle0, 0) \r\n    qc.ry(angle1, 1) \r\n    qc.cx(1, 0) \r\n    ```\r\n\r\n    We can convert this circuit into a QNode with two arguments, corresponding to `x` and `y`:\r\n\r\n    ```python \r\n    measurements = qml.expval(qml.PauliZ(0)) \r\n    qfunc = qml.from_qiskit(qc, measurements) \r\n    qnode = qml.QNode(qfunc, dev) \r\n    ```\r\n\r\n    The QNode can be evaluated and differentiated:\r\n\r\n    ```pycon \r\n    >>> x, y = np.array([0.4, 0.5], requires_grad=True) \r\n    >>> qnode(x, y) \r\n    tensor(0.80830707, requires_grad=True) \r\n  \r\n    >>> qml.grad(qnode)(x, y) \r\n    (tensor(-0.34174675, requires_grad=True), tensor(-0.44158016, requires_grad=True)) \r\n    ```\r\n\r\n    This shows how easy it is to make a Qiskit circuit differentiable with PennyLane.\r\n\r\n  * In addition to circuits, it is also possible to convert operators from Qiskit to PennyLane with a new function called `qml.from_qiskit_op`. [(#5251)](https:\u002F\u002Fgithub.com\u002FPennyLaneAI\u002Fpennylane\u002Fpull\u002F5251)\r\n\r\n    A Qiskit [SparsePauliOp](https:\u002F\u002Fdocs.quantum.ibm.com\u002Fapi\u002Fqiskit\u002Fqiskit.quantum_info.SparsePauliOp) can be converted to a PennyLane operator using `qml.from_qiskit_op`:\r\n\r\n    ```pycon \r\n    >>> from qiskit.quantum_info import SparsePauliOp \r\n    >>> qiskit_op = SparsePauliOp([\"II\", \"XY\"]) \r\n    >>> qiskit_op SparsePauliOp(['II', 'XY'], coeffs=[1.+0.j, 1.+0.j]) \r\n    >>> pl_op = qml.from_qiskit_op(qiskit_op) \r\n    >>> pl_op I(0) + X(1) @ Y(0) \r\n    ```\r\n\r\n    Combined with `qml.from_qiskit`, it becomes easy to quickly calculate quantities like expectation values by converting the whole workflow to PennyLane:\r\n\r\n    ```python \r\n    qc = QuantumCircuit(2) # Create circuit \r\n    qc.rx(0.785, 0) \r\n    qc.ry(1.57, 1)\r\n\r\n    measurements = qml.expval(pl_op) # Create QNode \r\n    qfunc = qml.from_qiskit(qc, measurements) \r\n    qnode = qml.QNode(qfunc, dev) \r\n    ```\r\n\r\n    ```pycon \r\n    >>> qnode() # Evaluate! \r\n    tensor(0.29317504, requires_grad=True) \r\n    ```\r\n\r\n\u003Ch4>Native mid-circuit measurements on Default Qubit 💡\u003C\u002Fh4>\r\n\r\n* Mid-ci","2024-03-04T20:25:01",{"id":263,"version":264,"summary_zh":265,"released_at":266},117211,"v0.34.0.post1","This postfix release pins additional requirements in `doc\u002Frequirements.txt` for building the website documentation. This allows the website to be rebuilt to show the \"Getting involved\" section.","2024-01-22T17:04:21"]