This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-20
Channels
- # aleph (3)
- # beginners (14)
- # cider (70)
- # cljdoc (30)
- # cljs-dev (1)
- # cljsjs (6)
- # clojars (7)
- # clojure (88)
- # clojure-greece (1)
- # clojure-italy (3)
- # clojure-nl (17)
- # clojure-spec (1)
- # clojure-uk (54)
- # clojurescript (48)
- # code-reviews (2)
- # cursive (28)
- # datascript (3)
- # datomic (20)
- # docs (1)
- # emacs (16)
- # figwheel-main (17)
- # fulcro (13)
- # graphql (2)
- # hyperfiddle (2)
- # jobs (2)
- # nyc (1)
- # off-topic (39)
- # parinfer (1)
- # re-frame (37)
- # reagent (225)
- # remote-jobs (3)
- # ring (3)
- # ring-swagger (1)
- # shadow-cljs (110)
- # spacemacs (10)
- # spirituality-ethics (1)
- # test-check (3)
- # tools-deps (36)
- # uncomplicate (2)
- # vim (7)
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)
@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).