Open sid-kap opened 8 years ago
The first argument is the default value for the rest of elements not in the diagonal.
λ> diagRect 7 (fromList [1,2,3]) 4 5
(4><5)
[ 1.0, 7.0, 7.0, 7.0, 7.0
, 7.0, 2.0, 7.0, 7.0, 7.0
, 7.0, 7.0, 3.0, 7.0, 7.0
, 7.0, 7.0, 7.0, 7.0, 7.0 ]
λ> diagR 7 (vec3 1 2 3) :: L 4 5
(diag 7.0 [1.0,2.0,3.0,7.0] :: L 4 5)
λ> disp 3 it
L 4 5
1 7 7 7 7
7 2 7 7 7
7 7 3 7 7
7 7 7 7 7
I will explain it in the documentation.
Hi,
What do the each of the arguments for diagR / diagRect functions specify? I couldn't find this in the documentation for either Numeric.LinearAlgebra or Numeric.LinearAlgebra.Numeric. If someone could give me a quick summary of this, I wouldn't mind making a PR to add this to the Haddock doc.
Here is the example usage of
diagRect
given in the docs:What does the first argument of
diagRect
(which is0
in the above example) do?Also, regarding
diagR
(which has the typediagR :: forall m n k. (KnownNat m, KnownNat n, KnownNat k) => field -> vec k -> mat m n
): Again, what does the first argument (which here has typefield
) signify?