DOWLOAD

**Only one dimensional arrays** are
supported in the Flowgorithm and

limited to the **integer**, **real**
(floats), **boolean** and **string** types.

However, two
dimensional arrays are natively required in many algorithms.

Vectors and matrices are indexed from "1" not from "0" .

This
page describes, how two dimensional matrices can be defined, used and printed.

It is recommended to understand how the Flowgorithm source files ( *.fprg
files) can be modified directly for additional libraries inclusion.

Please,
see EDITING Flowgorithm Files

(unfortunately, a library handling is not available in the current Flowgorithm version,
perhaps a specialized tool for *.fprg files will be available)

The Flowgorithm uses indexing from ZERO, i.e. the A[0], ... ,
A[N-1], which might cause some problems in mathematical formula use.

The following functionality is available (indexing
[1..N] is to be used
consistently).

In
mathematics, usually the first index is ONE, i.e. A[1] in the vector case, resp.
A[1,1] in the case of matrices

Declaration (N, M can be integer constants or variables)

- one dimensional arrays: A[1:N] - declare A[N] - generates actually a vector
- two dimensional arrays: A[1:N,1:M] - declare A[N*M] - generates actually vector for a matrix storing.

**Indexing**

As the Flowgorithm supports one dimensional
arrays indexed from **ZERO**, each element of two dimensional array has to be re-indexed independently with
checking the bounds of a vector or a matrix,

e.g.
a mathematical formula k
= A[i,j] is to be rewritten as k = A[ Index ( i, j, N, M )] in the case of
matrix with integer elements.

All indexing starts from ONE, i.e. [1..N].

**Vector and matrix support** (indexing from "**1**")

The following re-indexing functions can be used for matrices; in the case of
a vector,

elements can be accessed directly by decreasing index by "1",
but without bounds detailed control.

(a vector A has N elements, a matrix
A - has N rows, M columns):

The vector case (indexing from "**1**")

- Index1 ( i, N ) - returns integer value of the physical index for the
**integer**vector element A[i] (matrix type independent)

The matrix case [2D arrays] (indexing from "**1**")

- Index ( i, j, N, M ) - returns the integer value of the physical index for the matrix element A[i,j] of the size NxM (matrix type independent)
- Index2 ( i, j, N ) - returns the integer value of the physical index for the matrix element A[i,j] of the size NxN (square matrix; matrix type independent)

**Printing vectors and matrices with formatting **(indexing from
"1", resp. "1,1")

The Flowgorithm supports only
"non-formatted" output of one value only. However, formatted output is required in many
cases.

Also for matrix output formatting is needed to see columns.

Unfortunately, output natively uses proportional font type on the screen.

However if output is stored, a non-proportional font type, e.g. Consolas in the
Notepad, can be used.

For formatted print the following
calls can be used:

**Print of a value** (it is expected, that d <= length of
characters printed)

- PrintI ( i, d ) - prints integer value on the d positions
- PrintR ( r, d1, d2 ) - prints integer value on the d1 positions with d2 decimal points
- PrintS ( s, d ) - prints integer value on the d positions
- PrintB ( b, d ) - prints integer value on the d positions

**Print of a vector**

- PrintVectorI (A, N, d ) - prints
**integer**vector elements on d positions (N rows, M columns) - PrintVectorR (A, N, d1, d2 ) - prints
**real**vector elements on d1 positions with d2 decimals (N rows, M columns) - PrintVectorS (A, N, d ) - prints
**string**vector elements on d positions (N rows, M columns) - PrintVectorB (A, N, d ) - prints
**boolean**vector elements on d positions (N rows, M columns)

**Print of a matrix**

- PrintMatrixI (A, N, M, d ) - prints
**integer**matrix**A**elements on d positions (N rows, M columns) - PrintMatrixR (A, N, M, d1, d2 ) - prints
**real**matrix**A**elements on d1 positions with d2 decimals (N rows, M columns) - PrintMatrixS (A, N, M, d ) - prints string
**matrix****A**elements on d positions (N rows, M columns) - PrintMatrixB (A, N, M, d ) - prints
**boolean**matrix**A**elements on d positions (N rows, M columns)

**Operations with vectors and matrices**

- CopyVector (A, B, N) - copy a vector
**A**to vector**B**of the size N - CopyMatrix (A, B, N, M) - copy a matrix
**A**to matrix**B**of the size N rows, M columns - Transpose (A, B, N, M) - transpose a matrix
**A**(size N rows, M columns) to a matrix**B**(size M rows, N columns) - DotProduct (A, B, N) - result is a real value
- CrossPruduct (A, B, C, N) - result is a vector
**C**(actually the outer product in the case N>3) - GeometricProduct (A, B, C, D, N) - result is a bi-vector
**C**and a scalar value**D**

**Solution of a linear equations**

- SolveGaussSeidel (A, x, b, N) - solution of a system of linear equations
**Ax = b**, size of the matrix**A**is N by N,**x**is vector of unknowns,**b**is the right side

(the Gauss elimination method is used) - Solve (A, x, b, N) - solution of a system of linear equations
**Ax = b**, size of the matrix**A**is N by N,**x**is vector of unknowns,**b**is the right side

(the iterative method is used, matrix**A**must be strictly positive definitive)