SheafSystem  0.0.0.0
general_matrix_2x2.impl.h
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
18 // Implementation for general_matrix_2x2.
19 
20 
21 #ifndef GENERAL_MATRIX_2X2_IMPL_H
22 #define GENERAL_MATRIX_2X2_IMPL_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef ASSERT_CONTRACT_H
29 #include "SheafSystem/assert_contract.h"
30 #endif
31 
32 #ifndef ERROR_MESSAGE_H
33 #include "SheafSystem/error_message.h"
34 #endif
35 
36 #ifndef ANTISYMMETRIC_MATRIX_2X2_H
37 #include "SheafSystem/antisymmetric_matrix_2x2.h"
38 #endif
39 
40 #ifndef GENERAL_MATRIX_1X2_H
41 #include "SheafSystem/general_matrix_1x2.h"
42 #endif
43 
44 #ifndef GENERAL_MATRIX_2X1_H
45 #include "SheafSystem/general_matrix_2x1.h"
46 #endif
47 
48 #ifndef GENERAL_MATRIX_2X2_H
49 #include "SheafSystem/general_matrix_2x2.h"
50 #endif
51 
52 #ifndef GENERAL_MATRIX_2X3_H
53 #include "SheafSystem/general_matrix_2x3.h"
54 #endif
55 
56 #ifndef SYMMETRIC_MATRIX_2X2_H
57 #include "SheafSystem/symmetric_matrix_2x2.h"
58 #endif
59 
60 #ifndef STD_SSTREAM_H
61 #include "SheafSystem/std_sstream.h"
62 #endif
63 
64 #ifndef STD_CMATH_H
65 #include "SheafSystem/std_cmath.h"
66 #endif
67 
68 namespace fiber_bundle
69 {
70 
71 using namespace sheaf;
72 
73 //==============================================================================
74 // MEMBER FUNCTIONS
75 //==============================================================================
76 
78 template <typename T>
79 general_matrix_2x2<T>::
80 operator gl2_row_dofs_type<T>& () const
81 {
82  // Preconditions:
83 
84  // Body:
85 
86  T* lcomps = const_cast<T*>(components);
87 
88  gl2_row_dofs_type<T>& result =
89  reinterpret_cast<gl2_row_dofs_type<T>&>(*lcomps);
90 
91  // Postconditions:
92 
93  // Exit:
94 
95  return result;
96 }
97 
99 template <typename T>
101 operator t02_e2_row_dofs_type<T>& () const
102 {
103  // Preconditions:
104 
105  // Body:
106 
107  T* lcomps = const_cast<T*>(components);
108 
109  t02_e2_row_dofs_type<T>& result =
110  reinterpret_cast<t02_e2_row_dofs_type<T>&>(*lcomps);
111 
112  // Postconditions:
113 
114  // Exit:
115 
116  return result;
117 }
118 
120 template <typename T>
122 operator t11_e2_row_dofs_type<T>& () const
123 {
124  // Preconditions:
125 
126  // Body:
127 
128  T* lcomps = const_cast<T*>(components);
129 
130  t11_e2_row_dofs_type<T>& result =
131  reinterpret_cast<t11_e2_row_dofs_type<T>&>(*lcomps);
132 
133  // Postconditions:
134 
135  // Exit:
136 
137  return result;
138 }
139 
140 
142 template <typename T>
143 int
146 {
147  // Preconditions:
148 
149  // Body:
150 
151  // Postconditions:
152 
153  // Exit:
154 
155  return 2;
156 }
157 
159 template <typename T>
160 int
163 {
164  // Preconditions:
165 
166  // Body:
167 
168  // Postconditions:
169 
170  // Exit:
171 
172  return 2;
173 }
174 
176 template <typename T>
177 int
179 d()
180 {
181  // Preconditions:
182 
183  // Body:
184 
185  // Postconditions:
186 
187  // Exit:
188 
189  return 4;
190 }
191 
193 template <typename T>
194 T*
196 operator[](int xrow)
197 {
198  // Preconditions:
199 
200  require(xrow >= 0 && xrow < number_of_rows());
201 
202  // Body:
203 
204  T* result = &components[row_index(xrow)];
205 
206  // Postconditions:
207 
208  ensure(result != 0);
209 
210  // Exit:
211 
212  return result;
213 }
214 
215 template <typename T>
216 const T*
218 operator[](int xrow) const
219 {
220  // Preconditions:
221 
222  require(xrow >= 0 && xrow < number_of_rows());
223 
224  // Body:
225 
226  const T* result = &components[row_index(xrow)];
227 
228  // Postconditions:
229 
230  ensure(result != 0);
231 
232  // Exit:
233 
234  return result;
235 }
236 
238 template <typename T>
240 operator T* ()
241 {
242  // Preconditions:
243 
244  // Body:
245 
246  //cout << "general_matrix_2x2<T>::operator T* () " << std::endl;
247 
248  T* result = components;
249 
250  // Postconditions:
251 
252  ensure(result != 0);
253 
254  // Exit:
255 
256  return result;
257 }
258 
260 template <typename T>
262 operator const T* () const
263 {
264  // Preconditions:
265 
266  // Body:
267 
268  //cout << "general_matrix_2x2<T>::operator const T* () const " << std::endl;
269 
270  const T* result = components;
271 
272  // Postconditions:
273 
274  ensure(result != 0);
275 
276  // Exit:
277 
278  return result;
279 }
280 
282 template <typename T>
283 int
285 row_index(int xrow) const
286 {
287 
288  // Preconditions:
289 
290  require(xrow >= 0 && xrow < number_of_rows());
291 
292  // Body:
293 
294  int result = number_of_columns()*xrow;
295 
296  // Postconditions:
297 
298  ensure(result == number_of_columns()*xrow);
299 
300  // Exit:
301 
302  return result;
303 }
304 
306 template <typename T>
309 row(int xrow) const
310 {
311  // Preconditions:
312 
313  require(xrow >= 0 && xrow < number_of_rows());
314 
315  // Body:
316 
317  general_matrix_1x2<T> result;
318 
319  int lindex = row_index(xrow);
320  result.components[0] = components[lindex++];
321  result.components[1] = components[lindex];
322 
323  // Postconditions:
324 
325  // Exit:
326 
327  return result;
328 
329 }
330 
332 template <typename T>
335 column(int xcolumn) const
336 {
337  // Preconditions:
338 
339  require(xcolumn >= 0 && xcolumn < number_of_columns());
340 
341  // Body:
342 
343  general_matrix_2x1<T> result;
344 
345  int lindex = xcolumn;
346  result.components[0] = components[lindex];
347  lindex += 2; // += number_of_columns();
348  result.components[1] = components[lindex];
349 
350  // Postconditions:
351 
352  // Exit:
353 
354  return result;
355 
356 }
357 
359 template <typename T>
360 void
362 adjoint(general_matrix_2x2<T>& xresult) const
363 {
364  // Preconditions:
365 
366  // Body:
367 
368  const general_matrix_2x2<T>& lm = *this;
369 
370  T a00 = lm[0][0];
371  T a01 = lm[0][1];
372  T a10 = lm[1][0];
373  T a11 = lm[1][1];
374 
375  // Adjoint is the transpose of the cofactor matrix.
376 
377  xresult[0][0] = a11;
378  xresult[0][1] = -a01;
379  xresult[1][0] = -a10;
380  xresult[1][1] = a00;
381 
382  // Postconditions:
383 
384  // Exit:
385 }
386 
388 template <typename T>
391 adjoint() const
392 {
393  // Preconditions:
394 
395  // Body:
396 
397  general_matrix_2x2<T> result;
398  adjoint(result);
399 
400  // Postconditions:
401 
402  // Exit:
403 
404  return result;
405 }
406 
408 template <typename T>
409 void
411 assign(const T& xvalue)
412 {
413  // Preconditions:
414 
415  // Body:
416 
417  for(int i=0; i<d(); ++i)
418  {
419  components[i] = xvalue;
420  }
421 
422  // Postconditions:
423 
424  ensure_for_all(i, 0, d(), components[i] == xvalue);
425 
426  // Exit:
427 
428 }
429 
431 template <typename T>
432 void
434 determinant(T& xresult) const
435 {
436  // Preconditions:
437 
438  // Body:
439 
440  const general_matrix_2x2<T>& lm = *this;
441 
442  T a00 = lm[0][0];
443  T a01 = lm[0][1];
444  T a10 = lm[1][0];
445  T a11 = lm[1][1];
446 
447  xresult = a00*a11 - a01*a10;
448 
449  // Postconditions:
450 
451  // Exit:
452 
453 }
454 
456 template <typename T>
457 T
459 determinant() const
460 {
461  // Preconditions:
462 
463  // Body:
464 
465  T result;
466 
467  determinant(result);
468 
469  // Postconditions:
470 
471  // Exit:
472 
473  return result;
474 }
475 
477 template <typename T>
478 void
481 {
482  // Preconditions:
483 
484  // Body:
485 
486  // Calculate the eigenvalues of the matrix.
487 
488  const general_matrix_2x2<T>& lm = *this;
489 
490  T a00 = lm[0][0];
491  T a01 = lm[0][1];
492  T a10 = lm[1][0];
493  T a11 = lm[1][1];
494 
495  // For a 2x2 matrix just solve the quadratic equation.
496 
497  //T a = 1.0;
498  T b = -(a00 + a11);
499  T c = a00*a11 - a01*a10;
500 
501  //T discriminant = b*b - 4.0*a*c;
502  //T sqrt_discriminant = sqrt(discriminant);
503 
504  //T lambda_0 = (-b-sqrt_discriminant)/(2.0*a);
505  //T lambda_1 = (-b+sqrt_discriminant)/(2.0*a);
506 
507  T discriminant = b*b - 4.0*c;
508 
509  if(discriminant < 0.0)
510  {
511  post_fatal_error_message("Matrix has 2 complex roots.");
512  }
513 
514  T sqrt_discriminant = sqrt(discriminant);
515 
516  T lambda_0 = 0.5*(-b-sqrt_discriminant);
517  T lambda_1 = 0.5*(-b+sqrt_discriminant);
518 
519  // Assign the diagonals of the result matrix to the
520  // eigenvalues and zero to the rest of the elements.
521 
522  // Sort into accending order.
523 
524  xresult[0][0] = (lambda_0 < lambda_1) ? lambda_0 : lambda_1;
525  xresult[0][1] = 0;
526  xresult[1][0] = 0;
527  xresult[1][1] = (lambda_1 < lambda_0) ? lambda_0 : lambda_1;
528 
529  // Postconditions:
530 
531  ensure(xresult.is_diagonal());
532  ensure(unexecutable("for_all i, 0, 2, xresult[i][i] == real number"));
533 
534  // Exit:
535 
536 }
537 
539 template <typename T>
543 {
544  // Preconditions:
545 
546  // Body:
547 
548  general_matrix_2x2<T> result;
549  diagonalization(result);
550 
551  // Postconditions:
552 
553  ensure(result.is_diagonal());
554  ensure(unexecutable("for_all i, 0, 2, result[i][i] == real number"));
555 
556  // Exit:
557 
558  return result;
559 }
560 
562 template <typename T>
563 void
566 {
567  // Preconditions:
568 
569  // Body:
570 
571  const T one = T(1);
572  const T zero = T(0);
573 
574  xresult[0][0] = one;
575  xresult[0][1] = zero;
576  xresult[1][0] = zero;
577  xresult[1][1] = one;
578 
579  // Postconditions:
580 
581  ensure(xresult.is_identity());
582 
583  // Exit:
584 }
585 
587 template <typename T>
590 identity() const
591 {
592  // Preconditions:
593 
594  // Body:
595 
596  general_matrix_2x2<T> result;
597  identity(result);
598 
599  // Postconditions:
600 
601  ensure(result.is_identity());
602 
603  // Exit:
604 
605  return result;
606 }
607 
608 
610 template <typename T>
611 void
614 {
615  // Preconditions:
616 
617  // Body:
618 
619  const general_matrix_2x2<T>& lm = *this;
620 
621  // Get the determinant.
622 
623  T a00 = lm[0][0];
624  T a01 = lm[0][1];
625  T a10 = lm[1][0];
626  T a11 = lm[1][1];
627 
628  T determinant = a00*a11 - a01*a10;
629 
630  if(determinant == 0.0)
631  {
632  post_fatal_error_message("No inverse; determinant is zero.");
633  }
634 
635  xresult[0][0] = a11/determinant;
636  xresult[0][1] = -a01/determinant;
637  xresult[1][0] = -a10/determinant;
638  xresult[1][1] = a00/determinant;
639 
640  // Postconditions:
641 
642  // Exit:
643 }
644 
646 template <typename T>
649 inverse() const
650 {
651  // Preconditions:
652 
653  // Body:
654 
655  general_matrix_2x2<T> result;
656  inverse(result);
657 
658  // Postconditions:
659 
660  // Exit:
661 
662  return result;
663 }
664 
666 template <typename T>
667 bool
670 {
671  // Preconditions:
672 
673  // Body:
674 
675  const general_matrix_2x2<T>& lm = *this;
676 
677  bool result = (lm[0][0]==0.0) && (lm[1][1]==0.0) && (lm[1][0]==-lm[0][1]);
678 
679  // Postconditions:
680 
681  // Exit:
682 
683  return result;
684 
685 }
686 
688 template <typename T>
689 bool
691 is_diagonal() const
692 {
693  // Preconditions:
694 
695  // Body:
696 
697  const general_matrix_2x2<T>& lm = *this;
698 
699  bool result = (lm[0][1]==0.0) && (lm[1][0]==0.0);
700 
701  // Postconditions:
702 
703  // Exit:
704 
705  return result;
706 
707 }
708 
710 template <typename T>
711 bool
713 is_identity() const
714 {
715  // Preconditions:
716 
717  // Body:
718 
719  const general_matrix_2x2<T>& lm = *this;
720 
721  bool result = is_diagonal() && (lm[0][0]==1.0) && (lm[1][1]==1.0);
722 
723  // Postconditions:
724 
725  // Exit:
726 
727  return result;
728 
729 }
730 
732 template <typename T>
733 bool
736 {
737  // Preconditions:
738 
739  // Body:
740 
741  //$ISSUE: Does this test mean anything for the general case? Maybe.
742  // See http://mathworld.wolfram.com/PositiveDefiniteMatrix.html.
743 
744  // Get the symmetric part and test it.
745 
746  symmetric_matrix_2x2<T> lsym = symmetric_part();
747  bool result = lsym.is_positive_definite();
748 
749  // Postconditions:
750 
751  // Exit:
752 
753  return result;
754 }
755 
757 template <typename T>
758 bool
761 {
762  // Preconditions:
763 
764  // Body:
765 
766  const general_matrix_2x2<T>& lm = *this;
767 
768  bool result = (lm[1][0]==lm[0][1]);
769 
770  // Postconditions:
771 
772  // Exit:
773 
774  return result;
775 
776 }
777 
779 template <typename T>
780 void
782 multiply(const T& xscalar, general_matrix_2x2<T>& xresult) const
783 {
784  // Preconditions:
785 
786  // Body:
787 
788  for(int i=0; i<d(); ++i)
789  {
790  xresult.components[i] = xscalar*components[i];
791  }
792 
793  // Postconditions:
794 
795  //@issue $$ISSUE: We can't make the following comparison because of
796  // floating point roundoff.
797  //ensure_for_all(i, 0, d(), xresult.components[i] == xscalar*components[i]);
798 
799  // Exit:
800 
801 }
802 
804 template <typename T>
807 multiply(const T& xscalar) const
808 {
809  // Preconditions:
810 
811  // Body:
812 
813  general_matrix_2x2<T> result;
814  multiply(xscalar, result);
815 
816  // Postconditions:
817 
818  // Exit:
819 
820  return result;
821 }
822 
824 template <typename T>
825 void
828  general_matrix_2x1<T>& xresult) const
829 {
830  // Preconditions:
831 
832  // Body:
833 
834  // Multiply [A][B] where [A] = *this & [B] = xother.
835 
836  const general_matrix_2x2<T>& lm = *this;
837 
838  int nra = number_of_rows();
839  int nca = number_of_columns();
840  int ncb = xother.number_of_columns();
841 
842  for(int i=0; i<nra; ++i)
843  {
844  for(int j=0; j<ncb; ++j)
845  {
846  T sum = T(0);
847 
848  for(int k=0; k<nca; ++k)
849  {
850  sum += lm[i][k]*xother[k][j];
851  }
852 
853  xresult[i][j] = sum;
854  }
855  }
856 
857  // Postconditions:
858 
859  // Exit:
860 
861 }
862 
864 template <typename T>
867 multiply(const general_matrix_2x1<T>& xother) const
868 {
869  // Preconditions:
870 
871  // Body:
872 
873  general_matrix_2x1<T> result;
874  multiply(xother, result);
875 
876  // Postconditions:
877 
878  // Exit:
879 
880  return result;
881 }
882 
884 template <typename T>
885 void
888  general_matrix_2x2<T>& xresult) const
889 {
890  // Preconditions:
891 
892  // Body:
893 
894  // Multiply [A][B] where [A] = *this & [B] = xother.
895 
896  const general_matrix_2x2<T>& lm = *this;
897 
898  int nra = number_of_rows();
899  int nca = number_of_columns();
900  int ncb = xother.number_of_columns();
901 
902  for(int i=0; i<nra; ++i)
903  {
904  for(int j=0; j<ncb; ++j)
905  {
906  T sum = T(0);
907 
908  for(int k=0; k<nca; ++k)
909  {
910  sum += lm[i][k]*xother[k][j];
911  }
912 
913  xresult[i][j] = sum;
914  }
915  }
916 
917  // Postconditions:
918 
919  // Exit:
920 
921 }
922 
924 template <typename T>
927 multiply(const general_matrix_2x2<T>& xother) const
928 {
929  // Preconditions:
930 
931  // Body:
932 
933  general_matrix_2x2<T> result;
934  multiply(xother, result);
935 
936  // Postconditions:
937 
938  // Exit:
939 
940  return result;
941 }
942 
944 template <typename T>
945 void
948  general_matrix_2x3<T>& xresult) const
949 {
950  // Preconditions:
951 
952  // Body:
953 
954  // Multiply [A][B] where [A] = *this & [B] = xother.
955 
956  const general_matrix_2x2<T>& lm = *this;
957 
958  int nra = number_of_rows();
959  int nca = number_of_columns();
960  int ncb = xother.number_of_columns();
961 
962  for(int i=0; i<nra; ++i)
963  {
964  for(int j=0; j<ncb; ++j)
965  {
966  T sum = T(0);
967 
968  for(int k=0; k<nca; ++k)
969  {
970  sum += lm[i][k]*xother[k][j];
971  }
972 
973  xresult[i][j] = sum;
974  }
975  }
976 
977  // Postconditions:
978 
979  // Exit:
980 
981 }
982 
984 template <typename T>
987 multiply(const general_matrix_2x3<T>& xother) const
988 {
989  // Preconditions:
990 
991  // Body:
992 
993  general_matrix_2x3<T> result;
994  multiply(xother, result);
995 
996  // Postconditions:
997 
998  // Exit:
999 
1000  return result;
1001 }
1002 
1004 template <typename T>
1005 void
1007 trace(T& xresult) const
1008 {
1009  // Preconditions:
1010 
1011  // Body:
1012 
1013  const general_matrix_2x2<T>& lm = *this;
1014 
1015  // Unroll the loop for efficiency.
1016 
1017  xresult = lm[0][0] + lm[1][1];
1018 
1019  // Postconditions:
1020 
1021  // Exit:
1022 }
1023 
1025 template <typename T>
1026 T
1028 trace() const
1029 {
1030  // Preconditions:
1031 
1032  // Body:
1033 
1034  T result;
1035 
1036  trace(result);
1037 
1038  // Postconditions:
1039 
1040  // Exit:
1041 
1042  return result;
1043 }
1044 
1046 template <typename T>
1047 void
1050 {
1051  // Preconditions:
1052 
1053  // Body:
1054 
1055  const general_matrix_2x2<T>& lm = *this;
1056 
1057  xresult[0][0] = lm[0][0];
1058  xresult[0][1] = lm[1][0];
1059  xresult[1][0] = lm[0][1];
1060  xresult[1][1] = lm[1][1];
1061 
1062  // Postconditions:
1063 
1064  // Exit:
1065 
1066 }
1067 
1069 template <typename T>
1072 transpose() const
1073 {
1074  // Preconditions:
1075 
1076  // Body:
1077 
1078  general_matrix_2x2<T> result;
1079  transpose(result);
1080 
1081  // Postconditions:
1082 
1083  // Exit:
1084 
1085  return result;
1086 }
1087 
1089 template <typename T>
1090 void
1093 {
1094  // Preconditions:
1095 
1096  // Body:
1097 
1098  // A - A(transpose) is the antisymmetric part.
1099 
1100  const general_matrix_2x2<T>& lm = *this;
1101 
1102  xresult[0][1] = 2.0*lm[0][1];
1103 
1104  // Postconditions:
1105 
1106  // Exit:
1107 }
1108 
1110 template <typename T>
1114 {
1115  // Preconditions:
1116 
1117  // Body:
1118 
1120  antisymmetric_part(result);
1121 
1122  // Postconditions:
1123 
1124  // Exit:
1125 
1126  return result;
1127 }
1128 
1129 
1131 template <typename T>
1132 void
1135 {
1136  // Preconditions:
1137 
1138  // Body:
1139 
1140  // A + A(transpose) is the antisymmetric part.
1141 
1142  const general_matrix_2x2<T>& lm = *this;
1143 
1144  xresult[0][0] = 2.0*lm[0][0];
1145  xresult[0][1] = lm[0][1] + lm[1][0];
1146  xresult[1][1] = 2.0*lm[1][1];
1147 
1148  // Postconditions:
1149 
1150  // Exit:
1151 }
1152 
1154 template <typename T>
1158 {
1159  // Preconditions:
1160 
1161  // Body:
1162 
1163  symmetric_matrix_2x2<T> result;
1164  symmetric_part(result);
1165 
1166  // Postconditions:
1167 
1168  // Exit:
1169 
1170  return result;
1171 }
1172 
1173 // =============================================================================
1174 // NON-MEMBER FUNCTIONS
1175 // =============================================================================
1176 
1177 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
1178 
1180 template <typename T>
1181 std::ostream& operator<<(std::ostream& xos, const general_matrix_2x2<T>& xm)
1182 {
1183  // Preconditions:
1184 
1185  // Body:
1186 
1187  xos << " " << xm[0][0] << " " << xm[0][1] << std::endl;
1188  xos << " " << xm[1][0] << " " << xm[1][1] << std::endl;
1189 
1190  // Postconditions:
1191 
1192  // Exit:
1193 
1194  return xos;
1195 }
1196 
1197 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
1198 
1199 //==============================================================================
1200 //==============================================================================
1201 
1202 } // namespace fiber_bundle
1203 
1204 #endif // GENERAL_MATRIX_2X2_IMPL_H
1205 
SHEAF_DLL_SPEC void sqrt(const sec_at0 &x0, sec_at0 &xresult, bool xauto_access)
Compute sqrt of x0 (sqrt(x0)) (pre-allocated version).
Definition: sec_at0.cc:1556
bool is_positive_definite() const
True if this matrix is positive definite.
T components[2]
Linear storage array.
bool is_identity() const
True if this is an identity matrix.
T trace() const
The trace of the matrix (auto-allocated).
void assign(const T &xvalue)
Assign all elements of this matrix to the value xvalue.
bool is_positive_definite() const
True if this matrix is positive definite.
static int number_of_columns()
The number of columns.
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
general_matrix_2x2< T > inverse() const
The inverse of the matrix (auto-allocated).
static int number_of_columns()
The number of columns.
general_matrix_2x2< T > transpose() const
The transpose of the matrix (auto-allocated).
symmetric_matrix_2x2< T > symmetric_part() const
The symmetric part of a this matrix (auto-allocated).
general_matrix_2x1< T > column(int xcolumn) const
A 2x1 matrix containing the elements or column xcolumn.
T components[4]
Linear storage array.
General matrix with 1 row and 2 columns.
General matrix with 2 rows and 2 columns.
T components[2]
Linear storage array.
general_matrix_2x2< T > adjoint() const
The adjoint of the matrix (auto-allocated).
Row dofs type for class gl2.
Definition: gl2.h:50
general_matrix_2x2< T > diagonalization() const
The diagonalization of the matrix (auto-allocated).
void trace(const S0 &x0, SR &xresult, bool xauto_access)
Definition: sec_st2.impl.h:99
void multiply(const T &xscalar, general_matrix_2x2< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
int row_index(int xrow) const
Index for row xrow in the linear storage array.
general_matrix_2x2< T > identity() const
The identity matrix (auto-allocated).
Symmetric matrix with 2 rows and 2 columns.
General matrix with 2 rows and 1 column.
antisymmetric_matrix_2x2< T > antisymmetric_part() const
The antisymmetric part of a this matrix (auto-allocated).
Antisymmetric matrix with 2 rows and 2 columns.
bool is_diagonal() const
True if this matrix is diagonal.
bool is_antisymmetric() const
True if this matrix is antisymmetric.
void determinant(const S0 &x0, SR &xresult, bool xauto_access)
Definition: sec_st2.impl.h:131
T determinant() const
The determinant of the matrix (auto-allocated).
static int number_of_rows()
The number of rows.
general_matrix_1x2< T > row(int xrow) const
A 1x2 matrix containing the elements or row xrow.
Namespace for the sheaves component of the sheaf system.
General matrix with 2 rows and 3 columns.
static int d()
Dimension of the underlying elements.
static int number_of_columns()
The number of columns.
bool is_symmetric() const
True if this matrix is symmetric.
SHEAF_DLL_SPEC void multiply(const vd &x0, const vd_value_type &x1, vd &xresult, bool xauto_access)
Vector x0 multiplied by scalar x1 (pre-allocated version for persistent types).
Definition: vd.cc:1924
Namespace for the fiber_bundles component of the sheaf system.
SHEAF_DLL_SPEC void inverse(const gl2_lite &xlite, gl2_lite &xresult)
Inverse (pre-allocated version for volatile type).
Definition: gl2.cc:1484