#include <kmatrix.h>
|
| KMatrix () |
|
| KMatrix (const KMatrix &) |
|
| KMatrix (int, int) |
|
| ~KMatrix () |
|
void | copy_delete (void) |
|
void | copy_new (int) |
|
void | copy_zero (void) |
|
void | copy_unit (int) |
|
void | copy_shallow (KMatrix &) |
|
void | copy_deep (const KMatrix &) |
|
K | get (int, int) const |
|
void | set (int, int, const K &) |
|
int | row_is_zero (int) const |
|
int | column_is_zero (int) const |
|
int | column_pivot (int, int) const |
|
int | gausseliminate (void) |
|
int | rank (void) const |
|
int | solve (K **, int *) |
|
K | multiply_row (int, const K &) |
|
K | add_rows (int, int, const K &, const K &) |
|
int | swap_rows (int, int) |
|
K | set_row_primitive (int) |
|
int | is_quadratic (void) const |
|
int | is_symmetric (void) const |
|
K | determinant (void) const |
|
template<class K>
class KMatrix< K >
Definition at line 41 of file kmatrix.h.
◆ KMatrix() [1/3]
◆ KMatrix() [2/3]
◆ KMatrix() [3/3]
◆ ~KMatrix()
◆ add_rows()
template<class K >
K KMatrix< K >::add_rows |
( |
int |
src, |
|
|
int |
dest, |
|
|
const K & |
factor_src, |
|
|
const K & |
factor_dest |
|
) |
| |
Definition at line 423 of file kmatrix.h.
432 int i_src = src*
cols;
433 int i_dest = dest*
cols;
435 for(
i=0;
i<
cols;
i++,i_src++,i_dest++ )
437 a[i_dest] =
a[i_src]*factor_src +
a[i_dest]*factor_dest;
◆ column_is_zero()
template<class K >
int KMatrix< K >::column_is_zero |
( |
int |
c | ) |
const |
◆ column_pivot()
template<class K >
int KMatrix< K >::column_pivot |
( |
int |
r0, |
|
|
int |
c |
|
) |
| const |
Definition at line 490 of file kmatrix.h.
500 for( r=r0; r<
rows &&
a[r*
cols+c]==(K)0; r++ );
510 double val =
a[r*
cols+c].complexity( );
511 double val_new = 0.0;
516 if(
a[r*
cols+c] != (K)0 &&
517 ( val_new =
a[r*
cols+c].complexity( ) ) < val )
◆ copy_deep()
◆ copy_delete()
template<class K >
void KMatrix< K >::copy_delete |
( |
void |
| ) |
|
|
inline |
◆ copy_new()
template<class K >
void KMatrix< K >::copy_new |
( |
int |
k | ) |
|
|
inline |
Definition at line 119 of file kmatrix.h.
129 #ifdef KMATRIX_IOSTREAM
130 cerr <<
"void KMatrix::copy_new( int k )";
131 cerr <<
": no memory left ..." << endl;
133 fprintf( stderr,
"void KMatrix::copy_new( int k )" );
134 fprintf( stderr,
": no memory left ...\n" );
149 #ifdef KMATRIX_IOSTREAM
150 cerr <<
"void KMatrix::copy_new( int k )";
151 cerr <<
": k < 0 ..." << endl;
153 fprintf( stderr,
"void KMatrix::copy_new( int k )" );
154 fprintf( stderr,
": k < 0 ...\n" );
◆ copy_shallow()
◆ copy_unit()
template<class K >
void KMatrix< K >::copy_unit |
( |
int |
rank | ) |
|
|
inline |
Definition at line 178 of file kmatrix.h.
184 for( r=0; r<n;
a[r++]=(K)0 );
186 for( r=0; r<
rows; r++ )
◆ copy_zero()
template<class K >
void KMatrix< K >::copy_zero |
( |
void |
| ) |
|
|
inline |
◆ determinant()
template<class K >
K KMatrix< K >::determinant |
( |
void |
| ) |
const |
Definition at line 867 of file kmatrix.h.
884 for( r=0; r<dummy.rows; r++ )
886 det *= dummy.set_row_primitive( r );
892 for( c=0; c<
cols &&
rank<dummy.rows; c++ )
894 if( ( r = dummy.column_pivot(
rank,c )) >= 0 )
896 det *= dummy.swap_rows(
rank,r );
898 for( r=
rank+1; r<dummy.rows; r++ )
900 if( dummy.a[r*
cols+c] != (K)0 )
904 frank = -dummy.a[r*
cols+c]/
g;
907 det /= dummy.add_rows(
rank,r,frank,fr );
908 det *= dummy.set_row_primitive( r );
915 if(
rank != dummy.rows )
920 for( r=0; r<dummy.rows; r++ )
922 det *= dummy.a[r*
cols+r];
◆ gausseliminate()
template<class K >
int KMatrix< K >::gausseliminate |
( |
void |
| ) |
|
◆ get()
template<class K >
K KMatrix< K >::get |
( |
int |
r, |
|
|
int |
c |
|
) |
| const |
◆ is_quadratic()
template<class K >
int KMatrix< K >::is_quadratic |
( |
void |
| ) |
const |
◆ is_symmetric()
template<class K >
int KMatrix< K >::is_symmetric |
( |
void |
| ) |
const |
◆ multiply_row()
◆ rank()
template<class K >
int KMatrix< K >::rank |
( |
void |
| ) |
const |
Definition at line 693 of file kmatrix.h.
697 return dummy.gausseliminate( );
◆ row_is_zero()
template<class K >
int KMatrix< K >::row_is_zero |
( |
int |
r | ) |
const |
◆ set()
◆ set_row_primitive()
template<class K >
K KMatrix< K >::set_row_primitive |
( |
int |
r | ) |
|
◆ solve()
template<class K >
int KMatrix< K >::solve |
( |
K ** |
solution, |
|
|
int * |
k |
|
) |
| |
Definition at line 599 of file kmatrix.h.
609 for( r=0; r<
rows; r++ )
625 for( r=0; r<
rank; r++ )
627 if(
a[r*
cols+c] != (K)0 )
637 if(
a[r*
cols+c] != (K)0 )
656 *solution =
new K[
cols-1];
659 for( c=0; c<
cols-1; c++ )
661 (*solution)[c] = (K)0;
664 for( r=0; r<
rows; r++ )
666 for( c=0; c<
cols &&
a[r*
cols+c] == (K)0; c++ );
670 (*solution)[c] = ((K)
a[(r+1)*
cols-1])/
a[r*
cols+c];
680 *solution = (K*)
NULL;
◆ swap_rows()
template<class K >
int KMatrix< K >::swap_rows |
( |
int |
r1, |
|
|
int |
r2 |
|
) |
| |
Definition at line 372 of file kmatrix.h.
379 if( r1 == r2 )
return 1;
383 for(
int c=0; c<
cols; c++ )
◆ cols
◆ rows
The documentation for this class was generated from the following file:
bool pivot(const matrix aMat, const int r1, const int r2, const int c1, const int c2, int *bestR, int *bestC, const ring R)
This code computes a score for each non-zero matrix entry in aMat[r1..r2, c1..c2].