79837618

Date: 2025-12-04 07:14:48
Score: 1
Natty:
Report link

Fixed it by using float[] type as per documentation and making sure there is a getter and setter for the float[] type specifically.

Previously I had a float[]-to-double[] getter and a double[]-to-float[] setter:

public double[] getEmbedding() {
    double[] doubleEmbedding = new double[embedding.length];
    for (int i = 0; i < embedding.length; i++) {
        doubleEmbedding[i] = embedding[i];
    }
    return doubleEmbedding;
}

public void setEmbedding(double[] embedding) {
    this.embedding = new float[embedding.length];
    for (int i = 0; i < embedding.length; i++) {
        this.embedding[i] = (float) embedding[i];
    }
}

I kept those (because I'm using doubles in my app), but added:

public float[] getFloatEmbedding() {
    return embedding;
}

public void setFloatEmbedding(float[] embedding) {
    this.embedding = embedding;
}

Thanks for the help, John! (See comments)

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Iwan de Jong