Home | Develop | Download | Contact
test_matrix_state.cpp
1 
9 #include <iostream>
10 #include <Pds/Ra>
11 
12 int main(void)
13 {
14  Pds::Matrix A;
15  Pds::Matrix B(3,3);
16  Pds::Matrix C(3,3);
17 
18  C.At(4)=1.0/0.0;
19 
20  B.Set(0,0,+1.0/0.0);
21  B.Set(1,1, 0.0/0.0);
22  B.Set(2,2,-1.0/0.0);
23 
24  B.Print("B:\n");
25 
26  pds_print_info_message("... is void?");
27 
28  if(A.IsEmpty()) std::cout<<"A is NULL"<<std::endl;
29  else std::cout<<"A is not NULL"<<std::endl;
30 
31  if(B.IsNotEmpty()) std::cout<<"B is not NULL"<<std::endl;
32  else std::cout<<"B is NULL"<<std::endl;
33 
34  if(C.IsNotEmpty()) std::cout<<"C is not NULL"<<std::endl;
35  else std::cout<<"C is NULL"<<std::endl;
36 
37 
38 
39  pds_print_info_message("... is similar to ... ?");
40 
41  if(A.IsNotSimilarTo(B)) std::cout<<"A is not similar to B"<<std::endl;
42  else std::cout<<"A is similar to B"<<std::endl;
43 
44  if(B.IsSimilarTo(C)) std::cout<<"B is similar to C"<<std::endl;
45  else std::cout<<"B is not similar to C"<<std::endl;
46 
47 
48 
49  pds_print_info_message("... is multipliable to ... ?");
50 
51  if(A.IsNotMulBy(C)) std::cout<<"A is not multipliable by C"<<std::endl;
52  else std::cout<<"A is multipliable by C"<<std::endl;
53 
54  if(B.IsMulBy(C)) std::cout<<"B is multipliable by C"<<std::endl;
55  else std::cout<<"B is not multipliable by C"<<std::endl;
56 
57 
58 
59  pds_print_info_message("... has the position ... ?");
60 
61  if(B.IsInRange(1,1)) std::cout<<"B has the position (1,1)"<<std::endl;
62  else std::cout<<"B dont have the position (1,1)"<<std::endl;
63 
64 
65 
66  pds_print_info_message("... is in size range ... ?");
67 
68  if(B.IsInSizeRange(1.5,0.1)) std::cout<<"(1.5,0.1) is in size range of B"<<std::endl;
69  else std::cout<<"(1.5,0.1) is not in size range of B"<<std::endl;
70 
71 
72  B.EqualToInf().Print("\nB.EqualToInf()\n");
73 
74  B.EqualToNan().Print("\nB.EqualToNan()\n");
75 
76  B.EqualToFinite().Print("\nB.EqualToFinite()\n");
77 
78  C.Print("\nC:\n");
79  std::cout<<"C.HasInf() :\t"<<C.HasInf()<<std::endl;
80  std::cout<<"C.HasNan() :\t"<<C.HasNan()<<std::endl;
81  std::cout<<"C.HasNotFinite():\t"<<C.HasNotFinite()<<std::endl;
82 
83  Pds::Matrix D(4,4);
84  D.Print("\nD:\n");
85  if(D.IsZero()) std::cout<<"D is zero matrix"<<std::endl;
86  else std::cout<<"D is not zero matrix"<<std::endl;
87  return 0;
88 }
La clase tipo Pds::Matrix . Esta clase genera una matriz de Nlin lineas y Ncol columnas....
Definition: Matrix.hpp:86
#define pds_print_info_message(msg)
Definition: RaDefines.hpp:86
bool IsNotMulBy(const Pds::Matrix &B) const
Verifica si las matrices son multiplicables.
bool IsNotSimilarTo(const Pds::Matrix &B) const
Verifica si las matrices son similares en tamaño.
bool IsEmpty(void) const
Verifica si la matriz es nula es decir con lineas o columnas cero o arreglo NULL.

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed