21 #define Matrix_Lib_h // Evita la inclusión múltiple
35 return M.rows() == M.cols();
46 assert(
"This code has not been tested" );
47 if (M.rows() != M.cols()) {
50 typename MAT::value_type ZERO = 0;
51 for (
unsigned i=0; i < M.rows(); i++) {
52 for (
unsigned j=0; j < i; j++) {
55 }
else if (M(j,i) != ZERO) {
71 assert(
"This code has not been tested" );
75 typename MAT::value_type S = M(0,0);
76 for (
unsigned i=1; i < M.rows(); i++) {
92 assert(
"This code has not been tested" );
93 typename MAT::value_type ONE = 1;
94 return ( ONE == M(0,0) ?
isScalar( M ) :
false );
105 assert(
"This code has not been tested" );
108 for (
unsigned i=0; i < M.rows(); ++i) {
109 for (
unsigned j=0; j < i; ++j) {
110 M(i,j) = M(j,i) =
typename MAT::value_type();
112 M(i,i) =
typename MAT::value_type(1);
124 assert(
"This code has not been tested" );
125 typename MAT::value_type ZERO = 0;
126 for (
unsigned i=0; i < M.rows(); i++) {
127 for (
unsigned j=0; j < M.cols(); j++) {
128 if (M(i,j) != ZERO) {
144 assert(
"This code has not been tested" );
145 if (M.rows() != M.cols()) {
148 for (
unsigned i=0; i < M.rows(); i++) {
149 for (
unsigned j=0; j < i; j++) {
150 if (M(i,j) != M(j,i)) {
166 assert(
"This code has not been tested" );
167 if (M.rows() != M.cols()) {
171 typename MAT::value_type ZERO = 0;
172 for (
unsigned i=1; i < M.rows(); i++) {
173 for (
unsigned j=0; j < i; j++) {
174 if (M(i,j) != ZERO) {
190 assert(
"This code has not been tested" );
191 if (M.rows() != M.cols()) {
195 typename MAT::value_type ZERO = 0;
196 for (
unsigned j=1; j < M.cols(); j++) {
197 for (
unsigned i=0; i < j; i++) {
198 if (M(i,j) != ZERO) {
209 #endif // Matrix_Lib_h
bool isUpperTriangular(const MAT &M)
Retorna "true" si la matriz M[][] es triangular superior.
bool isDiagonal(const MAT &M)
Retorna "true" si la matriz M[][] es una matriz diagonal.
void setUnit(MAT &M, unsigned n)
Convierte a M[][] en una matriz identidad de tamaño n x n.
bool isNull(const MAT &M)
Retorna "true" si la matriz M[][] es nula.
bool isLowerTriangular(const MAT &M)
Retorna "true" si la matriz M[][] es triangular inferior.
bool isSquare(const MAT &M)
Retorna "true" si la matriz M[][] es una matriz cuadrada.
bool isUnit(const MAT &M)
Retorna "true" si la matriz M[][] es unitaria.
bool isSymmetric(const MAT &M)
Retorna "true" si la matriz M[][] es simétrica.
bool isScalar(const MAT &M)
Retorna "true" si la matriz M[][] es escalar.