SheafSystem  0.0.0.0
symmetric_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 symmetric_matrix_2x2.
19 
20 
21 #ifndef SYMMETRIC_MATRIX_2X2_IMPL_H
22 #define SYMMETRIC_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 GENERAL_MATRIX_1X2_H
37 #include "SheafSystem/general_matrix_1x2.h"
38 #endif
39 
40 #ifndef GENERAL_MATRIX_2X1_H
41 #include "SheafSystem/general_matrix_2x1.h"
42 #endif
43 
44 #ifndef GENERAL_MATRIX_2X2_H
45 #include "SheafSystem/general_matrix_2x2.h"
46 #endif
47 
48 #ifndef SYMMETRIC_MATRIX_2X2_H
49 #include "SheafSystem/symmetric_matrix_2x2.h"
50 #endif
51 
52 #ifndef GENERAL_MATRIX_2X3_H
53 #include "SheafSystem/general_matrix_2x3.h"
54 #endif
55 
56 #ifndef STD_SSTREAM_H
57 #include "SheafSystem/std_sstream.h"
58 #endif
59 
60 #ifndef STD_CMATH_H
61 #include "SheafSystem/std_cmath.h"
62 #endif
63 
64 namespace fiber_bundle
65 {
66 
67 using namespace sheaf;
68 
69 //==============================================================================
70 // MEMBER FUNCTIONS
71 //==============================================================================
72 
74 template <typename T>
75 symmetric_matrix_2x2<T>::
76 operator met_e2_row_dofs_type<T>& () const
77 {
78  // Preconditions:
79 
80  // Body:
81 
82  T* lcomps = const_cast<T*>(components);
83 
84  met_e2_row_dofs_type<T>& result =
85  reinterpret_cast<met_e2_row_dofs_type<T>&>(*lcomps);
86 
87  // Postconditions:
88 
89  // Exit:
90 
91  return result;
92 }
93 
94 template <typename T>
96 operator st2_e2_row_dofs_type<T>& () const
97 {
98  // Preconditions:
99 
100  // Body:
101 
102  T* lcomps = const_cast<T*>(components);
103 
104  st2_e2_row_dofs_type<T>& result =
105  reinterpret_cast<st2_e2_row_dofs_type<T>&>(*lcomps);
106 
107  // Postconditions:
108 
109  // Exit:
110 
111  return result;
112 }
113 
115 template <typename T>
116 int
119 {
120  // Preconditions:
121 
122  // Body:
123 
124  // Postconditions:
125 
126  // Exit:
127 
128  return 2;
129 }
130 
132 template <typename T>
133 int
136 {
137  // Preconditions:
138 
139  // Body:
140 
141  // Postconditions:
142 
143  // Exit:
144 
145  return 2;
146 }
147 
149 template <typename T>
150 int
152 d()
153 {
154  // Preconditions:
155 
156  // Body:
157 
158  // Postconditions:
159 
160  // Exit:
161 
162  return 3;
163 }
164 
166 template <typename T>
167 T*
169 operator[](int nrow)
170 {
171  // Preconditions:
172 
173  require(nrow >= 0 && nrow < number_of_rows());
174 
175  // Body:
176 
177  T* result = &components[row_index(nrow)];
178 
179  // Postconditions:
180 
181  ensure(result != 0);
182 
183  // Exit:
184 
185  return result;
186 }
187 
188 template <typename T>
189 const T*
191 operator[](int nrow) const
192 {
193  // Preconditions:
194 
195  require(nrow >= 0 && nrow < number_of_rows());
196 
197  // Body:
198 
199  const T* result = &components[row_index(nrow)];
200 
201  // Postconditions:
202 
203  ensure(result != 0);
204 
205  // Exit:
206 
207  return result;
208 }
209 
211 template <typename T>
213 operator T* ()
214 {
215  // Preconditions:
216 
217  // Body:
218 
219  //cout << "### symmetric_matrix_2x2<T>::operator T* () " << std::endl;
220 
221  T* result = components;
222 
223  // Postconditions:
224 
225  ensure(result != 0);
226 
227  // Exit:
228 
229  return result;
230 }
231 
233 template <typename T>
235 operator const T* () const
236 {
237  // Preconditions:
238 
239  // Body:
240 
241  //cout << "### symmetric_matrix_2x2<T>::operator const T* () const " << std::endl;
242 
243  const T* result = components;
244 
245  // Postconditions:
246 
247  ensure(result != 0);
248 
249  // Exit:
250 
251  return result;
252 }
253 
255 template <typename T>
256 int
258 row_index(int xrow) const
259 {
260  // Preconditions:
261 
262  require(xrow >= 0 && xrow < number_of_rows());
263 
264  // Body:
265 
266  int nrows = number_of_rows();
267  int result = (xrow*(2*nrows-1-xrow))/2;
268 
269  //int result = (xrow*(3-xrow))/2;
270 
271  // Postconditions:
272 
273  ensure(result == (xrow*(2*number_of_rows()-1-xrow))/2);
274 
275  // Exit:
276 
277  return result;
278 }
279 
281 template <typename T>
283 operator general_matrix_2x2<T> () const
284 {
285  // Preconditions:
286 
287  // Body:
288 
289  general_matrix_2x2<T> result;
290 
291  const symmetric_matrix_2x2<T>& lm = *this;
292 
293  result[0][0] = lm[0][0];
294  result[0][1] = lm[0][1];
295  result[1][0] = lm[0][1];
296  result[1][1] = lm[1][1];
297 
298  // Postconditions:
299 
300  ensure(unexecutable("result == *this"));
301 
302  // Exit:
303 
304  return result;
305 }
306 
308 template <typename T>
311 row(int xrow) const
312 {
313  // Preconditions:
314 
315  require(xrow >= 0 && xrow < number_of_rows());
316 
317  // Body:
318 
319  general_matrix_1x2<T> result;
320 
321  // Just brute force it for the 3x3 case.
322 
323  if(xrow == 0)
324  {
325  result.components[0] = components[0]; // lm[0][0]
326  result.components[1] = components[1]; // lm[0][1]
327  }
328  else // xrow == 1
329  {
330  result.components[0] = components[1]; // lm[0][1]
331  result.components[1] = components[2]; // lm[1][1]
332  }
333 
334  // Postconditions:
335 
336  // Exit:
337 
338  return result;
339 
340 }
341 
343 template <typename T>
346 column(int xcolumn) const
347 {
348  // Preconditions:
349 
350  require(xcolumn >= 0 && xcolumn < number_of_columns());
351 
352  // Body:
353 
354  general_matrix_2x1<T> result;
355 
356  if(xcolumn == 0)
357  {
358  result.components[0] = components[0]; // lm[0][0]
359  result.components[1] = components[1]; // lm[0][1]
360  }
361  else // xcolumn == 1
362  {
363  result.components[0] = components[1]; // lm[0][1]
364  result.components[1] = components[2]; // lm[1][1]
365  }
366 
367  // Postconditions:
368 
369  // Exit:
370 
371  return result;
372 
373 }
374 
376 template <typename T>
377 void
380 {
381  // Preconditions:
382 
383  // Body:
384 
385  const symmetric_matrix_2x2<T>& lm = *this;
386 
387  T a00 = lm[0][0];
388  T a01 = lm[0][1];
389  //T a10 = a01;
390  T a11 = lm[1][1];
391 
392  // Return the transpose of the cofactors.
393 
394  xresult[0][0] = a11;
395  xresult[0][1] = -a01;
396  //xresult[1][0] = -a10;
397  xresult[1][1] = a00;
398 
399  // Postconditions:
400 
401  // Exit:
402 }
403 
405 template <typename T>
408 adjoint() const
409 {
410  // Preconditions:
411 
412  // Body:
413 
415  adjoint(result);
416 
417  // Postconditions:
418 
419  // Exit:
420 
421  return result;
422 }
423 
425 template <typename T>
426 void
428 assign(const T& xvalue)
429 {
430  // Preconditions:
431 
432  // Body:
433 
434  // Unroll the loop in this case.
435 
436  components[0] = xvalue;
437  components[1] = xvalue;
438  components[2] = xvalue;
439 
440  // Postconditions:
441 
442  ensure_for_all(i, 0, d(), components[i] == xvalue);
443 
444  // Exit:
445 
446 }
447 
449 template <typename T>
450 void
452 determinant(T& xresult) const
453 {
454  // Preconditions:
455 
456  // Body:
457 
458  const symmetric_matrix_2x2<T>& lm = *this;
459 
460  T a00 = lm[0][0];
461  T a01 = lm[0][1];
462  T a10 = a01;
463  T a11 = lm[1][1];
464 
465  xresult = a00*a11 - a01*a10;
466 
467  // Postconditions:
468 
469  // Exit:
470 
471 }
472 
474 template <typename T>
475 T
477 determinant() const
478 {
479  // Preconditions:
480 
481  // Body:
482 
483  T result;
484 
485  determinant(result);
486 
487  // Postconditions:
488 
489  // Exit:
490 
491  return result;
492 }
493 
495 template <typename T>
496 void
499 {
500  // Preconditions:
501 
502  // Body:
503 
504  // Calculate the eigenvalues of the matrix.
505 
506  const symmetric_matrix_2x2<T>& lm = *this;
507 
508  T a00 = lm[0][0];
509  T a01 = lm[0][1];
510  T a10 = a01;
511  T a11 = lm[1][1];
512 
513  // For a 2x2 matrix just solve the quadratic equation.
514 
515  //T a = 1.0;
516  T b = -(a00 + a11);
517  T c = a00*a11 - a01*a10;
518 
519  //T discriminant = b*b - 4.0*a*c;
520  //T sqrt_discriminant = sqrt(discriminant);
521 
522  //T lambda_0 = (-b-sqrt_discriminant)/(2.0*a);
523  //T lambda_1 = (-b+sqrt_discriminant)/(2.0*a);
524 
525  T discriminant = b*b - 4.0*c;
526 
527  if(discriminant < 0.0)
528  {
529  post_fatal_error_message("Matrix has 2 complex roots.");
530  }
531 
532  T sqrt_discriminant = sqrt(discriminant);
533 
534  T lambda_0 = 0.5*(-b-sqrt_discriminant);
535  T lambda_1 = 0.5*(-b+sqrt_discriminant);
536 
537  // Assign the diagonals of the result matrix to the
538  // eigenvalues and zero to the rest of the elements.
539 
540  // Sort into accending order.
541 
542  xresult[0][0] = (lambda_0 < lambda_1) ? lambda_0 : lambda_1;
543  xresult[0][1] = 0;
544  //xresult[1][0] = 0;
545  xresult[1][1] = (lambda_1 < lambda_0) ? lambda_0 : lambda_1;
546 
547  // Postconditions:
548 
549  ensure(xresult.is_diagonal());
550  ensure(unexecutable("for_all i, 0, 2, xresult[i][i] == real number"));
551 
552  // Exit:
553 
554 }
555 
557 template <typename T>
561 {
562  // Preconditions:
563 
564  // Body:
565 
567  diagonalization(result);
568 
569  // Postconditions:
570 
571  ensure(result.is_diagonal());
572  ensure(unexecutable("for_all i, 0, 2, result[i][i] == real number"));
573 
574  // Exit:
575 
576  return result;
577 }
578 
580 template <typename T>
581 void
584 {
585  // Preconditions:
586 
587  // Body:
588 
589  const T one = T(1);
590  const T zero = T(0);
591 
592  xresult[0][0] = one;
593  xresult[0][1] = zero;
594  xresult[1][1] = one;
595 
596  // Postconditions:
597 
598  ensure(xresult.is_identity());
599 
600  // Exit:
601 }
602 
604 template <typename T>
607 identity() const
608 {
609  // Preconditions:
610 
611  // Body:
612 
614  identity(result);
615 
616  // Postconditions:
617 
618  ensure(result.is_identity());
619 
620  // Exit:
621 
622  return result;
623 }
624 
625 
627 template <typename T>
628 void
631 {
632  // Preconditions:
633 
634  // Body:
635 
636  const symmetric_matrix_2x2<T>& lm = *this;
637 
638  // Get the determinant.
639 
640  T a00 = lm[0][0];
641  T a01 = lm[0][1];
642  T a10 = a01;
643  T a11 = lm[1][1];
644 
645  T determinant = a00*a11 - a01*a10;
646 
647  if(determinant == 0.0)
648  {
649  post_fatal_error_message("No inverse; determinant is zero.");
650  }
651 
652  xresult[0][0] = a11/determinant;
653  xresult[0][1] = -a01/determinant;
654  xresult[1][0] = -a10/determinant;
655  xresult[1][1] = a00/determinant;
656 
657  // Postconditions:
658 
659  // Exit:
660 }
661 
663 template <typename T>
666 inverse() const
667 {
668  // Preconditions:
669 
670  // Body:
671 
673  inverse(result);
674 
675  // Postconditions:
676 
677  // Exit:
678 
679  return result;
680 }
681 
683 template <typename T>
684 bool
686 is_diagonal() const
687 {
688  // Preconditions:
689 
690  // Body:
691 
692  const symmetric_matrix_2x2<T>& lm = *this;
693 
694  bool result = (lm[0][1]==0.0);
695 
696  // Postconditions:
697 
698  // Exit:
699 
700  return result;
701 
702 }
703 
705 template <typename T>
706 bool
708 is_identity() const
709 {
710  // Preconditions:
711 
712  // Body:
713 
714  const symmetric_matrix_2x2<T>& lm = *this;
715 
716  bool result = is_diagonal() && (lm[0][0]==1.0) && (lm[1][1]==1.0);
717 
718  // Postconditions:
719 
720  // Exit:
721 
722  return result;
723 
724 }
725 
727 template <typename T>
728 bool
731 {
732  // Preconditions:
733 
734  // Body:
735 
736  const symmetric_matrix_2x2<T>& lm = *this;
737 
738  // For a 2x2 symmetric matrix (n even), the test for positive definiteness
739  // is simple (the diagonal terms and the determinant must be positive).
740 
741  T a00 = lm[0][0];
742  T a11 = lm[1][1];
743  T ldet = determinant();
744 
745  bool result = (a00 > 0) && (a11 > 0) && (ldet > 0);
746 
747  // Postconditions:
748 
749  // Exit:
750 
751  return result;
752 }
753 
754 
756 template <typename T>
757 void
759 multiply(const T& xscalar, symmetric_matrix_2x2<T>& xresult) const
760 {
761  // Preconditions:
762 
763  // Body:
764 
765  // Unroll the loop in this case.
766 
767  xresult.components[0] = xscalar*components[0];
768  xresult.components[1] = xscalar*components[1];
769  xresult.components[2] = xscalar*components[2];
770 
771  // Postconditions:
772 
773  //@issue $$ISSUE: We can't make the following comparison because of
774  // floating point roundoff.
775  //ensure_for_all(i, 0, d(), xresult.components[i] == xscalar*components[i]);
776 
777  // Exit:
778 
779 }
780 
782 template <typename T>
785 multiply(const T& xscalar) const
786 {
787  // Preconditions:
788 
789  // Body:
790 
792  multiply(xscalar, result);
793 
794  // Postconditions:
795 
796  // Exit:
797 
798  return result;
799 }
800 
801 
803 template <typename T>
804 void
807  general_matrix_2x1<T>& xresult) const
808 {
809  // Preconditions:
810 
811  // Body:
812 
813  // Multiply [A][B] where [A] = *this & [B] = xother.
814 
815  const symmetric_matrix_2x2<T>& lm = *this;
816 
817  T a00 = lm[0][0];
818  T a01 = lm[0][1];
819  T a10 = a01;
820  T a11 = lm[1][1];
821 
822  T b00 = xother[0][0];
823  T b10 = xother[1][0];
824 
825  xresult[0][0] = a00*b00 + a01*b10;
826  xresult[1][0] = a10*b00 + a11*b10;
827 
828  // Postconditions:
829 
830  // Exit:
831 
832 }
833 
835 template <typename T>
838 multiply(const general_matrix_2x1<T>& xother) const
839 {
840  // Preconditions:
841 
842  // Body:
843 
844  general_matrix_2x1<T> result;
845  multiply(xother, result);
846 
847  // Postconditions:
848 
849  // Exit:
850 
851  return result;
852 }
853 
855 template <typename T>
856 void
859  general_matrix_2x2<T>& xresult) const
860 {
861  // Preconditions:
862 
863  // Body:
864 
865  // Multiply [A][B] where [A] = *this & [B] = xother.
866 
867  const symmetric_matrix_2x2<T>& lm = *this;
868 
869  T a00 = lm[0][0];
870  T a01 = lm[0][1];
871  T a10 = a01;
872  T a11 = lm[1][1];
873 
874  T b00 = xother[0][0];
875  T b01 = xother[0][1];
876  T b10 = b01;
877  T b11 = xother[1][1];
878 
879  xresult[0][0] = a00*b00 + a01*b10;
880  xresult[0][1] = a00*b01 + a01*b11;
881  xresult[1][0] = a10*b00 + a11*b10;
882  xresult[1][1] = a10*b01 + a11*b11;
883 
884  // Postconditions:
885 
886  // Exit:
887 
888 }
889 
891 template <typename T>
894 multiply(const symmetric_matrix_2x2<T>& xother) const
895 {
896  // Preconditions:
897 
898  // Body:
899 
900  general_matrix_2x2<T> result;
901  multiply(xother, result);
902 
903  // Postconditions:
904 
905  // Exit:
906 
907  return result;
908 }
909 
911 template <typename T>
912 void
915  general_matrix_2x2<T>& xresult) const
916 {
917  // Preconditions:
918 
919  // Body:
920 
921  // Multiply [A][B] where [A] = *this & [B] = xother.
922 
923  const symmetric_matrix_2x2<T>& lm = *this;
924 
925  T a00 = lm[0][0];
926  T a01 = lm[0][1];
927  T a10 = a01;
928  T a11 = lm[1][1];
929 
930  T b00 = xother[0][0];
931  T b01 = xother[0][1];
932  T b10 = xother[1][0];
933  T b11 = xother[1][1];
934 
935  xresult[0][0] = a00*b00 + a01*b10;
936  xresult[0][1] = a00*b01 + a01*b11;
937  xresult[1][0] = a10*b00 + a11*b10;
938  xresult[1][1] = a10*b01 + a11*b11;
939 
940  // Postconditions:
941 
942  // Exit:
943 
944 }
945 
947 template <typename T>
950 multiply(const general_matrix_2x2<T>& xother) const
951 {
952  // Preconditions:
953 
954  // Body:
955 
956  general_matrix_2x2<T> result;
957  multiply(xother, result);
958 
959  // Postconditions:
960 
961  // Exit:
962 
963  return result;
964 }
965 
967 template <typename T>
968 void
971  general_matrix_2x3<T>& xresult) const
972 {
973  // Preconditions:
974 
975  // Body:
976 
977  // Multiply [A][B] where [A] = *this & [B] = xother.
978 
979  const symmetric_matrix_2x2<T>& lm = *this;
980 
981  T a00 = lm[0][0];
982  T a01 = lm[0][1];
983  T a10 = a01;
984  T a11 = lm[1][1];
985 
986  T b00 = xother[0][0];
987  T b01 = xother[0][1];
988  T b02 = xother[0][2];
989 
990  T b10 = xother[1][0];
991  T b11 = xother[1][1];
992  T b12 = xother[1][2];
993 
994  xresult[0][0] = a00*b00 + a01*b10;
995  xresult[0][1] = a00*b01 + a01*b11;
996  xresult[0][2] = a00*b02 + a01*b12;
997 
998  xresult[1][0] = a10*b00 + a11*b10;
999  xresult[1][1] = a10*b01 + a11*b11;
1000  xresult[1][2] = a10*b02 + a11*b12;
1001 
1002  // Postconditions:
1003 
1004  // Exit:
1005 
1006 }
1007 
1009 template <typename T>
1012 multiply(const general_matrix_2x3<T>& xother) const
1013 {
1014  // Preconditions:
1015 
1016  // Body:
1017 
1018  general_matrix_2x3<T> result;
1019  multiply(xother, result);
1020 
1021  // Postconditions:
1022 
1023  // Exit:
1024 
1025  return result;
1026 }
1027 
1029 template <typename T>
1030 void
1032 trace(T& xresult) const
1033 {
1034  // Preconditions:
1035 
1036  // Body:
1037 
1038  const symmetric_matrix_2x2<T>& lm = *this;
1039 
1040  // Unroll the loop for efficiency.
1041 
1042  xresult = lm[0][0] + lm[1][1];
1043 
1044  // Postconditions:
1045 
1046  // Exit:
1047 }
1048 
1050 template <typename T>
1051 T
1053 trace() const
1054 {
1055  // Preconditions:
1056 
1057  // Body:
1058 
1059  T result;
1060 
1061  trace(result);
1062 
1063  // Postconditions:
1064 
1065  // Exit:
1066 
1067  return result;
1068 }
1069 
1071 template <typename T>
1072 void
1075 {
1076  // Preconditions:
1077 
1078  // Body:
1079 
1080  // The transpose of a symmetric matrix is the same as the
1081  // original matrix. But, we'll return it if you really want
1082  // it.
1083 
1084  //const symmetric_matrix_2x2<T>& lm = *this;
1085 
1086  //xresult[0][0] = lm[0][0];
1087  //xresult[0][1] = lm[0][1];
1088  //xresult[1][1] = lm[1][1];
1089 
1090  int ld = d();
1091 
1092  for(int i=0; i<ld; ++i)
1093  {
1094  xresult.components[i] = components[i];
1095  }
1096 
1097  // Postconditions:
1098 
1099  // Exit:
1100 
1101 }
1102 
1104 template <typename T>
1107 transpose() const
1108 {
1109  // Preconditions:
1110 
1111  // Body:
1112 
1113  symmetric_matrix_2x2<T> result;
1114  transpose(result);
1115 
1116  // Postconditions:
1117 
1118  // Exit:
1119 
1120  return result;
1121 }
1122 
1123 // =============================================================================
1124 // NON-MEMBER FUNCTIONS
1125 // =============================================================================
1126 
1127 #ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
1128 
1130 template <typename T>
1131 std::ostream& operator<<(std::ostream& xos, const symmetric_matrix_2x2<T>& xm)
1132 {
1133  // Preconditions:
1134 
1135  // Body:
1136 
1137  // Here we will actually print the elements below the diagonal
1138  // even though we don't store them.
1139 
1140  xos << " " << xm[0][0] << " " << xm[0][1] << std::endl;
1141  xos << " " << xm[0][1] << " " << xm[1][1] << std::endl;
1142 
1143  // Postconditions:
1144 
1145  // Exit:
1146 
1147  return xos;
1148 }
1149 
1150 #endif // ifndef DOXYGEN_SKIP_IMPLEMENTATIONS
1151 
1152 //==============================================================================
1153 //==============================================================================
1154 
1155 } // namespace fiber_bundle
1156 
1157 #endif // SYMMETRIC_MATRIX_2X2_IMPL_H
1158 
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
symmetric_matrix_2x2< T > inverse() const
The inverse of the matrix (auto-allocated).
T components[2]
Linear storage array.
symmetric_matrix_2x2< T > diagonalization() const
The diagonalization of the matrix (auto-allocated).
bool is_positive_definite() const
True if this matrix is positive definite.
T trace() const
The trace of the matrix (auto-allocated).
symmetric_matrix_2x2< T > adjoint() const
The adjoint of the matrix (auto-allocated).
Row dofs type for class st2_e2.
Definition: st2_e2.h:53
static int d()
Dimension of the underlying elements.
T determinant() const
The determinant of the matrix (auto-allocated).
static int number_of_rows()
The number of rows.
General matrix with 1 row and 2 columns.
General matrix with 2 rows and 2 columns.
static int number_of_columns()
The number of columns.
T components[2]
Linear storage array.
void trace(const S0 &x0, SR &xresult, bool xauto_access)
Definition: sec_st2.impl.h:99
general_matrix_2x1< T > column(int xcolumn) const
A 2x1 matrix containing the elements or column xcolumn.
Symmetric matrix with 2 rows and 2 columns.
General matrix with 2 rows and 1 column.
symmetric_matrix_2x2< T > identity() const
The identity matrix (auto-allocated).
symmetric_matrix_2x2< T > transpose() const
The transpose of the matrix (auto-allocated).
void determinant(const S0 &x0, SR &xresult, bool xauto_access)
Definition: sec_st2.impl.h:131
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.
void assign(const T &xscalar)
Assign all elements of this matrix to the value xvalue.
bool is_identity() const
True if this is an identity matrix.
bool is_diagonal() const
True if this matrix is diagonal.
T components[3]
Linear storage array.
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
void multiply(const T &xscalar, symmetric_matrix_2x2< T > &xresult) const
This matrix multiplied by a scalar (pre-allocated).
T * operator[](int xrow)
Pointer to the first element in row xrow of this matrix. Facilitates accessing elements via matrix[i]...
Row dofs type for class met_e2.
Definition: met_e2.h:51
int row_index(int xrow) const
Index for row xrow in the linear storage array.