waylonflinn / weblas

GPU Powered BLAS for Browsers :gem:
MIT License
702 stars 43 forks source link

Substraction matrix ? #49

Closed extremety1989 closed 3 years ago

extremety1989 commented 5 years ago

Why is there no Substraction method ?

waylonflinn commented 5 years ago

If you're already doing a matrix multiply (adding a bias term, for instance) the easiest way to do this is directly with the sgemm method.

  1. set beta to -1
  2. pass in your bias terms as C (the last argument)

If you aren't doing a multiply beforehand, the best way is with the saxpy method.

  1. set a to -1
  2. pass the matrix you want to subtract from as X
  3. pass the matrix you want to subtract with as Y

Please let me know if this helps you.

extremety1989 commented 5 years ago

well