-
Notifications
You must be signed in to change notification settings - Fork 16
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
jairad26
merged 17 commits into
main
from
jai/hyp-2276-add-vectors-class-with-helper-functions-in-sdks
Oct 8, 2024
Merged
add vector sdk #431
jairad26
merged 17 commits into
main
from
jai/hyp-2276-add-vectors-class-with-helper-functions-in-sdks
Oct 8, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mattjohnsonpint
approved these changes
Oct 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Vectors Package
This pull request introduces the
vectors
sdk class for both assemblyscript and golangKey Features
List of Functions
Add(a, b)
: Adds two vectors.AddInPlace(a, b)
: Adds two vectors, storing the result in the first vector.Subtract(a, b)
: Subtracts vector b from vector a.SubtractInPlace(a, b)
: Subtracts vector b from vector a, storing the result in vector a.AddNumber(a, b)
: Adds a scalar number b to each element of vector a.AddNumberInPlace(a, b)
: Adds a scalar number b to each element of vector a, in place.SubtractNumber(a, b)
: Subtracts a scalar number b from each element of vector a.SubtractNumberInPlace(a, b)
: Subtracts a scalar number b from each element of vector a, in place.MultiplyNumber(a, b)
: Multiplies each element of vector a by a scalar number b.MultiplyNumberInPlace(a, b)
: Multiplies each element of vector a by a scalar number b, in place.DivideNumber(a, b)
: Divides each element of vector a by a scalar number b.DivideNumberInPlace(a, b)
: Divides each element of vector a by a scalar number b, in place.Dot(a, b)
: Computes the dot product of vectors a and b.Magnitude(a)
: Computes the magnitude of vector a.Normalize(a)
: Normalizes vector a to have a magnitude of 1.Sum(a)
: Computes the sum of all elements in vector a.Product(a)
: Computes the product of all elements in vector a.Mean(a)
: Computes the mean of all elements in vector a.Min(a)
: Finds the minimum element in vector a.Max(a)
: Finds the maximum element in vector a.Abs(a)
: Computes the absolute value of each element in vector a.AbsInPlace(a)
: Computes the absolute value of each element in vector a, in place.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.