uncomplicate / neanderthal

Fast Clojure Matrix Library
http://neanderthal.uncomplicate.org
Eclipse Public License 1.0
1.06k stars 56 forks source link

Display of RealBlockVector with large values is off (printing only) #110

Open maersdal opened 3 years ago

maersdal commented 3 years ago

I don't know if this is just my setup, or an actual bug in the printing of these vectors. It is a visual/printing issue only I think.

Experienced issue:

(ns sauce
  (:require [uncomplicate.neanderthal 
             [core :refer [scal]] 
             [native :refer [dv]]]))
(println  (scal 2000 (dv -1 2 5.2 0)))

outputs

#RealBlockVector[double, n:4, offset: 0, stride:1]
[-2.00E+34.00E+3 1.04E+4 .00     ]

nil

Whats wrong:

expected output

#RealBlockVector[double, n:4, offset: 0, stride:1]
[-2.00E+3 4.00E+3 1.04E+4 0.00]

nil

My system:

editor:

Now It could probably be solved with a print-method, but I'm a beginner and don't know how to do that yet.

kxygk commented 2 years ago

To change how things print you should take a look in here: https://github.com/uncomplicate/neanderthal/blob/5c76fb83eb43b7aa3307e6e90d5025e41750a00f/src/clojure/uncomplicate/neanderthal/internal/printing.clj

I've definitely done this before.. if I find my code I'll update this comment later