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 direct solver 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:Rblock 3)
37
# set lhs and factorize
40
# get the qr block and compare
42
assert true (qrm:?= m)
45
trans m (afnix:mth:Rblock 3)
47
# create a 3x3 permutation
48
trans p (afnix:mth:Rpi 3)
52
# set lhs and factorize
56
# get the qr block and compare
58
assert true (qrm:?= m)
61
trans m (afnix:mth:Rblock 5)
63
# set lhs and factorize
66
# get the qr block and compare
68
assert true (qrm:?= m)
71
trans m (afnix:mth:Rblock 9)
73
# set lhs and factorize
76
# get the qr block and compare
78
assert true (qrm:?= m)
80
# create a random block
81
trans m (afnix:mth:get-random-r-block 17 100.0 true)
82
# set lhs and factorize
85
# get the qr block and compare
87
assert true (qrm:?= m)
89
# create a random block
90
trans m (afnix:mth:get-random-r-block 64 100.0 true)
91
# set lhs and factorize
94
# get the qr block and compare
96
assert true (qrm:?= m)
98
# create a random block
99
trans m (afnix:mth:get-random-r-block 128 100.0 true)
100
# set lhs and factorize
103
# get the qr block and compare
104
trans qrm (qr:get-qr)
105
assert true (qrm:?= m)