Skip to content
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

add vector sdk #431

Merged

Conversation

jairad26
Copy link
Member

@jairad26 jairad26 commented Oct 7, 2024

Vectors Package

This pull request introduces the vectors sdk class for both assemblyscript and golang

Key Features

  • Basic Arithmetic: Functions to add, subtract, multiply, and divide vectors, as well as operations with scalar values.
  • Dot Product and Magnitude: Computation of the dot product between two vectors and determination of a vector's magnitude.
  • Normalization and Distance: Capabilities to normalize vectors and calculate Euclidean distances.
  • Aggregations: Functions to compute the sum, product, minimum, and maximum of vector elements.
  • Utilities: Additional features such as absolute value computation and input validation.

List of Functions

  1. Add(a, b): Adds two vectors.
  2. AddInPlace(a, b): Adds two vectors, storing the result in the first vector.
  3. Subtract(a, b): Subtracts vector b from vector a.
  4. SubtractInPlace(a, b): Subtracts vector b from vector a, storing the result in vector a.
  5. AddNumber(a, b): Adds a scalar number b to each element of vector a.
  6. AddNumberInPlace(a, b): Adds a scalar number b to each element of vector a, in place.
  7. SubtractNumber(a, b): Subtracts a scalar number b from each element of vector a.
  8. SubtractNumberInPlace(a, b): Subtracts a scalar number b from each element of vector a, in place.
  9. MultiplyNumber(a, b): Multiplies each element of vector a by a scalar number b.
  10. MultiplyNumberInPlace(a, b): Multiplies each element of vector a by a scalar number b, in place.
  11. DivideNumber(a, b): Divides each element of vector a by a scalar number b.
  12. DivideNumberInPlace(a, b): Divides each element of vector a by a scalar number b, in place.
  13. Dot(a, b): Computes the dot product of vectors a and b.
  14. Magnitude(a): Computes the magnitude of vector a.
  15. Normalize(a): Normalizes vector a to have a magnitude of 1.
  16. Sum(a): Computes the sum of all elements in vector a.
  17. Product(a): Computes the product of all elements in vector a.
  18. Mean(a): Computes the mean of all elements in vector a.
  19. Min(a): Finds the minimum element in vector a.
  20. Max(a): Finds the maximum element in vector a.
  21. Abs(a): Computes the absolute value of each element in vector a.
  22. AbsInPlace(a): Computes the absolute value of each element in vector a, in place.
  23. EuclidianDistance(a, b): Computes the Euclidean distance between vectors a and b.

Usage

To utilize these functions, import the vectors package into your project and invoke the desired functions with appropriate numerical arguments.

Copy link

linear bot commented Oct 7, 2024

@jairad26 jairad26 changed the title add vector class to assemblyscript sdk add vector sdk Oct 8, 2024
@jairad26 jairad26 marked this pull request as ready for review October 8, 2024 02:31
@jairad26 jairad26 requested a review from a team as a code owner October 8, 2024 02:31
@jairad26 jairad26 enabled auto-merge (squash) October 8, 2024 02:36
@jairad26 jairad26 merged commit 1054e1c into main Oct 8, 2024
75 checks passed
@jairad26 jairad26 deleted the jai/hyp-2276-add-vectors-class-with-helper-functions-in-sdks branch October 8, 2024 17:33
@mattjohnsonpint mattjohnsonpint added this to the v0.13.0 milestone Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants