Boost logo

Ublas :

From: Seabook (cipoke_at_[hidden])
Date: 2006-12-05 23:10:57


Dear all,

I am Kuo-Shih.
I am trying to use uBLAS for my project.
There are many sparse and/or symmetry matrix in my algorithm.
I run it on Visuall C++ .NET 2003.
My NB info.
HARDWARE: CPU 1.66Ghz 504 RAM
OS: Windows XP

There are some data about normal/sparse/symmetry matrix.
                     Debug(ms)Release(msec)
Sparse 139094 46390
Symmetry 139094 46390
Normal 2578 1329
The efficiency are really terrible?!
Did I forget something ? (such as declare or method of prod or assign data )

Thanks for answers~

Sincerely yours,
Kuo-Shih

----my source code----

#include "stdafx.h"
#include "time.h"
#include "gc_matrix.h"
#using <mscorlib.dll>
#include <boost\numeric\ublas\matrix.hpp>
#include <boost\numeric\ublas\symmetric.hpp>
#include <boost\numeric\ublas\matrix_sparse.hpp>
using namespace System;
using namespace boost::numeric::ublas;

int _tmain()
{
        int i,j,ta1,ta2,dt_normal,tb1,tb2,dt_Sparse,tc1,tc2,dt_Symmetry;
        float m1 __gc[,]=new float __gc[100,100];
        float m2 __gc[,]=new float __gc[100,100];
        float m3 __gc[,]=new float __gc[100,100];
        symmetric_matrix<float> sy1(100,100),sy2(100, 100),sy3(100,100);
        compressed_matrix<float> sp1(100,100),sp2(100,100),sp3(100,100);

        //---initial matrix sparse & symmetry---//
        for(i=0;i<99;i++)
        {
                for(j=0;j<99;j++)
                {
                sp1(i,j)=0;
                sp2(i,j)=0;
                sy1(i,j)=0;
                sy1(i,j)=0;
                }
                sp1(i,j)=1;
                sp2(i,j)=1;
                sy1(i,j)=1;
                sy1(i,j)=1;
        }

        //----Sparse matrix------//
        tb1=clock();
        for(i=0;i<100;i++)
        {
        sp3=prod(sp1,sp2);
        }
        tb2=clock();
        dt_Sparse=tb2-tb1; // time of sparse matrix prod
        printf("%d", dt_Sparse);
        //-----symmetry matrix------//
        tc1=clock();
        for(i=0;i<100;i++)
        {
        sy3=prod(sy1,sy2);
        }
        tc2=clock();
        dt_Symmetry=tb2-tb1;
        printf("%d", dt_Symmetry);
        //-----normal matrix-----//
        ta1=clock();
        for(i=0;i<100;i++)
        {
        Matrix_Multi2(100,100,100,&m1[0,0],&m2[0,0],&m3[0,0]);
        }
        ta2=clock();
        dt_normal=ta2-ta1;
        printf("%d", dt_normal);

        Console::WriteLine(S" Good Job!!! ");
        return 0;
}
 

-- 
View this message in context: http://www.nabble.com/Bad-prod-efficiency-of-sparse-symmetry-matrix---tf2766020.html#a7713274
Sent from the Boost - uBLAS mailing list archive at Nabble.com.