uncomplicate

2018-07-20T22:12:10.000009Z

Problem: axpby! does not assign value to its third matrix parameter, below, ONE-SUB-Y. (I assume that the semantics of axpby! is to change the value of the rightmost matrix in the call; otherwise, what would matrices to the right of the putative "special" second matrix - as per the documentation for this routine - here Y, be doing?) The following illustrates the problem I'm having with axpby! ... nothing I try affects the target matrix ONE-SUB-Y, it's always just filled with zeroes. I tried, among other things, omitting the 0 scale factor. (BTW, in spite being one 1 x 6, these need to be matrices, not vectors.) Y (dge 1 6) ;populated with values before use ONE-SUB-Y (zero Y) Y-ONES (zero Y) ; (transfer! (repeat (dim Y-ONES) 1) Y-ONES) ;make a 1s matrix ;; I want to subtract matrix Y from its 1s matrix ;; and leave the result in ONE-SUB-Y matrix. ;; I want ONE-SUB-Y to be zeroed before it receives the sum, ;; since it's used iteratively. (axpby! 1 Y-ONES -1 Y 0 ONE-SUB-Y)

2018-07-20T23:37:03.000046Z

@chgraham axpby! method works well, you're just not using it well. If the third argument is 0, in (axpby! 1 x 0 y), the formula is y [i]:= 1*x + 0*y[i]. And, even if it worked as you needed in that example, it would be inefficient. You can achieve the same result in a much simpler way: (linear-frac! -1 y 1) (varying what is y, depending on what you want do do in that iteration).