Simbody  3.7
MatrixCharacteristics.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMMATRIX_MATRIX_CHARACTERISTICS_H_
2 #define SimTK_SIMMATRIX_MATRIX_CHARACTERISTICS_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm): SimTKcommon *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2005-13 Stanford University and the Authors. *
13  * Authors: Michael Sherman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
33 #include "SimTKcommon/Scalar.h"
34 
35 #include <iostream>
36 #include <cassert>
37 #include <complex>
38 #include <cstddef>
39 #include <utility> // for std::pair
40 
41 namespace SimTK {
42 
43 
44 class MatrixStructure;
45 class MatrixStorage;
46 class MatrixOutline;
47 class MatrixCondition;
48 class MatrixCharacter;
49 class MatrixCommitment;
50 
51 
52 // ------------------------------ MatrixStructure -----------------------------
57 // ----------------------------------------------------------------------------
59 public:
60  enum Structure {
61  NoStructure = 0x00000000,
62  Matrix1d = 0x00000001,
63  Zero = 0x00000002,
64  Identity = 0x00000004,
65  Permutation = 0x00000008,
66  RepeatedDiagonal = 0x00000010,
67  Diagonal = 0x00000020,
68  BiDiagonal = 0x00000040,
69  TriDiagonal = 0x00000080,
70  BandedSymmetric = 0x00000100,
71  BandedHermitian = 0x00000200,
72  Banded = 0x00000400,
73  Triangular = 0x00000800,
74  QuasiTriangular = 0x00001000,
75  Hessenberg = 0x00002000,
76  Symmetric = 0x00004000,
77  Hermitian = 0x00008000,
78  SkewSymmetric = 0x00010000,
79  SkewHermitian = 0x00020000,
80  Full = 0x00040000
81  };
82  static const char* name(Structure);
83 
84  typedef unsigned int StructureMask; // 32 bits
85  static const StructureMask AnyStructure = 0x0007ffffU; // see above
86  static const StructureMask UncommittedStructure = 0xffffffffU;
87  static StructureMask calcStructureMask(Structure);
88 
93  enum Position {
94  NoPosition = 0x0000,
95  Lower = 0x0001, // matrix is lower triangular (default)
96  Upper = 0x0002 // matrix is upper triangular
97  };
98  static const char* name(Position);
99 
100  typedef unsigned short PositionMask; // 16 bits
101  static const PositionMask AnyPosition = 0x0003U; // see above
102  static const PositionMask UncommittedPosition = 0xffffU;
103  static PositionMask calcPositionMask(Structure);
104 
110  enum DiagValue {
111  NoDiagValue = 0x0000,
112  StoredDiag = 0x0001, // could be anything (default)
113  ZeroDiag = 0x0002, // zero (e.g. for skew matrices)
114  UnitDiag = 0x0004 // unit (one) diagonal is used frequently by Lapack
115  };
116  static const char* name(DiagValue);
117 
118  typedef unsigned short DiagValueMask; // 16 bits
119  static const DiagValueMask AnyDiagValue = 0x0003U;
120  static const DiagValueMask UncommittedDiagValue = 0xffffU;
121  static DiagValueMask calcDiagValueMask(Structure);
122 
124  if (structure == NoStructure)
125  structure = Full;
126  if (position == NoPosition)
127  position = Lower;
128  if (diagValue == NoDiagValue)
129  diagValue = StoredDiag;
130  return *this;
131  }
132 
133  std::string name() const {
134  return std::string(name(getStructure()))
135  + "|" + std::string(name(getPosition()))
136  + "|" + std::string(name(getDiagValue()));
137  }
138 
139  struct Mask {
140  Mask() {setToUncommitted();}
142  : structure(sm), position(pm), diagValue(dm) {}
144  { structure=UncommittedStructure; position=UncommittedPosition;
145  diagValue=UncommittedDiagValue; return *this; }
146  bool isUncommitted() const
147  { return structure==UncommittedStructure && position==UncommittedPosition
148  && diagValue==UncommittedDiagValue; }
149  bool isSatisfiedBy(Structure str, Position pos, DiagValue diag) const
150  { return ((StructureMask)str&structure)==(StructureMask)str
151  && ((PositionMask)pos&position)==(PositionMask)pos
152  && ((DiagValueMask)diag&diagValue)==(DiagValueMask)diag; }
153  bool isSatisfiedBy(const MatrixStructure& actual) const
154  { return isSatisfiedBy(actual.getStructure(), actual.getPosition(),
155  actual.getDiagValue()); }
156 
160  };
161 
162  MatrixStructure() {setToNone();}
163 
166  MatrixStructure(Structure s, Position p=NoPosition, DiagValue d=NoDiagValue)
167  : structure(s), position(p), diagValue(d) {}
168 
173  Mask mask() const;
174 
175  Structure getStructure() const {return structure;}
176  Position getPosition() const {return position;}
177  DiagValue getDiagValue() const {return diagValue;}
178 
179  MatrixStructure& setStructure(Structure s) {structure=s; return *this;}
180  MatrixStructure& setPosition (Position p) {position=p; return *this;}
181  MatrixStructure& setDiagValue(DiagValue d) {diagValue=d; return *this;}
182 
184  { structure=s; position=p; diagValue=d; return *this; }
185 
187  { structure=NoStructure; position=NoPosition;
188  diagValue=NoDiagValue; return *this; }
189 
190 private:
191  Structure structure:32;
192  Position position:16;
193  DiagValue diagValue:16;
194 };
195 
196 
197 // ------------------------------ MatrixStorage -------------------------------
202 // ----------------------------------------------------------------------------
204 public:
205  enum Packing {
206  NoPacking = 0x0000,
207  Full = 0x0001, // full storage layout
208  TriInFull = 0x0002, // a triangular piece of a full storage layout
209  TriPacked = 0x0004, // triangle packed into minimal storage, at performance cost
210  Banded = 0x0008, // a packed, banded storage format
211  Vector = 0x0010, // a possibly-strided or scattered vector
212  Scalar = 0x0020, // a single scalar is stored
213  Permutation = 0x0040 // a permuted identity matrix
214  };
215  static const char* name(Packing);
216  typedef unsigned short PackingMask;
217  static const PackingMask AllPacking = 0x007fU; // see above
218  static const PackingMask UncommittedPacking = 0xffffU;
219 
220  enum Placement {
221  NoPlacement = 0x0000,
222  Lower = 0x0001, // stored in lower triangle of full matrix
223  Upper = 0x0002, // stored in upper triangle of full matrix
224  };
225  static const char* name(Placement);
226  typedef unsigned short PlacementMask;
227  static const PlacementMask AllPlacement = 0x0003U; // see above
228  static const PlacementMask UncommittedPlacement = 0xffffU;
229 
230  enum Order {
231  NoOrder = 0x0000,
232  ColumnOrder = 0x0001, // matrix is stored by columns
233  RowOrder = 0x0002, // matrix is stored by rows
234  };
235  static const char* name(Order);
236  typedef unsigned short OrderMask;
237  static const OrderMask AllOrder = 0x03U; // see above
238  static const OrderMask UncommittedOrder = 0xffU;
239 
240  enum Diagonal {
241  NoDiag = 0x0000,
242  StoredDiag = 0x0001, // matrix diagonal is stored
243  AssumedDiag = 0x0002 // matrix diagonal is not stored but has known value
244  };
245  static const char* name(Diagonal);
246  typedef unsigned short DiagonalMask;
247  static const DiagonalMask AllDiagonal = 0x0003U; // see above
248  static const DiagonalMask UncommittedDiagonal = 0xffffU;
249 
252  struct Mask {
254  : packing(UncommittedPacking), placement(UncommittedPlacement),
255  order(UncommittedOrder), diagonal(UncommittedDiagonal) {}
257  : packing(pkm), placement(plm), order(om), diagonal(dm) {}
259  { packing=UncommittedPacking; placement=UncommittedPlacement;
260  order=UncommittedOrder; diagonal=UncommittedDiagonal; return *this; }
261  bool isUncommitted() const
262  { return packing==UncommittedPacking && placement==UncommittedPlacement
263  && order==UncommittedOrder && diagonal==UncommittedDiagonal; }
264  bool isSatisfiedBy(Packing pack, Placement place, Order ord, Diagonal diag) const
265  { return ((PackingMask)pack & packing) == (PackingMask) pack
266  && ((PlacementMask)place & placement) == (PlacementMask)place
267  && ((OrderMask)ord & order) == (OrderMask) ord
268  && ((DiagonalMask)diag & diagonal) == (DiagonalMask) diag; }
269  bool isSatisfiedBy(const MatrixStorage& actual) const
270  { return isSatisfiedBy(actual.getPacking(), actual.getPlacement(),
271  actual.getOrder(), actual.getDiagonal());}
272 
277  };
278 
279  static MatrixStorage calcDefaultStorage(const MatrixStructure&,
280  const MatrixOutline&);
281 
282  std::string name() const {
283  return std::string(name(getPacking()))
284  + "|" + std::string(name(getPlacement()))
285  + "|" + std::string(name(getOrder()))
286  + "|" + std::string(name(getDiagonal()));
287  }
288 
293  Mask mask() const {
294  Mask ms; // initially uncommitted
295  if (packing) ms.packing = (PackingMask)packing;
296  if (placement) ms.placement = (PlacementMask)placement;
297  if (order) ms.order = (OrderMask)order;
298  if (diagonal) ms.diagonal = (DiagonalMask)diagonal;
299  return ms;
300  }
301 
304  : packing(NoPacking), placement(NoPlacement), order(NoOrder), diagonal(NoDiag) {}
305 
309  MatrixStorage(Packing pk, Placement pl=NoPlacement, Order o=NoOrder, Diagonal d=NoDiag)
310  : packing(pk), placement(pl), order(o), diagonal(d) {}
311 
315  : packing(pk), placement(NoPlacement), order(o), diagonal(StoredDiag) {}
316 
320  if (packing==NoPacking)
321  packing = Full;
322  if (placement==NoPlacement)
323  placement = Lower;
324  if (order==NoOrder)
325  order = ColumnOrder;
326  if (diagonal==NoDiag)
327  diagonal = StoredDiag;
328  return *this;
329  }
330 
333  { packing=NoPacking; placement=NoPlacement;
334  order=NoOrder; diagonal=NoDiag; return *this; }
335 
336  MatrixStorage& setPacking(Packing p) {packing = p; return *this;}
337  MatrixStorage& setPlacement(Placement p) {placement = p; return *this;}
338  MatrixStorage& setOrder(Order o) {order = o; return *this;}
339  MatrixStorage& setDiagonal(Diagonal d) {diagonal = d; return *this;}
340 
341  Packing getPacking() const {return packing;}
342  Placement getPlacement() const {return placement;}
343  Order getOrder() const {return order;}
344  Diagonal getDiagonal() const {return diagonal;}
345 
346 private:
347  Packing packing:16;
348  Placement placement:16;
349  Order order:16;
350  Diagonal diagonal:16;
351 };
352 
353 
354 // ------------------------------- MatrixOutline ------------------------------
375 // ----------------------------------------------------------------------------
377 public:
378  enum Outline {
379  NoOutline = 0x0000,
380  Scalar = 0x0001, // 1x1
381  Column = 0x0002, // mx1, m != 1
382  Row = 0x0004, // 1xn, n != 1
383  Square = 0x0008, // mxn, m == n
384  Wide = 0x0010, // mxn, m < n
385  Tall = 0x0020, // mxn, m > n
386  Rectangular = 0x0040 // mxn
387  };
388  static const char* name(Outline);
389 
390  typedef unsigned short OutlineMask;
391  static const OutlineMask AnyOutline = 0x007fU; // see above
392  static const OutlineMask UncommittedOutline = 0xffffU;
393 
394  struct Mask {
395  Mask() : outline(UncommittedOutline) {}
396  explicit Mask(OutlineMask mask) : outline(mask) {}
397  Mask& setToUncommitted() {outline=UncommittedOutline; return *this;}
398  bool isUncommitted() const {return outline==UncommittedOutline;}
399  bool isSatisfiedBy(const MatrixOutline& actual) const
400  { return ((OutlineMask)actual.outline & outline) == (OutlineMask)actual.outline; }
401 
403  };
404 
405  std::string name() const {return std::string(name(getOutline()));}
406 
409  MatrixOutline() : outline(NoOutline) {}
410 
412  MatrixOutline(Outline outline) : outline(outline) {}
413 
415  MatrixOutline& setToNone() {outline=NoOutline; return *this;}
416 
420  static OutlineMask calcMask(Outline);
421 
424  Mask mask() const {return Mask(calcMask(getOutline()));}
425 
427  bool isSizeOK(int m, int n) const;
428 
430  void getMinimumSize(int& m, int& n) const;
431 
433  static MatrixOutline calcFromSize(int m, int n);
434 
436  Outline getOutline() const {return outline;}
437 
438 private:
439  Outline outline:16;
440 };
441 
442 
443 
444 // ---------------------------- MatrixCondition -------------------------------
453 // ----------------------------------------------------------------------------
455 public:
456  enum Condition {
457  UnknownCondition = 0x0000,
458  Orthogonal = 0x0001, // implies well conditioned
459  PositiveDefinite = 0x0002, // implies well conditioned
460  WellConditioned = 0x0004, // implies full rank
461  FullRank = 0x0008, // but might have bad conditioning
462  Singular = 0x0010 // implies possible bad conditioning
463  };
464  static const char* name(Condition);
465 
466  typedef unsigned short ConditionMask; // 16 bits in mask
467  static const ConditionMask AnyCondition = 0x001fU; // see above
468  static const ConditionMask UncommittedCondition = 0xffffU;
469 
470  enum Diagonal {
471  UnknownDiagonal = 0x0000,
472  ZeroDiagonal = 0x0001,
473  OneDiagonal = 0x0002,
474  RealDiagonal = 0x0004,
475  ImaginaryDiagonal = 0x0008
476  };
477  static const char* name(Diagonal);
478 
479  typedef unsigned short DiagonalMask; // 16 bits in mask
480  static const DiagonalMask AnyDiagonal = 0x000fU; // see above
481  static const DiagonalMask UncommittedDiagonal = 0xffffU;
482 
484  struct Mask {
485  Mask() : condition(UncommittedCondition), diagonal(UncommittedDiagonal) {}
486  Mask(ConditionMask cmask, DiagonalMask dmask) : condition(cmask), diagonal(dmask) {}
488  { condition=UncommittedCondition; diagonal=UncommittedDiagonal; return *this;}
489  bool isUncommitted() const
490  { return condition==UncommittedCondition && diagonal==UncommittedDiagonal;}
491  bool isSatisfiedBy(const MatrixCondition& actual) const
492  { return ((ConditionMask)actual.condition & condition) == (ConditionMask)actual.condition
493  && ((DiagonalMask) actual.diagonal & diagonal) == (DiagonalMask)actual.diagonal; }
494 
497  };
498 
499  std::string name() const
500  { return std::string(name(getCondition())) + "|" + std::string(name(getDiagonal()));}
501 
504  MatrixCondition() : condition(UnknownCondition), diagonal(UnknownDiagonal) {}
505 
508  MatrixCondition(Condition cond, Diagonal diag=UnknownDiagonal)
509  : condition(cond), diagonal(diag) {}
510 
512  MatrixCondition& setToNone() {condition=UnknownCondition; diagonal=UnknownDiagonal; return *this;}
513 
519  static ConditionMask calcMask(Condition);
520 
526  static DiagonalMask calcMask(Diagonal);
527 
530  Mask mask() const
531  { return Mask(calcMask(getCondition()), calcMask(getDiagonal())); }
532 
533  Condition getCondition() const {return condition;}
534  Diagonal getDiagonal() const {return diagonal;}
535 
536  MatrixCondition& setCondition(Condition c) {condition=c; return *this;}
537  MatrixCondition& setDiagonal (Diagonal d) {diagonal=d; return *this;}
538 
539 private:
540  Condition condition:16;
541  Diagonal diagonal:16;
542 };
543 
544 
545 
546 // ------------------------------ MatrixCharacter -----------------------------
598 public:
601  MatrixCharacter() : nr(0), nc(0), lband(0), uband(0) {}
602 
603  // Some handy predefined MatrixCharacters.
604  class LapackFull;
605  class Vector;
606  class RowVector;
607 
610  nr=nc=lband=uband=0;
611  structure.setToNone(); outline.setToNone();
612  storage.setToNone(); condition.setToNone();
613  return *this;
614  }
615 
618  int nrow() const {return nr;}
619  int ncol() const {return nc;}
620  std::pair<int,int> getSize() const {return std::pair<int,int>(nrow(),ncol());}
621  ptrdiff_t nelt() const {return (ptrdiff_t)nrow() * (ptrdiff_t)ncol();}
622 
623  int getLowerBandwidth() const {return lband;}
624  int getUpperBandwidth() const {return uband;}
625  std::pair<int,int> getBandwidth() const
626  { return std::pair<int,int>(getLowerBandwidth(), getUpperBandwidth()); }
627 
628  const MatrixStructure& getStructure() const {return structure;}
629  const MatrixStorage& getStorage() const {return storage;}
630  const MatrixOutline& getOutline() const {return outline;}
631  const MatrixCondition& getCondition() const {return condition;}
632 
633  MatrixStructure& updStructure() {return structure;}
634  MatrixStorage& updStorage() {return storage;}
635  MatrixOutline& updOutline() {return outline;}
636  MatrixCondition& updCondition() {return condition;}
637 
638  MatrixCharacter& setStructure(const MatrixStructure& sa) {structure = sa; return *this;}
639  MatrixCharacter& setStorage (const MatrixStorage& sa) {storage = sa; return *this;}
640  MatrixCharacter& setOutline (const MatrixOutline& oa) {outline = oa; return *this;}
641  MatrixCharacter& setCondition(const MatrixCondition& ca) {condition = ca; return *this;}
642 
643 
646  { setSize(m,n); outline = MatrixOutline::calcFromSize(m,n); return *this; }
648  { setNumRows(m); outline = MatrixOutline::calcFromSize(m,ncol()); return *this; }
650  { setNumCols(n); outline = MatrixOutline::calcFromSize(nrow(),n); return *this; }
651 
652  MatrixCharacter& setBandwidth(int lb, int ub) {
653  assert(lb>=0 && lb>=0);
654  lband = lb; uband = ub;
655  return *this;
656  }
658  assert(lb>=0);
659  lband = lb;
660  return *this;
661  }
663  assert(ub>=0);
664  uband = ub;
665  return *this;
666  }
667 
668  class Mask; // defined below
669 
670 protected:
671  MatrixCharacter(int m, int n,
672  int lb, int ub,
673  MatrixStructure structure,
674  MatrixStorage storage,
675  MatrixCondition condition)
676  : nr(m), nc(n), lband(lb), uband(ub),
677  structure(structure), storage(storage),
678  outline(MatrixOutline::calcFromSize(m,n)),
679  condition(condition) {}
680 
681 
682  int nr,
683  nc;
684  int lband,
685  uband;
690 
691 private:
692  // These are private because they don't set the outline as well.
693  MatrixCharacter& setSize(int m, int n)
694  { assert(m>=0 && n>=0); nr = m; nc = n; return *this; }
695  MatrixCharacter& setNumRows(int m)
696  { assert(m>=0); nr = m; return *this; }
697  MatrixCharacter& setNumCols(int n)
698  { assert(n>=0); nc = n; return *this; }
699 };
700 
703 SimTK_SimTKCOMMON_EXPORT std::ostream&
704 operator<<(std::ostream& o, const MatrixCharacter&);
705 
712 public:
713  LapackFull(int m, int n)
714  : MatrixCharacter(m,n,0,0,
716  MatrixStorage(MatrixStorage::Full,MatrixStorage::ColumnOrder),
717  MatrixCondition()) {}
718 };
719 
725 public:
726  Vector(int m)
727  : MatrixCharacter(m,1,0,0,
728  MatrixStructure(MatrixStructure::Matrix1d),
730  MatrixCondition()) {}
731 };
732 
738 public:
739  RowVector(int n)
740  : MatrixCharacter(1,n,0,0,
741  MatrixStructure(MatrixStructure::Matrix1d),
743  MatrixCondition()) {}
744 };
745 
746 // -------------------------- MatrixCharacter::Mask ---------------------------
749 // ----------------------------------------------------------------------------
751 public:
753 
754  typedef unsigned int SizeMask;
755  static const SizeMask SizeUncommitted = 0xffffffffU;
756 
757  bool isResizeable() const {return nr==SizeUncommitted || nc==SizeUncommitted;}
759  bool isNumRowsLocked() const {return nr!=SizeUncommitted;}
760  bool isNumColsLocked() const {return nc!=SizeUncommitted;}
761 
762  unsigned int getNumRowsMask() const {return nr;}
763  unsigned int getNumColsMask() const {return nc;}
764  unsigned int getLowerBandwidthMask() const {return lband;}
765  unsigned int getUpperBandwidthMask() const {return uband;}
766 
767  int getDefaultNumRows() const {return isNumRowsLocked() ? nr : 0;}
768  int getDefaultNumCols() const {return isNumColsLocked() ? nc : 0;}
769 
774 
780  return *this;
781  }
782 
784  bool isUncommitted() const {
785  return nr==SizeUncommitted && nc==SizeUncommitted
789  }
790 
792  bool isSatisfiedBy(const MatrixCharacter& actual) const {
793  return isSizeOK(actual.nr, actual.nc)
794  && isBandwidthOK(actual.lband, actual.uband)
796  && storage.isSatisfiedBy(actual.getStorage())
797  && outline.isSatisfiedBy(actual.getOutline())
798  && condition.isSatisfiedBy(actual.getCondition());
799  }
800 
802  bool isSizeOK(int m, int n) const
803  { return ((SizeMask)m & nr) == (SizeMask)m
804  && ((SizeMask)n & nc) == (SizeMask)n; }
805 
808  bool isBandwidthOK(int lower, int upper) const
809  { return ((SizeMask)lower & lband) == (SizeMask)lower
810  && ((SizeMask)upper & uband) == (SizeMask)upper; }
811 
813  nc;
815  uband;
820 
821 friend class MatrixCommitment;
822 };
823 
824 // ----------------------------- MatrixCommitment -----------------------------
825 
830 
831 // ----------------------------------------------------------------------------
833 public:
834  MatrixCommitment() {} // set commitments to "none" and masks to "uncommitted"
835 
839  { new (this) MatrixCommitment(str, MatrixStorage(), MatrixOutline(), MatrixCondition());}
840 
841  class Vector;
842  class RowVector;
843  class Triangular;
844  class Symmetric;
845  class Hermitian;
846  class SkewSymmetric;
847  class SkewHermitian;
848 
849  MatrixCommitment& commitSize(int m, int n)
850  { commitNumRows(m); commitNumCols(n); return *this; }
852  { SimTK_SIZECHECK_NONNEG(m, "MatrixCommitment::commitNumRows()");
853  masks.nr = m; return *this; }
855  { SimTK_SIZECHECK_NONNEG(n, "MatrixCommitment::commitNumCols()");
856  masks.nc = n; return *this; }
857 
859  { commitLowerBandwidth(lb); commitUpperBandwidth(ub); return *this;}
861  { SimTK_SIZECHECK_NONNEG(lb, "MatrixCommitment::commitLowerBandwidth()");
862  masks.lband = lb; return *this; }
864  { SimTK_SIZECHECK_NONNEG(ub, "MatrixCommitment::commitUpperBandwidth()");
865  masks.uband = ub; return *this; }
866 
868  { structure=s; masks.structure=s.mask(); return *this; }
870  { storage=s; masks.storage =s.mask(); return *this; }
872  { outline=o; masks.outline =o.mask(); return *this; }
874  { condition=c; masks.condition=c.mask(); return *this; }
875 
886  MatrixCharacter calcDefaultCharacter(int minNumRows, int minNumCols) const;
887 
889  const MatrixStructure& getStructureCommitment() const {return structure;}
890  const MatrixStorage& getStorageCommitment() const {return storage;}
891  const MatrixOutline& getOutlineCommitment() const {return outline;}
892  const MatrixCondition& getConditionCommitment() const {return condition;}
893 
895  const MatrixStructure::Mask& getStructureMask() const {return masks.structure;}
896  const MatrixStorage::Mask& getStorageMask() const {return masks.storage;}
897  const MatrixOutline::Mask& getOutlineMask() const {return masks.outline;}
898  const MatrixCondition::Mask& getConditionMask() const {return masks.condition;}
899 
904 
905  int getDefaultNumRows() const {return masks.getDefaultNumRows();}
906  int getDefaultNumCols() const {return masks.getDefaultNumCols();}
907 
908  bool isSizeOK(int m, int n) const {return masks.isSizeOK(m,n);}
909  bool isSizeOK(const std::pair<int,int>& mn) const
910  { return isSizeOK(mn.first, mn.second); }
911 
912  bool isBandwidthOK(int lower, int upper) const {return masks.isBandwidthOK(lower,upper);}
913 
914  bool isSatisfiedBy(const MatrixCharacter& actual) const
915  { return masks.isSatisfiedBy(actual); }
916  bool isStructureOK(const MatrixStructure& s) const
917  { return getStructureMask().isSatisfiedBy(s); }
918  bool isStorageOK(const MatrixStorage& s) const
919  { return getStorageMask().isSatisfiedBy(s); }
920  bool isOutlineOK(const MatrixOutline& o) const
921  { return getOutlineMask().isSatisfiedBy(o); }
922  bool isConditionOK(const MatrixCondition& c) const
923  { return getConditionMask().isSatisfiedBy(c); }
924 
925  bool isResizeable() const {return masks.isResizeable();}
926  bool isFullyResizeable() const {return masks.isFullyResizeable();;}
927  bool isNumRowsLocked() const {return masks.isNumRowsLocked();}
928  bool isNumColsLocked() const {return masks.isNumColsLocked();}
929 
930  bool isStructureCommitted() const
931  { return !getStructureMask().isUncommitted(); }
932  bool isStorageCommitted() const
933  { return !getStorageMask().isUncommitted();}
934  bool isOutlineCommitted() const
935  { return !getOutlineMask().isUncommitted(); }
936  bool isConditionCommitted() const
937  { return !getConditionMask().isUncommitted();}
938 
940  void clear() {
941  structure.setToNone();
942  storage.setToNone();
943  outline.setToNone();
944  condition.setToNone();
945  masks.setToUncommitted();
946  }
947 
948 protected:
950  const MatrixStorage& storage,
951  const MatrixOutline& outline,
952  const MatrixCondition& condition)
953  : structure(structure), storage(storage),
954  outline(outline), condition(condition),
955  masks() // set to all 1's
956  {
957  if (outline.getOutline()==MatrixOutline::Scalar) commitSize(1,1);
958  else if (outline.getOutline()==MatrixOutline::Column) commitNumCols(1);
959  else if (outline.getOutline()==MatrixOutline::Row) commitNumRows(1);
960 
961  masks.structure = structure.mask();
962  masks.storage = storage.mask();
963  masks.outline = outline.mask();
964  masks.condition = condition.mask();
965  }
966 
973 
977 };
978 
979 
982 public:
986  ( MatrixStructure(MatrixStructure::Matrix1d),
987  MatrixStorage(),
988  MatrixOutline(MatrixOutline::Column),
989  MatrixCondition())
990  {
991  }
993  explicit Vector(int m)
995  ( MatrixStructure(MatrixStructure::Matrix1d),
996  MatrixStorage(),
997  MatrixOutline(MatrixOutline::Column),
998  MatrixCondition())
999  {
1000  commitNumRows(m);
1001  }
1002 };
1003 
1006 public:
1010  ( MatrixStructure(MatrixStructure::Matrix1d),
1011  MatrixStorage(),
1013  MatrixCondition())
1014  {
1015  }
1017  explicit RowVector(int n)
1019  ( MatrixStructure(MatrixStructure::Matrix1d),
1020  MatrixStorage(),
1022  MatrixCondition())
1023  {
1024  commitNumCols(n);
1025  }
1026 };
1027 
1030 public:
1034  {
1035  }
1036 };
1037 
1041 public:
1045  {
1046  }
1047 };
1048 
1053 public:
1057  MatrixStorage(),
1058  MatrixOutline(),
1059  MatrixCondition().setDiagonal(MatrixCondition::RealDiagonal))
1060  {
1061  }
1062 };
1063 
1068 public:
1072  MatrixStorage(),
1073  MatrixOutline(),
1074  MatrixCondition().setDiagonal(MatrixCondition::ZeroDiagonal))
1075  {
1076  }
1077 };
1078 
1083 public:
1087  MatrixStorage(),
1088  MatrixOutline(),
1089  MatrixCondition().setDiagonal(MatrixCondition::ImaginaryDiagonal))
1090  {
1091  }
1092 };
1093 
1096 SimTK_SimTKCOMMON_EXPORT std::ostream&
1097 operator<<(std::ostream& o, const MatrixCommitment&);
1098 
1099 } //namespace SimTK
1100 
1101 #endif // SimTK_SIMMATRIX_MATRIX_CHARACTERISTICS_H_
MatrixOutline & updOutline()
Definition: MatrixCharacteristics.h:635
MatrixCondition & updCondition()
Definition: MatrixCharacteristics.h:636
MatrixCommitment & commitBandwidth(int lb, int ub)
Definition: MatrixCharacteristics.h:858
MatrixCommitment & commitSize(int m, int n)
Definition: MatrixCharacteristics.h:849
bool isSatisfiedBy(Structure str, Position pos, DiagValue diag) const
Definition: MatrixCharacteristics.h:149
bool isUpperBandwidthLocked() const
Definition: MatrixCharacteristics.h:771
Use this class to represent sets of acceptable values for each of the storage attributes (packing...
Definition: MatrixCharacteristics.h:252
bool isNumColsLocked() const
Definition: MatrixCharacteristics.h:760
Definition: MatrixCharacteristics.h:382
StructureMask structure
Definition: MatrixCharacteristics.h:157
Vector(int m)
Commit to a column vector of a particular length.
Definition: MatrixCharacteristics.h:993
PackingMask packing
Definition: MatrixCharacteristics.h:273
bool isUncommitted() const
Definition: MatrixCharacteristics.h:398
Matrix "outline" refers to the characteristic relationship between the number of rows and columns of ...
Definition: MatrixCharacteristics.h:376
MatrixCharacter::Mask::SizeMask getNumRowsMask() const
Definition: MatrixCharacteristics.h:900
MatrixStructure & updStructure()
Definition: MatrixCharacteristics.h:633
MatrixCharacter::Mask::SizeMask getLowerBandwidthMask() const
Definition: MatrixCharacteristics.h:902
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:224
LapackFull(int m, int n)
Definition: MatrixCharacteristics.h:713
MatrixCharacter()
Default constructor sets lengths to zero and the other characteristics to "none specified".
Definition: MatrixCharacteristics.h:601
MatrixCharacter & setCondition(const MatrixCondition &ca)
Definition: MatrixCharacteristics.h:641
Mask & setToUncommitted()
Definition: MatrixCharacteristics.h:258
Packing getPacking() const
Definition: MatrixCharacteristics.h:341
Packing
Definition: MatrixCharacteristics.h:205
bool isSizeOK(const std::pair< int, int > &mn) const
Definition: MatrixCharacteristics.h:909
Vector(int m)
Definition: MatrixCharacteristics.h:726
const MatrixOutline::Mask & getOutlineMask() const
Definition: MatrixCharacteristics.h:897
Structure
Definition: MatrixCharacteristics.h:60
MatrixStructure & setMissingAttributes()
Definition: MatrixCharacteristics.h:123
Use this class to represent a set of acceptable Condition values.
Definition: MatrixCharacteristics.h:484
MatrixStructure & setPosition(Position p)
Definition: MatrixCharacteristics.h:180
bool isSatisfiedBy(Packing pack, Placement place, Order ord, Diagonal diag) const
Definition: MatrixCharacteristics.h:264
OutlineMask outline
Definition: MatrixCharacteristics.h:402
Placement
Definition: MatrixCharacteristics.h:220
std::string name() const
Definition: MatrixCharacteristics.h:282
MatrixStorage storage
Definition: MatrixCharacteristics.h:970
This is the default commitment for a skew Hermitian (not skew symmetric) matrix.
Definition: MatrixCharacteristics.h:1082
MatrixCondition::Mask condition
Definition: MatrixCharacteristics.h:819
unsigned short ConditionMask
Definition: MatrixCharacteristics.h:466
bool isUncommitted() const
Definition: MatrixCharacteristics.h:261
MatrixCondition & setDiagonal(Diagonal d)
Definition: MatrixCharacteristics.h:537
bool isSizeOK(int m, int n) const
Check whether an actual size satisfies the size commitment.
Definition: MatrixCharacteristics.h:802
int nc
actual number of columns
Definition: MatrixCharacteristics.h:682
MatrixCharacter::Mask::SizeMask getUpperBandwidthMask() const
Definition: MatrixCharacteristics.h:903
Predefined MatrixCharacter for an ordinary column vector of a particular size.
Definition: MatrixCharacteristics.h:724
Mask(PackingMask pkm, PlacementMask plm, OrderMask om, DiagonalMask dm)
Definition: MatrixCharacteristics.h:256
MatrixCharacter & setActualNumCols(int n)
Definition: MatrixCharacteristics.h:649
Placement getPlacement() const
Definition: MatrixCharacteristics.h:342
const MatrixStorage & getStorage() const
Definition: MatrixCharacteristics.h:629
Definition: MatrixCharacteristics.h:394
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
MatrixCondition & setToNone()
Restore to default-constructed state of "none".
Definition: MatrixCharacteristics.h:512
MatrixStorage & updStorage()
Definition: MatrixCharacteristics.h:634
Mask()
Definition: MatrixCharacteristics.h:485
Matrix "condition" is a statement about the numerical characteristics of a Matrix.
Definition: MatrixCharacteristics.h:454
SizeMask nr
number of rows
Definition: MatrixCharacteristics.h:812
MatrixCommitment & commitUpperBandwidth(int ub)
Definition: MatrixCharacteristics.h:863
int getUpperBandwidth() const
Definition: MatrixCharacteristics.h:624
Outline
Definition: MatrixCharacteristics.h:378
Mask mask() const
Given a Structure commitment, which more-restrictive Structures will still satisfy this commitment...
const Real Zero
Real(0)
unsigned short OrderMask
Definition: MatrixCharacteristics.h:236
int getDefaultNumCols() const
Definition: MatrixCharacteristics.h:768
Matrix "structure" refers to an inherent mathematical (or at least algorithmic) characteristic of the...
Definition: MatrixCharacteristics.h:58
A MatrixCharacter is a set containing a value for each of the matrix characteristics except element t...
Definition: MatrixCharacteristics.h:597
Matrix "storage" refers to the physical layout of data in the computer&#39;s memory.
Definition: MatrixCharacteristics.h:203
bool isFullyResizeable() const
Definition: MatrixCharacteristics.h:758
This class collects masks of each characteristic type for representing sets of accceptable characteri...
Definition: MatrixCharacteristics.h:750
RowVector(int n)
Commit to a row vector of a particular length.
Definition: MatrixCharacteristics.h:1017
bool isConditionOK(const MatrixCondition &c) const
Definition: MatrixCharacteristics.h:922
MatrixCommitment & commitNumRows(int m)
Definition: MatrixCharacteristics.h:851
const MatrixCondition & getConditionCommitment() const
Definition: MatrixCharacteristics.h:892
bool isStructureCommitted() const
Definition: MatrixCharacteristics.h:930
unsigned short PositionMask
Definition: MatrixCharacteristics.h:100
bool isSatisfiedBy(const MatrixCharacter &actual) const
Definition: MatrixCharacteristics.h:914
MatrixCharacter::Mask::SizeMask getNumColsMask() const
Definition: MatrixCharacteristics.h:901
Definition: MatrixCharacteristics.h:139
MatrixStorage & setToNone()
Restore this object to its default-constructed state of "none".
Definition: MatrixCharacteristics.h:332
bool isResizeable() const
Definition: MatrixCharacteristics.h:757
OrderMask order
Definition: MatrixCharacteristics.h:275
Vector()
Commit to a resizeable column vector.
Definition: MatrixCharacteristics.h:984
DiagValueMask diagValue
Definition: MatrixCharacteristics.h:159
MatrixOutline(Outline outline)
This is an implicit conversion from the Outline enum to a MatrixOutline object.
Definition: MatrixCharacteristics.h:412
bool isSatisfiedBy(const MatrixOutline &actual) const
Definition: MatrixCharacteristics.h:399
bool isOutlineOK(const MatrixOutline &o) const
Definition: MatrixCharacteristics.h:920
bool isFullyResizeable() const
Definition: MatrixCharacteristics.h:926
MatrixStructure structure
These are the commitments as specified.
Definition: MatrixCharacteristics.h:969
Mask mask() const
Return the commitment mask corresponding to use of "this" condition as a commitment.
Definition: MatrixCharacteristics.h:530
Mask()
Definition: MatrixCharacteristics.h:140
MatrixCommitment & commitNumCols(int n)
Definition: MatrixCharacteristics.h:854
RowVector(int n)
Definition: MatrixCharacteristics.h:739
unsigned int SizeMask
Definition: MatrixCharacteristics.h:754
Structure getStructure() const
Definition: MatrixCharacteristics.h:175
MatrixCondition(Condition cond, Diagonal diag=UnknownDiagonal)
This is an implicit conversion from the Condition enum to a MatrixCondition object.
Definition: MatrixCharacteristics.h:508
void clear()
Set commitment s to "none" and masks to "uncommitted" for all characteristics.
Definition: MatrixCharacteristics.h:940
MatrixCommitment & commitStructure(const MatrixStructure &s)
Definition: MatrixCharacteristics.h:867
MatrixStorage(Packing pk, Placement pl=NoPlacement, Order o=NoOrder, Diagonal d=NoDiag)
This constructor is also an implicit conversion from the Packing enum to a MatrixStorage object which...
Definition: MatrixCharacteristics.h:309
Predefined MatrixCharacter for an ordinary Lapack-style full matrix of a particular dimension m x n (...
Definition: MatrixCharacteristics.h:711
Order
Definition: MatrixCharacteristics.h:230
unsigned short DiagValueMask
Definition: MatrixCharacteristics.h:118
MatrixStorage & setPacking(Packing p)
Definition: MatrixCharacteristics.h:336
MatrixOutline outline
Definition: MatrixCharacteristics.h:971
static MatrixOutline calcFromSize(int m, int n)
Determine the outline from given actual dimensions.
Hermitian()
Definition: MatrixCharacteristics.h:1054
MatrixStructure & setDiagValue(DiagValue d)
Definition: MatrixCharacteristics.h:181
MatrixCharacter & setOutline(const MatrixOutline &oa)
Definition: MatrixCharacteristics.h:640
std::string name() const
Definition: MatrixCharacteristics.h:499
DiagValue
For triangular, symmetric, and hermitian matrices the diagonal elements may have a single...
Definition: MatrixCharacteristics.h:110
static const SizeMask SizeUncommitted
Definition: MatrixCharacteristics.h:755
MatrixStructure(Structure s, Position p=NoPosition, DiagValue d=NoDiagValue)
This constructor is also an implicit conversion from the Structure enum to a MatrixStructure object w...
Definition: MatrixCharacteristics.h:166
int getDefaultNumCols() const
Definition: MatrixCharacteristics.h:906
SkewSymmetric()
Definition: MatrixCharacteristics.h:1069
const MatrixStorage & getStorageCommitment() const
Definition: MatrixCharacteristics.h:890
bool isUncommitted() const
Definition: MatrixCharacteristics.h:146
MatrixStorage storage
Definition: MatrixCharacteristics.h:687
This is the default commitment for a triangular matrix.
Definition: MatrixCharacteristics.h:1029
MatrixCharacter & setStorage(const MatrixStorage &sa)
Definition: MatrixCharacteristics.h:639
bool isSizeOK(int m, int n) const
Definition: MatrixCharacteristics.h:908
int getDefaultUpperBandwidth() const
Definition: MatrixCharacteristics.h:773
MatrixCharacter & setActualNumRows(int m)
Definition: MatrixCharacteristics.h:647
Mask mask() const
When "this" outline is used as a commitment, it represents a mask of acceptable outlines.
Definition: MatrixCharacteristics.h:424
MatrixStructure()
Definition: MatrixCharacteristics.h:162
MatrixOutline & setToNone()
Set the outline back to its default-constructed value of "none".
Definition: MatrixCharacteristics.h:415
bool isOutlineCommitted() const
Definition: MatrixCharacteristics.h:934
SizeMask uband
upper bandwidth, if banded
Definition: MatrixCharacteristics.h:814
int uband
actual upper bandwidth, if banded
Definition: MatrixCharacteristics.h:684
This is the default commitment for a row vector.
Definition: MatrixCharacteristics.h:1005
Mask(ConditionMask cmask, DiagonalMask dmask)
Definition: MatrixCharacteristics.h:486
int lband
actual lower bandwidth, if banded
Definition: MatrixCharacteristics.h:684
unsigned int getLowerBandwidthMask() const
Definition: MatrixCharacteristics.h:764
int getDefaultNumRows() const
Definition: MatrixCharacteristics.h:905
int ncol() const
Definition: MatrixCharacteristics.h:619
Predefined MatrixCharacter for an ordinary row vector of a particular size.
Definition: MatrixCharacteristics.h:737
bool isSatisfiedBy(const MatrixCondition &actual) const
Definition: MatrixCharacteristics.h:491
bool isStructureOK(const MatrixStructure &s) const
Definition: MatrixCharacteristics.h:916
Mask(OutlineMask mask)
Definition: MatrixCharacteristics.h:396
This is a user-includable header which includes everything needed to make use of SimMatrix Scalar cod...
MatrixCharacter(int m, int n, int lb, int ub, MatrixStructure structure, MatrixStorage storage, MatrixCondition condition)
Definition: MatrixCharacteristics.h:671
Diagonal getDiagonal() const
Definition: MatrixCharacteristics.h:534
MatrixCondition()
The default constructor sets the condition to Unknown, which is typically where it remains...
Definition: MatrixCharacteristics.h:504
const MatrixStructure & getStructure() const
Definition: MatrixCharacteristics.h:628
MatrixCharacter & setUpperBandwidth(int ub)
Definition: MatrixCharacteristics.h:662
unsigned short PackingMask
Definition: MatrixCharacteristics.h:216
Mask()
Definition: MatrixCharacteristics.h:752
Mask & setToUncommitted()
Definition: MatrixCharacteristics.h:397
PlacementMask placement
Definition: MatrixCharacteristics.h:274
bool isSatisfiedBy(const MatrixStorage &actual) const
Definition: MatrixCharacteristics.h:269
MatrixCharacter::Mask masks
These are the bitmasks of acceptable characteristics which would satisfy the above-specified commitme...
Definition: MatrixCharacteristics.h:976
MatrixCharacter & setToNone()
Restore this MatrixCharacter to its default-constructed state of "none".
Definition: MatrixCharacteristics.h:609
bool isNumRowsLocked() const
Definition: MatrixCharacteristics.h:759
Position getPosition() const
Definition: MatrixCharacteristics.h:176
bool isStorageCommitted() const
Definition: MatrixCharacteristics.h:932
MatrixCharacter & setActualSize(int m, int n)
Set the actual size and update the outline to match.
Definition: MatrixCharacteristics.h:645
RowVector()
Commit to a resizeable row vector.
Definition: MatrixCharacteristics.h:1008
Mask & setToUncommitted()
Definition: MatrixCharacteristics.h:487
int nrow() const
These are dimensions of the logical matrix and have nothing to do with how much storage may be used t...
Definition: MatrixCharacteristics.h:618
MatrixStorage & setMissingAttributes()
Assuming this is an actual matrix description, set any unspecified attributes to appropriate defaults...
Definition: MatrixCharacteristics.h:319
bool isResizeable() const
Definition: MatrixCharacteristics.h:925
Condition getCondition() const
Definition: MatrixCharacteristics.h:533
int getLowerBandwidth() const
Definition: MatrixCharacteristics.h:623
Outline getOutline() const
Return the outline value stored in this MatrixOutline object.
Definition: MatrixCharacteristics.h:436
Position
For triangular matrices, we have to know which triangle we&#39;re talking about.
Definition: MatrixCharacteristics.h:93
MatrixCommitment & commitOutline(const MatrixOutline &o)
Definition: MatrixCharacteristics.h:871
MatrixCommitment & commitLowerBandwidth(int lb)
Definition: MatrixCharacteristics.h:860
MatrixStorage & setOrder(Order o)
Definition: MatrixCharacteristics.h:338
Order getOrder() const
Definition: MatrixCharacteristics.h:343
std::ostream & operator<<(std::ostream &o, const ContactForce &f)
Definition: CompliantContactSubsystem.h:387
const MatrixStorage::Mask & getStorageMask() const
Definition: MatrixCharacteristics.h:896
bool isUncommitted() const
Return if all fields are set to "Uncommitted" (all bits are one).
Definition: MatrixCharacteristics.h:784
Diagonal getDiagonal() const
Definition: MatrixCharacteristics.h:344
MatrixCommitment & commitCondition(const MatrixCondition &c)
Definition: MatrixCharacteristics.h:873
Diagonal
Definition: MatrixCharacteristics.h:240
MatrixCommitment & commitStorage(const MatrixStorage &s)
Definition: MatrixCharacteristics.h:869
MatrixStorage()
Default constructor leaves all fields unspecified.
Definition: MatrixCharacteristics.h:303
Mask()
Definition: MatrixCharacteristics.h:395
DiagonalMask diagonal
Definition: MatrixCharacteristics.h:496
MatrixCharacter & setStructure(const MatrixStructure &sa)
Definition: MatrixCharacteristics.h:638
DiagValue getDiagValue() const
Definition: MatrixCharacteristics.h:177
This is a fixed-length row vector designed for no-overhead inline computation.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:619
MatrixCondition & setCondition(Condition c)
Definition: MatrixCharacteristics.h:536
Definition: MatrixCharacteristics.h:381
unsigned short PlacementMask
Definition: MatrixCharacteristics.h:226
MatrixOutline::Mask outline
Definition: MatrixCharacteristics.h:818
MatrixCommitment(const MatrixStructure &str)
This is an implicit conversion from a MatrixStructure specification to a MatrixCommitment with storag...
Definition: MatrixCharacteristics.h:838
const MatrixCondition::Mask & getConditionMask() const
Definition: MatrixCharacteristics.h:898
#define SimTK_SIZECHECK_NONNEG(sz, where)
Definition: ExceptionMacros.h:147
MatrixCondition condition
Definition: MatrixCharacteristics.h:972
bool isSatisfiedBy(const MatrixStructure &actual) const
Definition: MatrixCharacteristics.h:153
Diagonal
Definition: MatrixCharacteristics.h:470
bool isUncommitted() const
Definition: MatrixCharacteristics.h:489
Mask mask() const
Calculate the commitment mask associated with specifying "this" set of storage attributes as a commit...
Definition: MatrixCharacteristics.h:293
MatrixStorage & setDiagonal(Diagonal d)
Definition: MatrixCharacteristics.h:339
const MatrixOutline & getOutlineCommitment() const
Definition: MatrixCharacteristics.h:891
Mask()
Definition: MatrixCharacteristics.h:253
MatrixStructure & setToNone()
Definition: MatrixCharacteristics.h:186
DiagonalMask diagonal
Definition: MatrixCharacteristics.h:276
Mask & setToUncommitted()
Definition: MatrixCharacteristics.h:143
This is the default commitment for skew symmetric (not skew Hermitian) matrix.
Definition: MatrixCharacteristics.h:1067
bool isNumColsLocked() const
Definition: MatrixCharacteristics.h:928
Mask(StructureMask sm, PositionMask pm, DiagValueMask dm)
Definition: MatrixCharacteristics.h:141
MatrixStorage(Packing pk, Order o)
This constructor is for the common case of just packing and order, with no particular placement and a...
Definition: MatrixCharacteristics.h:314
Represents a variable size row vector; much less common than the column vector type Vector_...
Definition: BigMatrix.h:174
std::pair< int, int > getBandwidth() const
Definition: MatrixCharacteristics.h:625
bool isNumRowsLocked() const
Definition: MatrixCharacteristics.h:927
std::string name() const
Definition: MatrixCharacteristics.h:133
SizeMask nc
number of columns
Definition: MatrixCharacteristics.h:812
SkewHermitian()
Definition: MatrixCharacteristics.h:1084
A MatrixCommitment provides a set of acceptable matrix characteristics.
Definition: MatrixCharacteristics.h:832
unsigned int getUpperBandwidthMask() const
Definition: MatrixCharacteristics.h:765
bool isBandwidthOK(int lower, int upper) const
Check whether an actual bandwidth satisfies the bandwidth commitment.
Definition: MatrixCharacteristics.h:808
unsigned short DiagonalMask
Definition: MatrixCharacteristics.h:479
const MatrixOutline & getOutline() const
Definition: MatrixCharacteristics.h:630
PositionMask position
Definition: MatrixCharacteristics.h:158
ConditionMask condition
Definition: MatrixCharacteristics.h:495
This is the default commitment for a Hermitian (not symmetric) matrix.
Definition: MatrixCharacteristics.h:1052
bool isConditionCommitted() const
Definition: MatrixCharacteristics.h:936
Condition
Definition: MatrixCharacteristics.h:456
const MatrixCondition & getCondition() const
Definition: MatrixCharacteristics.h:631
MatrixCommitment()
Definition: MatrixCharacteristics.h:834
ptrdiff_t nelt() const
Definition: MatrixCharacteristics.h:621
This is the default commitment for a symmetric (not Hermitian) matrix.
Definition: MatrixCharacteristics.h:1040
int getDefaultNumRows() const
Definition: MatrixCharacteristics.h:767
MatrixCondition condition
Definition: MatrixCharacteristics.h:689
int nr
actual number of rows
Definition: MatrixCharacteristics.h:682
MatrixStorage & setPlacement(Placement p)
Definition: MatrixCharacteristics.h:337
MatrixStorage::Mask storage
Definition: MatrixCharacteristics.h:817
MatrixStructure & setStructure(Structure s)
Definition: MatrixCharacteristics.h:179
bool isStorageOK(const MatrixStorage &s) const
Definition: MatrixCharacteristics.h:918
unsigned short DiagonalMask
Definition: MatrixCharacteristics.h:246
MatrixOutline outline
Definition: MatrixCharacteristics.h:688
std::string name() const
Definition: MatrixCharacteristics.h:405
MatrixStructure::Mask structure
Definition: MatrixCharacteristics.h:816
Triangular()
Definition: MatrixCharacteristics.h:1031
MatrixCharacter & setBandwidth(int lb, int ub)
Definition: MatrixCharacteristics.h:652
SizeMask lband
lower bandwidth, if banded
Definition: MatrixCharacteristics.h:814
MatrixOutline()
Default constructor produces an object containing no outline specification.
Definition: MatrixCharacteristics.h:409
unsigned int getNumColsMask() const
Definition: MatrixCharacteristics.h:763
int getDefaultLowerBandwidth() const
Definition: MatrixCharacteristics.h:772
bool isLowerBandwidthLocked() const
Definition: MatrixCharacteristics.h:770
MatrixStructure structure
Definition: MatrixCharacteristics.h:686
bool isBandwidthOK(int lower, int upper) const
Definition: MatrixCharacteristics.h:912
Symmetric()
Definition: MatrixCharacteristics.h:1042
MatrixCommitment(const MatrixStructure &structure, const MatrixStorage &storage, const MatrixOutline &outline, const MatrixCondition &condition)
Definition: MatrixCharacteristics.h:949
unsigned int getNumRowsMask() const
Definition: MatrixCharacteristics.h:762
This is the default commitment for a column vector.
Definition: MatrixCharacteristics.h:981
MatrixCharacter & setLowerBandwidth(int lb)
Definition: MatrixCharacteristics.h:657
Definition: MatrixCharacteristics.h:380
Mask & setToUncommitted()
Set all bits to one ("Uncommitted").
Definition: MatrixCharacteristics.h:776
bool isSatisfiedBy(const MatrixCharacter &actual) const
Check whether an actual matrix character satisfies this matrix commitment.
Definition: MatrixCharacteristics.h:792
unsigned short OutlineMask
Definition: MatrixCharacteristics.h:390
const MatrixStructure & getStructureCommitment() const
These report the commitment as it was specified.
Definition: MatrixCharacteristics.h:889
const MatrixStructure::Mask & getStructureMask() const
These report the masks of acceptable values generated from the commitment.
Definition: MatrixCharacteristics.h:895
std::pair< int, int > getSize() const
Definition: MatrixCharacteristics.h:620
unsigned int StructureMask
Definition: MatrixCharacteristics.h:84