Skip to content

Implement various convenience methods for System.Numerics types #115457

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tannergooding
Copy link
Member

This resolves #103464

@Copilot Copilot AI review requested due to automatic review settings May 12, 2025 00:42
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR exposes several convenience methods for System.Numerics types by promoting internal conversion and transformation routines to public APIs. Key changes include making methods such as AsPlane, AsQuaternion, CreateScalar, and various Transform overloads public, along with adding new extension methods and updating related tests.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs Added new public conversion methods (AsPlane, AsQuaternion) on Vector128.
src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.Numerics.cs Updated accessibility of conversion methods from internal to public.
src/libraries/System.Private.CoreLib/src/System/Numerics/* Exposed convenience methods (CreateScalar, Transform, etc.) for Vector2, Vector3, Vector4, Plane, Quaternion and updated overloads accordingly.
src/libraries/System.Numerics.Vectors/tests/* Added tests to cover the new public API methods.
src/libraries/System.Numerics.Vectors/ref/System.Numerics.Vectors.cs Updated public API surface reflecting the new methods and indexers.
Comments suppressed due to low confidence (2)

src/libraries/System.Numerics.Vectors/ref/System.Numerics.Vectors.cs:26

  • Ensure that the newly exposed public indexers and convenience methods are accompanied by complete and updated documentation in the official API docs. This will help consumers understand the intended usage of the new methods.
public System.Numerics.Vector2 this[int row, int column] { readonly get { throw null; } set { throw null; } }

src/libraries/System.Private.CoreLib/src/System/Numerics/Vector4.cs:970

  • Passing Matrix4x4 by value instead of using an 'in' parameter may introduce additional copying overhead compared to the previous pattern. Please confirm that this design change has been benchmarked and is acceptable regarding performance.
public static Vector4 Transform(Vector2 position, Matrix4x4 matrix)

Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-numerics
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API Proposal]: Create and convenience APIs for System.Numerics types
1 participant