From c66febea721d6dbb85922c8b9dbf7c9d2d4e6148 Mon Sep 17 00:00:00 2001 From: daslu Date: Sat, 28 Dec 2024 15:20:27 +0200 Subject: [PATCH 1/2] numerical linear algebra - svd - made a long image scrollable --- projects/math/numerical-linalg/notebooks/svd.clj | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/math/numerical-linalg/notebooks/svd.clj b/projects/math/numerical-linalg/notebooks/svd.clj index 09f0a85..553f863 100644 --- a/projects/math/numerical-linalg/notebooks/svd.clj +++ b/projects/math/numerical-linalg/notebooks/svd.clj @@ -138,10 +138,13 @@ first-image ((flat-tensors i) j)) :uint8)) -;; For visual conveniene, we will display it transposed: -(-> long-tensor - (tensor/transpose [1 0]) - bufimg/tensor->image) +(kind/hiccup + [:div + [:h3 "It is interesting to scroll this! 👇"] + [:div {:style {:max-height "400px" + :overflow :auto}} + (bufimg/tensor->image + long-tensor)]]) ;; ## Singular value decomposition From 6a2a8dc33789afda23b48cbf56af14a2e1923cf9 Mon Sep 17 00:00:00 2001 From: daslu Date: Sat, 28 Dec 2024 15:20:52 +0200 Subject: [PATCH 2/2] numerical linear algebra - svd - using Quarto to display images (temporary solution) --- .../math/numerical-linalg/notebooks/svd.clj | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/projects/math/numerical-linalg/notebooks/svd.clj b/projects/math/numerical-linalg/notebooks/svd.clj index 553f863..4e806b1 100644 --- a/projects/math/numerical-linalg/notebooks/svd.clj +++ b/projects/math/numerical-linalg/notebooks/svd.clj @@ -32,8 +32,19 @@ (def video-path "notebooks/movie/Video_003.mp4") -(kind/video - {:src video-path}) +;; A conveneince function for displaying a video +;; in Quarto (till we handle this better in +;; an upcoming Clay release): +(defn video [path] + (kind/md + (str "{{" + \< + " video " + path + \> + "}}"))) + +(video video-path) ;; Let us explore it with clj-media: @@ -299,17 +310,4 @@ first-image (clj-media/make-media frame-format generated-frames) target-path) -(kind/video - {:src target-path}) - - - - - - - - - - - - +(video target-path)