EMatrix
Namespaces | Classes | Functions
ematrix Namespace Reference

Namespaces

 cnst
 These constants are from the gcc 3.2 <cmath> file (overkill??)
 

Classes

class  Matrix
 

Functions

template<class tData , size_t tRows, size_t tCols>
std::ostream & operator<< (std::ostream &s, const Matrix< tData, tRows, tCols > &A)
 
template<class tData0 , size_t tRows0, size_t tCols0>
std::ostream & octave (std::ostream &s, const Matrix< std::complex< tData0 >, tRows0, tCols0 > &A, const char *Aname)
 
template<class tData0 , size_t tRows0, size_t tCols0>
std::ostream & octave (std::ostream &s, const Matrix< tData0, tRows0, tCols0 > &A, const char *Aname)
 
template<class tData , size_t tRows, size_t tCols>
Matrix< tData, tRows, tCols > operator* (const tData &scalar, const Matrix< tData, tRows, tCols > &R)
 
template<class tData0 , size_t tCols0, size_t tRowsT, size_t tRowsB>
Matrix< tData0, tRowsT+tRowsB, tCols0 > operator& (const Matrix< tData0, tRowsT, tCols0 > &Top, const Matrix< tData0, tRowsB, tCols0 > &Bottom)
 
template<class tData0 , size_t tRows0, size_t tColsL, size_t tColsR>
Matrix< tData0, tRows0, tColsL+tColsR > operator| (const Matrix< tData0, tRows0, tColsL > &Left, const Matrix< tData0, tRows0, tColsR > &Right)
 
template<class tData , size_t tRows, size_t tCols>
Matrix< tData, tCols, tRows > trans (const Matrix< tData, tRows, tCols > &R)
 
template<size_t tRows, size_t tCols>
Matrix< std::complex< float >, tCols, tRows > trans (const Matrix< std::complex< float >, tRows, tCols > &R)
 
template<size_t tRows, size_t tCols>
Matrix< std::complex< double >, tCols, tRows > trans (const Matrix< std::complex< double >, tRows, tCols > &R)
 
template<class tData , size_t tRows>
Matrix< tData, tRows, 1 > diag (const Matrix< tData, tRows, tRows > &R)
 
template<class tData , size_t tRows>
Matrix< tData, tRows, tRows > diag (const Matrix< tData, tRows, 1 > &R)
 
template<class tData , size_t tCols>
Matrix< tData, tCols, tCols > diag (const Matrix< tData, 1, tCols > &R)
 
template<class tData >
Matrix< tData, 3, 3 > skew (const Matrix< tData, 3, 1 > &R)
 
template<class tData >
Matrix< tData, 3, 1 > cross (const Matrix< tData, 3, 1 > &L, const Matrix< tData, 3, 1 > &R)
 
template<class tData , size_t tRows>
tData dot (const Matrix< tData, tRows, 1 > &L, const Matrix< tData, tRows, 1 > &R)
 
template<class tData , size_t tRows>
tData norm (const Matrix< tData, tRows, 1 > &R)
 
void sgesv_ (const int &n, const int &nrhs, float *A, const int &lda, int *ipiv, float *B, const int &ldb, int *info)
 
void cgesv_ (const int &n, const int &nrhs, std::complex< float > *A, const int &lda, int *ipiv, std::complex< float > *B, const int &ldb, int *info)
 
void dgesv_ (const int &n, const int &nrhs, double *A, const int &lda, int *ipiv, double *B, const int &ldb, int *info)
 
void zgesv_ (const int &n, const int &nrhs, std::complex< double > *A, const int &lda, int *ipiv, std::complex< double > *B, const int &ldb, int *info)
 
template<size_t tRows>
Matrix< float, tRows, tRows > inv (const Matrix< float, tRows, tRows > &R)
 
template<size_t tRows>
Matrix< std::complex< float >, tRows, tRows > inv (const Matrix< std::complex< float >, tRows, tRows > &R)
 
template<size_t tRows>
Matrix< double, tRows, tRows > inv (const Matrix< double, tRows, tRows > &R)
 
template<size_t tRows>
Matrix< std::complex< double >, tRows, tRows > inv (const Matrix< std::complex< double >, tRows, tRows > &R)
 
void sgetrf_ (const int &m, const int &n, float *A, const int &lda, int *ipiv, int *info)
 
void cgetrf_ (const int &m, const int &n, std::complex< float > *A, const int &lda, int *ipiv, int *info)
 
void dgetrf_ (const int &m, const int &n, double *A, const int &lda, int *ipiv, int *info)
 
void zgetrf_ (const int &m, const int &n, std::complex< double > *A, const int &lda, int *ipiv, int *info)
 
template<size_t tRows>
float det (const Matrix< float, tRows, tRows > &R)
 
template<size_t tRows>
std::complex< float > det (const Matrix< std::complex< float >, tRows, tRows > &R)
 
template<size_t tRows>
double det (const Matrix< double, tRows, tRows > &R)
 
template<size_t tRows>
std::complex< double > det (const Matrix< std::complex< double >, tRows, tRows > &R)
 
template<class tData >
Matrix< tData, 3, 3 > R (tData angle, char axis)
 
template<class tData >
Matrix< tData, 3, 3 > TIE (tData t)
 
template<class tData >
Matrix< tData, 3, 3 > TEL (tData lat_rad, tData lon_rad)
 
template<class tData >
Matrix< tData, 3, 3 > ang_to_tib (tData psi, tData the, tData phi)
 
template<class tData >
void uv_to_ae (tData *az, tData *el, Matrix< tData, 3, 1 > &u)
 

Function Documentation

◆ ang_to_tib()

template<class tData >
Matrix< tData, 3, 3 > ematrix::ang_to_tib ( tData  psi,
tData  the,
tData  phi 
)

Definition at line 1041 of file EMatrix.h.

1041  {
1042  tData a_r_psi[] = {cos(psi),-sin(psi), 0,
1043  sin(psi), cos(psi), 0,
1044  0, 0, 1
1045  };
1046  Matrix< tData, 3, 3 > r_psi(a_r_psi);
1047 
1048  tData a_r_the[] = {cos(the), 0, sin(the),
1049  0, 1, 0,
1050  -sin(the), 0, cos(the)
1051  };
1052  Matrix< tData, 3, 3 > r_the(a_r_the);
1053 
1054  tData a_r_phi[] = { 1, 0, 0,
1055  0, cos(phi),-sin(phi),
1056  0, sin(phi), cos(phi)
1057  };
1058  Matrix< tData, 3, 3 > r_phi(a_r_phi);
1059 
1060  return r_psi*r_the*r_phi;
1061 }

◆ cgesv_()

void ematrix::cgesv_ ( const int &  n,
const int &  nrhs,
std::complex< float > *  A,
const int &  lda,
int *  ipiv,
std::complex< float > *  B,
const int &  ldb,
int *  info 
)

◆ cgetrf_()

void ematrix::cgetrf_ ( const int &  m,
const int &  n,
std::complex< float > *  A,
const int &  lda,
int *  ipiv,
int *  info 
)

Referenced by det(), and inv().

◆ cross()

template<class tData >
Matrix< tData, 3, 1 > ematrix::cross ( const Matrix< tData, 3, 1 > &  L,
const Matrix< tData, 3, 1 > &  R 
)

Definition at line 796 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::R, and ematrix::Matrix< tData, tRows, tCols >::skew.

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

796  { // Tag:tested
797  return skew(L)*R;
798 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
Matrix< tData, 3, 3 > skew(const Matrix< tData, 3, 1 > &R)
Definition: EMatrix.h:783

◆ det() [1/4]

template<size_t tRows>
float ematrix::det ( const Matrix< float, tRows, tRows > &  R)

Definition at line 926 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), ematrix::Matrix< tData, tRows, tCols >::R, and sgetrf_().

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

926  {
927  int n = tRows;
928  Matrix< float, tRows, tRows > a = R;
929  int ipiv[tRows] = {0};
930  int info = 0;
931  float result = 1.0;
932 
933  sgetrf_(n,n,a.pIJ(),n,&ipiv[0],&info);
934 
935  if (info == 0) {
936  for(int i=0; i<n; i++) {
937  if(ipiv[i] != (i+1)) result *= -a[i][i]; // i+1 for fortran
938  else result *= +a[i][i];
939  }
940  } else {
941  std::cerr << "?getrf returned error: " << info << std::endl;
942  abort();
943  }
944  return result;
945 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void sgetrf_(const int &m, const int &n, float *A, const int &lda, int *ipiv, int *info)

◆ det() [2/4]

template<size_t tRows>
std::complex<float> ematrix::det ( const Matrix< std::complex< float >, tRows, tRows > &  R)

Definition at line 948 of file EMatrix.h.

References cgetrf_(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), and ematrix::Matrix< tData, tRows, tCols >::R.

948  {
949  int n = tRows;
950  Matrix< std::complex<float>, tRows, tRows > a = R;
951  int ipiv[tRows] = {0};
952  int info = 0;
953  std::complex<float> result(1.0,0.0);
954 
955  cgetrf_(n,n,a.pIJ(),n,&ipiv[0],&info);
956 
957  if (info == 0) {
958  for(int i=0; i<n; i++) {
959  if(ipiv[i] != (i+1)) result *= -a[i][i]; // i+1 for fortran
960  else result *= +a[i][i];
961  }
962  } else {
963  std::cerr << "?getrf returned error: " << info << std::endl;
964  abort();
965  }
966  return result;
967 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void cgetrf_(const int &m, const int &n, std::complex< float > *A, const int &lda, int *ipiv, int *info)

◆ det() [3/4]

template<size_t tRows>
double ematrix::det ( const Matrix< double, tRows, tRows > &  R)

Definition at line 970 of file EMatrix.h.

References dgetrf_(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), and ematrix::Matrix< tData, tRows, tCols >::R.

970  {
971  int n = tRows;
972  Matrix< double, tRows, tRows > a = R;
973  int ipiv[tRows] = {0};
974  int info = 0;
975  double result = 1.0;
976 
977  dgetrf_(n,n,a.pIJ(),n,&ipiv[0],&info);
978 
979  if (info == 0) {
980  for(int i=0; i<n; i++) {
981  if(ipiv[i] != (i+1)) result *= -a[i][i]; // i+1 for fortran
982  else result *= +a[i][i];
983  }
984  } else {
985  std::cerr << "?getrf returned error: " << info << std::endl;
986  abort();
987  }
988  return result;
989 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void dgetrf_(const int &m, const int &n, double *A, const int &lda, int *ipiv, int *info)

◆ det() [4/4]

template<size_t tRows>
std::complex<double> ematrix::det ( const Matrix< std::complex< double >, tRows, tRows > &  R)

Definition at line 992 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), ematrix::Matrix< tData, tRows, tCols >::R, and zgetrf_().

992  {
993  int n = tRows;
994  Matrix< std::complex<double>, tRows, tRows > a = R;
995  int ipiv[tRows] = {0};
996  int info = 0;
997  std::complex<double> result(1.0,0.0);
998 
999  zgetrf_(n,n,a.pIJ(),n,&ipiv[0],&info);
1000 
1001  if (info == 0) {
1002  for(int i=0; i<n; i++) {
1003  if(ipiv[i] != (i+1)) result *= -a[i][i]; // i+1 for fortran
1004  else result *= +a[i][i];
1005  }
1006  } else {
1007  std::cerr << "?getrf returned error: " << info << std::endl;
1008  abort();
1009  }
1010  return result;
1011 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void zgetrf_(const int &m, const int &n, std::complex< double > *A, const int &lda, int *ipiv, int *info)

◆ dgesv_()

void ematrix::dgesv_ ( const int &  n,
const int &  nrhs,
double *  A,
const int &  lda,
int *  ipiv,
double *  B,
const int &  ldb,
int *  info 
)

◆ dgetrf_()

void ematrix::dgetrf_ ( const int &  m,
const int &  n,
double *  A,
const int &  lda,
int *  ipiv,
int *  info 
)

Referenced by det(), and inv().

◆ diag() [1/3]

template<class tData , size_t tRows>
Matrix< tData, tRows, 1 > ematrix::diag ( const Matrix< tData, tRows, tRows > &  R)

Definition at line 756 of file EMatrix.h.

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

756  { // Tag:tested
757  Matrix< tData, tRows, 1 > Result;
758  for (size_t iIndex = 0; iIndex < tRows; iIndex++ ) {
759  Result[iIndex][0] = R[iIndex][iIndex];
760  }
761  return Result;
762 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ diag() [2/3]

template<class tData , size_t tRows>
Matrix< tData, tRows, tRows > ematrix::diag ( const Matrix< tData, tRows, 1 > &  R)

Definition at line 765 of file EMatrix.h.

765  { // Tag:tested
766  Matrix< tData, tRows, tRows > Result;
767  for (size_t iIndex = 0; iIndex < tRows; iIndex++ ) {
768  Result[iIndex][iIndex] = R[iIndex][0];
769  }
770  return Result;
771 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ diag() [3/3]

template<class tData , size_t tCols>
Matrix< tData, tCols, tCols > ematrix::diag ( const Matrix< tData, 1, tCols > &  R)

Definition at line 774 of file EMatrix.h.

774  { // Tag:tested
775  Matrix< tData, tCols, tCols > Result;
776  for (size_t iIndex = 0; iIndex < tCols; iIndex++ ) {
777  Result[iIndex][iIndex] = R[0][iIndex];
778  }
779  return Result;
780 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ dot()

template<class tData , size_t tRows>
tData ematrix::dot ( const Matrix< tData, tRows, 1 > &  L,
const Matrix< tData, tRows, 1 > &  R 
)

Definition at line 801 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::pIJ().

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

801  { // Tag:tested
802  tData Result = tData(0);
803 
804  tData * pR = R.pIJ();
805  tData * pL = L.pIJ();
806 
807  for (size_t iIndex = 0; iIndex < tRows; iIndex++) {
808  Result += (*pR++)*(*pL++);
809  }
810  return Result;
811 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ inv() [1/4]

template<size_t tRows>
Matrix< float, tRows, tRows > ematrix::inv ( const Matrix< float, tRows, tRows > &  R)

Definition at line 841 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), ematrix::Matrix< tData, tRows, tCols >::R, and sgesv_().

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

841  {
842  int n = tRows;
843  Matrix< float, tRows, tRows > a = R;
844  int ipiv[tRows] = {0};
845  Matrix< float, tRows, tRows > Result;
846  Result.eye();
847  int info = 0;
848 
849  sgesv_(n, n, a.pIJ(), n, ipiv, Result.pIJ(), n, &info);
850 
851  if(info != 0) {
852  std::cerr << "?gesv returned error: " << info << std::endl;
853  abort();
854  }
855 
856  return Result;
857 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void sgesv_(const int &n, const int &nrhs, float *A, const int &lda, int *ipiv, float *B, const int &ldb, int *info)

◆ inv() [2/4]

template<size_t tRows>
Matrix< std::complex<float>, tRows, tRows > ematrix::inv ( const Matrix< std::complex< float >, tRows, tRows > &  R)

Definition at line 860 of file EMatrix.h.

References cgesv_(), ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), and ematrix::Matrix< tData, tRows, tCols >::R.

860  {
861  int n = tRows;
862  Matrix< std::complex<float>, tRows, tRows > a = R;
863  int ipiv[tRows] = {0};
864  Matrix< std::complex<float>, tRows, tRows > Result;
865  Result.eye();
866  int info = 0;
867 
868  cgesv_(n, n, a.pIJ(), n, ipiv, Result.pIJ(), n, &info);
869 
870  if(info != 0) {
871  std::cerr << "?gesv returned error: " << info << std::endl;
872  abort();
873  }
874 
875  return Result;
876 }
void cgesv_(const int &n, const int &nrhs, std::complex< float > *A, const int &lda, int *ipiv, std::complex< float > *B, const int &ldb, int *info)
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ inv() [3/4]

template<size_t tRows>
Matrix< double, tRows, tRows > ematrix::inv ( const Matrix< double, tRows, tRows > &  R)

Definition at line 879 of file EMatrix.h.

References dgesv_(), ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), and ematrix::Matrix< tData, tRows, tCols >::R.

879  {
880  int n = tRows;
881  Matrix< double, tRows, tRows > a = R;
882  int ipiv[tRows] = {0};
883  Matrix< double, tRows, tRows > Result;
884  Result.eye();
885  int info = 0;
886 
887  dgesv_(n, n, a.pIJ(), n, ipiv, Result.pIJ(), n, &info);
888 
889  if(info != 0) {
890  std::cerr << "?gesv returned error: " << info << std::endl;
891  abort();
892  }
893 
894  return Result;
895 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
void dgesv_(const int &n, const int &nrhs, double *A, const int &lda, int *ipiv, double *B, const int &ldb, int *info)

◆ inv() [4/4]

template<size_t tRows>
Matrix< std::complex<double>, tRows, tRows > ematrix::inv ( const Matrix< std::complex< double >, tRows, tRows > &  R)

Definition at line 898 of file EMatrix.h.

References cgetrf_(), dgetrf_(), ematrix::Matrix< tData, tRows, tCols >::eye(), ematrix::Matrix< tData, tRows, tCols >::n(), ematrix::Matrix< tData, tRows, tCols >::pIJ(), ematrix::Matrix< tData, tRows, tCols >::R, sgetrf_(), zgesv_(), and zgetrf_().

898  {
899  int n = tRows;
900  Matrix< std::complex<double>, tRows, tRows > a = R;
901  int ipiv[tRows] = {0};
902  Matrix< std::complex<double>, tRows, tRows > Result;
903  Result.eye();
904  int info = 0;
905 
906  zgesv_(n, n, a.pIJ(), n, ipiv, Result.pIJ(), n, &info);
907 
908  if(info != 0) {
909  std::cerr << "?gesv returned error: " << info << std::endl;
910  abort();
911  }
912 
913  return Result;
914 }
void zgesv_(const int &n, const int &nrhs, std::complex< double > *A, const int &lda, int *ipiv, std::complex< double > *B, const int &ldb, int *info)
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ norm()

template<class tData , size_t tRows>
tData ematrix::norm ( const Matrix< tData, tRows, 1 > &  R)

Definition at line 819 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::dot.

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

819  { // Tag:tested
820  return std::sqrt(dot(R,R));
821 }
tData dot(const Matrix< tData, tRows, 1 > &L, const Matrix< tData, tRows, 1 > &R)
Definition: EMatrix.h:801
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ octave() [1/2]

template<class tData0 , size_t tRows0, size_t tCols0>
std::ostream& ematrix::octave ( std::ostream &  s,
const Matrix< std::complex< tData0 >, tRows0, tCols0 > &  A,
const char *  Aname 
)

Octave text output format, double Usage: Matrix<double,2,3> A(&a[0][0]); octave(cout,A,"A") << endl; Can define: #define cout_octave(x) octave(cout,x,#x) for cout_octave(A) << endl;

Definition at line 520 of file EMatrix.h.

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator[]().

520  { // Tag:tested
521  s << "# name: " << Aname << std::endl;
522  s << "# type: complex matrix" << std::endl;
523  s << "# rows: " << A.iRows << std::endl;
524  s << "# columns: " << A.iCols << std::endl;
525  s << A;
526  s.flush();
527  return s;
528 }

◆ octave() [2/2]

template<class tData0 , size_t tRows0, size_t tCols0>
std::ostream& ematrix::octave ( std::ostream &  s,
const Matrix< tData0, tRows0, tCols0 > &  A,
const char *  Aname 
)

Octave text output format, complex<double> Usage: Matrix< complex<double>,3,3 > ZA; octave(cout,ZA,"ZA") << endl; Can define: #define cout_octave(x) octave(cout,x,#x) for cout_octave(ZA) << endl;

Definition at line 531 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::iCols, and ematrix::Matrix< tData, tRows, tCols >::iRows.

531  { // Tag:tested
532  s << "# name: " << Aname << std::endl;
533  s << "# type: matrix" << std::endl;
534  s << "# rows: " << A.iRows << std::endl;
535  s << "# columns: " << A.iCols << std::endl;
536  s << A;
537  s.flush();
538  return s;
539 }

◆ operator&()

template<class tData0 , size_t tCols0, size_t tRowsT, size_t tRowsB>
Matrix< tData0, tRowsT+tRowsB, tCols0 > ematrix::operator & ( const Matrix< tData0, tRowsT, tCols0 > &  Top,
const Matrix< tData0, tRowsB, tCols0 > &  Bottom 
)

Concatenate matrices top and botton Usage: C = (A & B); Must use parenthesis

Definition at line 654 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::iCols, and ematrix::Matrix< tData, tRows, tCols >::iRows.

Referenced by ematrix::Matrix< tData, tRows, tCols >::operator*().

655  { // Tag:tested
656  Matrix< tData0, tRowsT+tRowsB, tCols0 > Result;
657 
658  size_t i,ii,j;
659  for(i=0; i<Top.iRows; i++)
660  for(j=0; j<Top.iCols; j++)
661  Result[i][j] = Top[i][j];
662 
663  for(i=Top.iRows,ii=0; i<(Top.iRows+Bottom.iRows); i++,ii++) {
664  for(j=0; j<Top.iCols; j++) {
665  Result[i][j] = Bottom[ii][j];
666  }
667  }
668  return Result;
669 }

◆ operator*()

template<class tData , size_t tRows, size_t tCols>
Matrix< tData, tRows, tCols > ematrix::operator* ( const tData &  scalar,
const Matrix< tData, tRows, tCols > &  R 
)

Definition at line 609 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::iCols, ematrix::Matrix< tData, tRows, tCols >::ij, ematrix::Matrix< tData, tRows, tCols >::iRows, and ematrix::Matrix< tData, tRows, tCols >::R.

Referenced by ematrix::Matrix< tData, tRows, tCols >::cols().

609  { // Tag:tested
610  size_t iRows = R.iRows;
611  size_t iCols = R.iCols;
612  Matrix< tData, tRows, tCols > Result = R;
613  tData * pResult = Result.ij[0];
614  for (size_t iIndex = 0; iIndex < iRows * iCols; iIndex++)
615  (*pResult++) *= scalar;
616  return Result;
617 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ operator<<()

template<class tData , size_t tRows, size_t tCols>
std::ostream& ematrix::operator<< ( std::ostream &  s,
const Matrix< tData, tRows, tCols > &  A 
)

Definition at line 499 of file EMatrix.h.

499  { // Tag:tested
500  // Sets new precision, returns old. Should figure out how to modify
501  // without code change here. Switch to exponential as well.
502  std::streamsize old_precision = s.precision(8);
503 
504  //s.setf( std::ios::fixed, std:: ios::floatfield ); // floatfield set to fixed
505 
506  //s << "Address: 0x" << (&A) << std::endl;
507  for (size_t i=0; i<A.iRows; i++) {
508  for (size_t j=0; j<A.iCols; j++) {
509  //s.width(25);
510  s << (A[i][j]) << '\t';
511  }
512  s << std::endl;
513  }
514  s.flush();
515  s.precision(old_precision);
516  return s;
517 }

◆ operator|()

template<class tData0 , size_t tRows0, size_t tColsL, size_t tColsR>
Matrix< tData0, tRows0, tColsL+tColsR > ematrix::operator| ( const Matrix< tData0, tRows0, tColsL > &  Left,
const Matrix< tData0, tRows0, tColsR > &  Right 
)

Concatenate matrices Left to Right Usage: C = (A | B); Must use parenthesis

Definition at line 672 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::iCols, and ematrix::Matrix< tData, tRows, tCols >::iRows.

Referenced by ematrix::Matrix< tData, tRows, tCols >::operator*().

673  { // Tag:tested
674  Matrix< tData0, tRows0, tColsL+tColsR > Result;
675  size_t i,j,jj;
676  for(i=0; i<Left.iRows; i++)
677  for(j=0; j<Left.iCols; j++)
678  Result[i][j] = Left[i][j];
679  for(i=0; i<Left.iRows; i++) {
680  for(j=Left.iCols,jj=0; j<(Left.iCols+Right.iCols); j++,jj++) {
681  Result[i][j] = Right[i][jj];
682  }
683  }
684  return Result;
685 }

◆ R()

template<class tData >
Matrix< tData, 3, 3 > ematrix::R ( tData  angle,
char  axis 
)

Definition at line 1014 of file EMatrix.h.

Referenced by ematrix::Matrix< tData, tRows, tCols >::cols(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

1014  {
1015  assert(axis == 'x' || axis == 'y' || axis == 'z');
1016  Matrix< tData, 3, 3 > result;
1017 
1018  if(axis == 'x') {
1019  result = {1.0,0.0,0.0,0.0,cos(angle),-sin(angle),0.0,sin(angle), cos(angle)};
1020  } else if(axis=='y') {
1021  result = {cos(angle),0.0,sin(angle),0.0,1.0,0.0,-sin(angle),0.0,cos(angle)};
1022  } else if(axis=='z') {
1023  result = {cos(angle),-sin(angle),0.0,sin(angle),cos(angle),0.0,0.0,0.0,1.0};
1024  } else {
1025  abort();
1026  }
1027  return result;
1028 }

◆ sgesv_()

void ematrix::sgesv_ ( const int &  n,
const int &  nrhs,
float *  A,
const int &  lda,
int *  ipiv,
float *  B,
const int &  ldb,
int *  info 
)

◆ sgetrf_()

void ematrix::sgetrf_ ( const int &  m,
const int &  n,
float *  A,
const int &  lda,
int *  ipiv,
int *  info 
)

Referenced by det(), and inv().

◆ skew()

template<class tData >
Matrix< tData, 3, 3 > ematrix::skew ( const Matrix< tData, 3, 1 > &  R)

Definition at line 783 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::pIJ().

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

783  { // Tag:tested
784  tData * pR = R.pIJ();
785  tData z = tData(0);
786  Matrix< tData, 3, 3 > Result = {
787  z,-pR[2], pR[1],
788  pR[2], z,-pR[0],
789  -pR[1], pR[0], z
790  };
791 
792  return Result;
793 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ TEL()

template<class tData >
Matrix< tData, 3, 3 > ematrix::TEL ( tData  lat_rad,
tData  lon_rad 
)

Definition at line 1036 of file EMatrix.h.

References ematrix::cnst::PI_2, and ematrix::Matrix< tData, tRows, tCols >::R.

1036  {
1037  return (R(lon_rad,'z')*R(-lat_rad-cnst::PI_2,'y'));
1038 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014
const double PI_2
Definition: EMatrix.h:34

◆ TIE()

template<class tData >
Matrix< tData, 3, 3 > ematrix::TIE ( tData  t)

Definition at line 1031 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::R, and ematrix::cnst::WS.

1031  {
1032  return R(cnst::WS*t,'z');
1033 }
const double WS
Definition: EMatrix.h:47
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ trans() [1/3]

template<class tData , size_t tRows, size_t tCols>
Matrix< tData, tCols, tRows > ematrix::trans ( const Matrix< tData, tRows, tCols > &  R)

Definition at line 723 of file EMatrix.h.

Referenced by main(), and ematrix::Matrix< tData, tRows, tCols >::operator*().

723  { // Tag:tested
724  Matrix< tData, tCols, tRows > Result;
725 
726  for (size_t iIndex = 0; iIndex < tCols; iIndex++)
727  for (size_t jIndex = 0; jIndex < tRows; jIndex++)
728  Result[iIndex][jIndex] = R[jIndex][iIndex];
729 
730  return Result;
731 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ trans() [2/3]

template<size_t tRows, size_t tCols>
Matrix< std::complex<float>, tCols, tRows > ematrix::trans ( const Matrix< std::complex< float >, tRows, tCols > &  R)

Definition at line 734 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::R.

734  { // Tag:tested
735  Matrix< std::complex<float>, tCols, tRows > Result;
736 
737  for (size_t iIndex = 0; iIndex < tCols; iIndex++)
738  for (size_t jIndex = 0; jIndex < tRows; jIndex++)
739  Result[iIndex][jIndex] = std::conj(R[jIndex][iIndex]);
740 
741  return Result;
742 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ trans() [3/3]

template<size_t tRows, size_t tCols>
Matrix< std::complex<double>, tCols, tRows > ematrix::trans ( const Matrix< std::complex< double >, tRows, tCols > &  R)

Definition at line 745 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::R.

745  { // Tag:tested
746  Matrix< std::complex<double>, tCols, tRows > Result;
747 
748  for (size_t iIndex = 0; iIndex < tCols; iIndex++)
749  for (size_t jIndex = 0; jIndex < tRows; jIndex++)
750  Result[iIndex][jIndex] = std::conj(R[jIndex][iIndex]);
751 
752  return Result;
753 }
Matrix< tData, 3, 3 > R(tData angle, char axis)
Definition: EMatrix.h:1014

◆ uv_to_ae()

template<class tData >
void ematrix::uv_to_ae ( tData *  az,
tData *  el,
Matrix< tData, 3, 1 > &  u 
)

Definition at line 1064 of file EMatrix.h.

References ematrix::Matrix< tData, tRows, tCols >::norm, and ematrix::Matrix< tData, tRows, tCols >::u().

1064  {
1065  if(norm(u) != 1.0) u=u*(1.0/norm(u));
1066  *az=atan2(u(2),u(1));
1067  *el=asin(-u(3));
1068  return;
1069 }
tData norm(const Matrix< tData, tRows, 1 > &R)
Definition: EMatrix.h:819

◆ zgesv_()

void ematrix::zgesv_ ( const int &  n,
const int &  nrhs,
std::complex< double > *  A,
const int &  lda,
int *  ipiv,
std::complex< double > *  B,
const int &  ldb,
int *  info 
)

◆ zgetrf_()

void ematrix::zgetrf_ ( const int &  m,
const int &  n,
std::complex< double > *  A,
const int &  lda,
int *  ipiv,
int *  info 
)

Referenced by det(), and inv().