SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SolveMinNormLeastSqSystem.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2103 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 
30 ///
31 ///@file SolveMinNormLeastSqSystem
32 ///@brief This module computes the minimal norm, least squared solution to a nx3
33 /// linear system.
34 ///
35 ///@author
36 /// David Weinstein
37 /// Department of Computer Science
38 /// University of Utah
39 ///@date June 1999
40 ///
41 ///@details
42 /// This module computes the minimal norm, least squared solution to a
43 /// nx3 linear system.
44 /// Given four input ColumnMatrices (v0,v1,v2,b),
45 /// find the three coefficients (w0,w1,w2) that minimize:
46 /// | (w0v0 + w1v1 + w2v2) - b |.
47 /// If more than one minimum exists (the system is under-determined),
48 /// choose the coefficients such that (w0,w1,w2) has minimum norm.
49 /// We output the vector (w0,w1,w2) as a row-matrix,
50 /// and we output the ColumnMatrix (called x), which is: | w0v0 + w1v1 + w2v2 |.
51 ///
52 
53 #ifndef MODULES_LEGACY_MATH_SOLVEMINNORMLEASTSQSYSTEM_H
54 #define MODULES_LEGACY_MATH_SOLVEMINNORMLEASTSQSYSTEM_H
55 
58 
59 namespace SCIRun {
60  namespace Modules {
61  namespace Math {
62 
64  public Has4InputPorts<MatrixPortTag, MatrixPortTag, MatrixPortTag, MatrixPortTag>,
65  public Has2OutputPorts<MatrixPortTag, MatrixPortTag>
66  {
67  public:
69  virtual void execute();
70  virtual void setStateDefaults() {}
71  INPUT_PORT(0, BasisVector1, DenseColumnMatrix);
72  INPUT_PORT(1, BasisVector2, DenseColumnMatrix);
73  INPUT_PORT(2, BasisVector3, DenseColumnMatrix);
74  INPUT_PORT(3, TargetVector, DenseColumnMatrix);
75  OUTPUT_PORT(0, WeightVector, DenseColumnMatrix);
76  OUTPUT_PORT(1, ResultVector, DenseColumnMatrix);
77  };
78 }}}
79 
80 #endif
Definition: SolveMinNormLeastSqSystem.h:63
Definition: Module.h:457
#define INPUT_PORT(index, name, type)
Definition: Module.h:665
#define SCISHARE
Definition: share.h:39
Definition: Module.h:512
virtual void setStateDefaults()
Definition: SolveMinNormLeastSqSystem.h:70
Definition: Module.h:53
#define OUTPUT_PORT(index, name, type)
Definition: Module.h:671
DenseColumnMatrixGeneric< double > DenseColumnMatrix
Definition: MatrixFwd.h:56