diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-10-24 09:42:36 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-10-24 09:42:36 +0000 |
commit | 2e441c3f4d08da050540256164456e18519d22ef (patch) | |
tree | faae9372692ac8b618337b3e97f8ff9d44df2d08 /lib/Data/Packed/Internal | |
parent | 9c65a03f4e2b3b09f6f2ac606c5b22f6df9cea14 (diff) |
documentation
Diffstat (limited to 'lib/Data/Packed/Internal')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 77906dc..605a6f3 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -48,12 +48,14 @@ import Data.List(transpose) | |||
48 | - we could carry both the matrix and its (lazily computed) transpose. | 48 | - we could carry both the matrix and its (lazily computed) transpose. |
49 | This may save some transpositions, but it is necessary to keep track of the | 49 | This may save some transpositions, but it is necessary to keep track of the |
50 | data which is actually computed to be used by functions like the matrix product | 50 | data which is actually computed to be used by functions like the matrix product |
51 | which admit both orders. Therefore, maybe it is better to have something like | 51 | which admit both orders. |
52 | viewC and viewF, which may actually perform a transpose if required. | ||
53 | 52 | ||
54 | - but if we need the transposed data and it is not in the structure, we must make | 53 | - but if we need the transposed data and it is not in the structure, we must make |
55 | sure that we touch the same foreignptr that is used in the computation. Access | 54 | sure that we touch the same foreignptr that is used in the computation. |
56 | to such pointer cannot be made by creating a new vector. | 55 | |
56 | - a reasonable solution is using two constructors for a matrix. Transposition just | ||
57 | "flips" the constructor. Actual data transposition is not done if followed by a | ||
58 | matrix product or another transpose. | ||
57 | 59 | ||
58 | -} | 60 | -} |
59 | 61 | ||
@@ -66,7 +68,7 @@ data Matrix t = MC { rows :: Int, cols :: Int, cdat :: Vector t, fdat :: Vector | |||
66 | -- MC: preferred by C, fdat may require a transposition | 68 | -- MC: preferred by C, fdat may require a transposition |
67 | -- MF: preferred by LAPACK, cdat may require a transposition | 69 | -- MF: preferred by LAPACK, cdat may require a transposition |
68 | 70 | ||
69 | -- | matrix transpose | 71 | -- | Matrix transpose. |
70 | trans :: Matrix t -> Matrix t | 72 | trans :: Matrix t -> Matrix t |
71 | trans MC {rows = r, cols = c, cdat = d, fdat = dt } = MF {rows = c, cols = r, fdat = d, cdat = dt } | 73 | trans MC {rows = r, cols = c, cdat = d, fdat = dt } = MF {rows = c, cols = r, fdat = d, cdat = dt } |
72 | trans MF {rows = r, cols = c, fdat = d, cdat = dt } = MC {rows = c, cols = r, cdat = d, fdat = dt } | 74 | trans MF {rows = r, cols = c, fdat = d, cdat = dt } = MC {rows = c, cols = r, cdat = d, fdat = dt } |