Skip to Main Content
InterSystems Ideas
We love hearing from our users. Tell us what you want to see next and upvote ideas from the community.
* Bugs and troubleshooting should as usual go through InterSystems support.
Status Will not implement
Categories InterSystems IRIS
Created by Robert Cemper
Created on Apr 29, 2024

Expand Vector Arithmetics

Enhance Vectore calculation beyond VECTOR_COSINE(),TO_VECTOR(),VECTOR_DOT_PRODUCT()

I especially miss these functions:

  • FROM_VECTOR to get the content of $ZV into a variable (JSON ?)

  • ADD_VECTOR() for transformation. For INT and DOUBLE

  • DiFF_VECTOR() for Vector distance For INT and DOUBLE

  • ADMIN RESPONSE
    Sep 12, 2024

    Thank you for submitting the idea. Based on information from our experts the status of your idea was changed to "Will not implement". Please look for details in the comments on the idea. Good luck!

  • Admin
    Vadim Aniskin
    Reply
    |
    Aug 8, 2024

    Robert, thank you for your idea.

    There is a comment on your idea from InterSystems Product Manager. Please answer it to help your idea to be promoted.

  • Benjamin De Boe
    Reply
    |
    Jul 24, 2024

    Hi Robert, do you have a specific use case in mind for extending the SQL vocabulary here? We don't really see much use for the low-level vector operations in SQL outside of the similarity calculations we're using for Vector Search, other than perhaps a grad school maths homework. Unlike the $vector functions in ObjectScript, everything we'd add to SQL has the potential of colliding with user-defined functions, so we'd like to be cautious and not overload the language with functions no one really needs. And as you have found, it's not hard for those that do need them (for said homework) to implement them as UDFs themselves.

  • Robert Cemper
    Reply
    |
    May 4, 2024

    I wrote an overview of what is available actually.
    Using VECTORs in ObjectScript
    Almost everything is there already. It just needs to be wrapped into SQL Procedures.
    Not a big deal for an experienced COS developer

  • Robert Cemper
    Reply
    |
    Apr 30, 2024

    As my replies and comments show it is doable but incredibly uncomfortable
    Some simpler approaches as SQL Methods will be attrative

  • Robert Cemper
    Reply
    |
    Apr 29, 2024
    ADD_VECTOR:
    >zw vec1,vec2
    vec1={"type":"integer", "count":3, "length":3, "vector":[100,300,678]} ; <VECTOR>
    vec2={"type":"integer", "count":3, "length":3, "vector":[123,345,678]} ; <VECTOR>
    >set vplus=$vop("v+",vec1,vec2)
    >zw vplus
    vplus={"type":"integer", "count":3, "length":3, "vector":[223,645,1356]} ; <VECTOR>

    DIFF_VECTOR:set vdiff=$vop("v-",vec1,vec2)

    USER>zw vdiff

    vdiff={"type":"integer", "count":3, "length":3, "vector":[-23,-45,0]} ; <VECTOR>



    1 reply
  • Robert Cemper
    Reply
    |
    Apr 29, 2024

    digging across documentation I detected that this is all available in COS!
    and even well described in the documentation.

    $vector()
    $vectorop (ObjectScript)

    1 reply