mirror of https://github.com/xfarrow/lasd.git
parent
4aa82d6108
commit
980fce4cb7
|
@ -1,7 +1,7 @@
|
|||
|
||||
#! /bin/bash
|
||||
|
||||
g++-10 -o main \
|
||||
g++-10 -g -o main \
|
||||
zlasdtest/exercise1/simpletest.cpp zlasdtest/exercise1/fulltest.cpp \
|
||||
zlasdtest/exercise2/simpletest.cpp zlasdtest/exercise2/fulltest.cpp \
|
||||
zlasdtest/exercise3/simpletest.cpp zlasdtest/exercise3/fulltest.cpp \
|
||||
|
|
|
@ -218,6 +218,7 @@ Data& MatrixCSR<Data>::operator()(const ulong& r, const ulong& c){
|
|||
struct List<std::pair<Data,ulong>>::Node* nextNode = *ptr;
|
||||
*ptr = newNode;
|
||||
newNode->next = nextNode;
|
||||
(newNode->value).second = c;
|
||||
|
||||
if(last == ptr){ // the newely inserted element is the last one in its row
|
||||
for(ulong i=r+1 ; i<R.Size() ; ++i){ // then for each next row
|
||||
|
|
|
@ -72,7 +72,13 @@ bool MatrixVec<Data>::operator!=(const MatrixVec& toCompare) const noexcept{
|
|||
|
||||
template <typename Data>
|
||||
void MatrixVec<Data>::RowResize(const ulong& newdim){
|
||||
Vector<Data>::Resize(newdim);
|
||||
if(newdim == 0){
|
||||
Clear();
|
||||
}else{
|
||||
Vector<Data>::Resize(newdim * columns);
|
||||
rows = newdim;
|
||||
size = newdim * columns;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Data>
|
||||
|
|
|
@ -36,6 +36,7 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
SetRowNumber(loctestnum, loctesterr, mat, true, 1);
|
||||
SetColumnNumber(loctestnum, loctesterr, mat, true, 1);
|
||||
|
||||
std::cout<<"\nClearing the matrix\n";
|
||||
mat.Clear();
|
||||
|
||||
ExistsCell(loctestnum, loctesterr, mat, false, 0, 0);
|
||||
|
@ -45,10 +46,10 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
SetColumnNumber(loctestnum, loctesterr, mat, true, 4);
|
||||
GetColumnNumber(loctestnum, loctesterr, mat, true, 4);
|
||||
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 0, 1, 1);
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 1, 0, 2);
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 0, 1, 1); //15
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 1, 0, 2);//16
|
||||
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 2, 1, 3);
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 2, 1, 3);//17
|
||||
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 0, 3, 4);
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 2, 3, 5);
|
||||
|
@ -58,8 +59,8 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
|
||||
Mat<long> copmat(mat);
|
||||
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0);
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, copmat, true, &MapPrint<long>, 0);
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0); //22
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, copmat, true, &MapPrint<long>, 0); //23
|
||||
MapPostOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0);
|
||||
MapPostOrder<long, long>(loctestnum, loctesterr, copmat, true, &MapPrint<long>, 0);
|
||||
|
||||
|
@ -73,7 +74,7 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapDecrement<long>, 0);
|
||||
|
||||
SetColumnNumber(loctestnum, loctesterr, mat, true, 5);
|
||||
SetColumnNumber(loctestnum, loctesterr, mat, true, 5); //31
|
||||
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 1, 4, 8);
|
||||
SetCell<long>(loctestnum, loctesterr, mat, true, 3, 4, 9);
|
||||
|
@ -88,7 +89,7 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapIncrement<long>, 0);
|
||||
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0);
|
||||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0); //40
|
||||
|
||||
FoldPreOrder<long, long, long>(loctestnum, loctesterr, mat, true, &FoldMultiply<long>, 0, 1, 168);
|
||||
|
||||
|
@ -100,7 +101,7 @@ void stestMatrixInt(Mat<long>& mat, uint& testnum, uint& testerr) {
|
|||
MapPreOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0);
|
||||
MapPostOrder<long, long>(loctestnum, loctesterr, mat, true, &MapPrint<long>, 0);
|
||||
|
||||
FoldPreOrder<long, long, long>(loctestnum, loctesterr, mat, true, &FoldAdd<long>, 0, 0, 6);
|
||||
FoldPreOrder<long, long, long>(loctestnum, loctesterr, mat, true, &FoldAdd<long>, 0, 0, 6); //47
|
||||
|
||||
MapPostOrder<long, long>(loctestnum, loctesterr, mat, true, &MapIncrement<long>, 0);
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@ using namespace std;
|
|||
|
||||
void lasdtest() {
|
||||
cout << endl << "~*~#~*~ Welcome to the LASD Test Suite ~*~#~*~ " << endl;
|
||||
testSimpleExercise1();
|
||||
testFullExercise1();
|
||||
testSimpleExercise2();
|
||||
testFullExercise2();
|
||||
testSimpleExercise3();
|
||||
testFullExercise3();
|
||||
testSimpleExercise4();
|
||||
testFullExercise4();
|
||||
// testSimpleExercise1();
|
||||
// testFullExercise1();
|
||||
// testSimpleExercise2();
|
||||
// testFullExercise2();
|
||||
// testSimpleExercise3();
|
||||
// testFullExercise3();
|
||||
// testSimpleExercise4();
|
||||
// testFullExercise4();
|
||||
testSimpleExercise5();
|
||||
testFullExercise5();
|
||||
cout << endl << "Goodbye!" << endl;
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue