Last active
May 2, 2017 23:35
-
-
Save ryanrhymes/022151ae7d1b8c94363f509532df7a29 to your computer and use it in GitHub Desktop.
reply to boolean indexing ...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```ocaml | |
Mat.map (min 5.) x;; | |
``` | |
```ocaml | |
let x = Mat.uniform 5 5;; | |
Mat.filter (( < ) 0.5) x;; | |
... | |
``` | |
```ocaml | |
open Owl.Ext;; | |
let x = Dense.Matrix.D.uniform 5 5;; | |
let y = x >. F 0.5;; | |
``` | |
`y` is a `0`/`1` matrix which has the same meaning of a boolean matrix. For a similar example to the one you gave before, `a[a>0.5] = 5`, you can simply write | |
```ocaml | |
max2 x (x >. F 0.5) * F 5.;; | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment