Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Featurescript Linear Algebra Library?

George_AndersonGeorge_Anderson Member Posts: 71 ✭✭
Does anyone know of any linear algebra libraries in Featurescript? Looking for some functions that are slightly more complex than what's in the stdlib. For example, solving a least-squares matrix system is my current problem. I can get my own using the SVD function, but maybe someone has done this and more.

Comments

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    Using the SVD, a least squares matrix solve is very little code.  See https://en.wikipedia.org/wiki/Moore–Penrose_inverse the construction using SVD section and Applications/linear least squares.  You just need a tolerance for the singular values.

    What other functionality would you be looking for?  And what's your actual use case? (there is a danger that the non-builtin part may be too slow for FS)
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • George_AndersonGeorge_Anderson Member Posts: 71 ✭✭
    edited September 2021
    Yes, I will write it with SVD no problem, just wondered if I was missing someone's killer library.
    To be honest, the least-squares solve is as far as I would really expect to go with Featurescript, but "numpy.linalg" from Python is a good reference in general. I wouldn't expect that many features of course.
    My current use case is an experiment -- doing some very basic truss design that provides rudimentary FEA feedback. I would form and solve a linear system of equations, with about 100-500 elements at most. I'm aware Featurescript may become slow for this on the higher end, but the goal is to get the feedback faster than leaving the Onshape world, and then returning.
    I agree that Featurescript is perhaps the wrong place to do this. A proper implementation would probably involve the API, which I'm just trying to avoid for now.
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    Yeah, I wouldn't expect great performance -- for FEA you really want sparse matrix math, but the FS side I expect would be quite a bit slower than even the dense SVD.

    I would mention that we are working on integrated simulation -- see the sneak peek here: https://www.onshape.com/en/resource-center/innovation-blog/onshapes-rd-team-reveals-sneak-peek-of-future-platform-features-and-improvements
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
Sign In or Register to comment.