Skip to content

Instantly share code, notes, and snippets.

@vthacker
Created May 21, 2023 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vthacker/4c1b3e1cbd20d43856cffba894794192 to your computer and use it in GitHub Desktop.
Save vthacker/4c1b3e1cbd20d43856cffba894794192 to your computer and use it in GitHub Desktop.
public static void main(String args[]) {
Jep338FullMaskVectorOperations test = new Jep338FullMaskVectorOperations();
float[] a = new float[]{1.0f, 2.0f, 2.0f, 1.0f, 1.0f, 1.0f, 1.0f};
float[] b = new float[]{3.0f, 4.0f, 8.0f, 9.9f, 1.0f, 1.0f, 1.0f};
// this returns NaN
// That's because "int bound = species.loopBound(v1.length);" returns 0 when length <=7 on my macbook pro
// which means the for loop is never executed.
// I think in this example we'd need to change the for loop to be v1.length?
System.out.println(test.cosineSimilarity(a,b));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment