1
# ---------------------------------------------------------------------------
3
# - afnix:mth module algebra test unit -
4
# ---------------------------------------------------------------------------
5
# - This program is free software; you can redistribute it and/or modify -
6
# - it provided that this copyright notice is kept intact. -
8
# - This program is distributed in the hope that it will be useful, but -
9
# - without any warranty; without even the implied warranty of -
10
# - merchantability or fitness for a particular purpose. In no event shall -
11
# - the copyright holder be liable for any direct, indirect, incidental or -
12
# - special damages arising in any way out of the use of this software. -
13
# ---------------------------------------------------------------------------
14
# - copyright (c) 1999-2015 amaury darsch -
15
# ---------------------------------------------------------------------------
17
# @info qr update test unit
18
# @author amaury darsch
21
interp:library "afnix-mth"
22
# load matrix generator
26
const qr (afnix:mth:Qr)
28
# check representation
29
assert true (afnix:mth:qr-p qr)
30
assert true (afnix:mth:direct-p qr)
31
assert true (afnix:mth:solver-p qr)
35
trans m (afnix:mth:Rmatrix 3)
37
# set lhs and factorize row 0
43
# get the qr matrix and compare
45
assert true (qrm:?= m)
48
trans m (afnix:mth:Rmatrix 3)
50
# set lhs and factorize row 0
56
# get the qr matrix and compare
58
assert true (qrm:?= m)
61
trans m (afnix:mth:Rmatrix 9)
63
# set lhs and factorize row 0-3
69
# get the qr matrix and compare
71
assert true (qrm:?= m)
74
trans m (afnix:mth:Rmatrix 9)
76
# set lhs and factorize row 0-3
82
# get the qr matrix and compare
84
assert true (qrm:?= m)
86
# create a random matrix
87
trans m (afnix:mth:get-random-r-matrix 17 100.0 true)
88
# set lhs and factorize
94
# get the qr matrix and compare
96
assert true (qrm:?= m)
98
# create a random matrix
99
trans m (afnix:mth:get-random-r-matrix 64 100.0 true)
100
# set lhs and factorize
106
# get the qr matrix and compare
107
trans qrm (qr:get-qr)
108
assert true (qrm:?= m)
110
# create a random matrix
111
trans m (afnix:mth:get-random-r-matrix 128 100.0 true)
112
# set lhs and factorize
114
# factorize row 96-127
118
# get the qr matrix and compare
119
trans qrm (qr:get-qr)
120
assert true (qrm:?= m)