Some aspects of programation

From KratosWiki
(Difference between revisions)
Jump to: navigation, search
Line 13: Line 13:
  
 
where A an B are matrices and a, b, c d are integers.
 
where A an B are matrices and a, b, c d are integers.
 
+
 
 
'''noalias'''(A) = B.
 
'''noalias'''(A) = B.
  
Line 27: Line 27:
 
Other operation that we can do is to size a matrix. The best way is for exemple:
 
Other operation that we can do is to size a matrix. The best way is for exemple:
  
if A.size(1)!=3 \\ A.size(2)!=3.
+
if( A.size1()!=3 || A.size2()!=3)
 
+
  A.resize( 3,3,false)
 
+
resize( 3,3,false)
+
  
  
Line 39: Line 37:
 
for exemple
 
for exemple
  
noalias(A)=zerovector(3)
+
noalias(A)=ZeroVector(3)
  
noalias(A)=zeromatrix(4,4)
+
noalias(A)=ZeroMatrix(4,4)
  
 
There are too many oparations that we can do.
 
There are too many oparations that we can do.

Revision as of 13:01, 10 September 2008

Begin to understand a code is sometimes a headache. However, we will settle for only understand the mathematical key aspects.

In Kratos many mathematical operations and operations with variable use the library UBLAS.

for exemple, if i want to this operation or another operation:

A[a,b]=B[c][d].


X+=Y.


where A an B are matrices and a, b, c d are integers.

noalias(A) = B.

noalias(X) += Y.

noalias(Y) = prod(A,x).

noalias(Y) = prod(trans(A),x).

prod: Matrix Products
trans:Transposed a matrix

Other operation that we can do is to size a matrix. The best way is for exemple:

if( A.size1()!=3 || A.size2()!=3)

 A.resize( 3,3,false)


where A can be a matrix or a vector.

We can initialize with a null matrix or vector

for exemple

noalias(A)=ZeroVector(3)

noalias(A)=ZeroMatrix(4,4)

There are too many oparations that we can do. If you want to learn more visit the page


http://www.boost.org/doc/libs/1_35_0/libs/numeric/ublas/doc/index.htm

here are the most importants operations that you will use in Kratos.

Don't forget to type noalias in the left of the opertions.

Personal tools
Categories