Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 23rd, 2005, 4:25 PM   #11
layer
Hobbyist Programmer
 
Join Date: Feb 2005
Posts: 112
Rep Power: 4 layer is on a distinguished road
Definatley a one post member, maybe a few more to come and tell us off... But unless this is Chinese: zxasqwedc then who would want that to be their name everyone calls them? Ex:
"Hey zxasqwedc "... Wtf? Lol...
layer is offline   Reply With Quote
Old Apr 23rd, 2005, 6:19 PM   #12
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Meh. Well, it's the two leftmost keys at the bottom, followed by the two in the middle, then the two at the top, and finally the third key from top to bottom. Don't ask me why though.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 24th, 2005, 12:32 AM   #13
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6 bl00dninja is on a distinguished road
Quote:
hell yeah dude, show us what you got so far!
yeah i was trying to be nice thinking he might post back with some effort. he can suck a donkey dick.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Apr 25th, 2005, 4:36 AM   #14
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
some kid paid me £50 to do his homework once, i did it in about 20 minutes was a nice little earner, i only did it cause he just needed toi pass teh class and then he would have no more programming to do again. Just a silly uni subject.
Berto is offline   Reply With Quote
Old Apr 26th, 2005, 2:33 AM   #15
zxasqwedc
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 zxasqwedc is an unknown quantity at this point
thanks for your help....

here is my sollution clever guys...


public class SparseVector{

	protected int dimension=0;
	private int index=0;
	public NonZero[] vector;
	
	public SparseVector(int dim){
		dimension=dim;
		
	}
	
	
	public void put(int loc,int val){
		NonZero a=new NonZero(loc,val);
		vector[index]=a;
		index=index+1;
	}
	
	
	public int get(int where){
		int walue=0;
		for(int i=0;i<=index;i++){
			if(vector[i].location==where)
			walue=vector[i].value;
			
		}
		return walue;
	}
	
	
	
	public SparseVector add(SparseVector a,SparseVector b){
		
		int temp1=0; 
		int temp2=0;
		int control=2;
		SparseVector sum=new SparseVector(a.dimension);
		for(int y=0;y<(a.vector).length;y++){
			int locA=(a.vector)[y].location;
			for(int z=0;z<(b.vector).length;z++){
				if(locA==(((b.vector)[z]).location)){
					temp1=((a.vector)[y].value)+((b.vector)[z].value);
					control=1;
				}
				else{
					temp2=((a.vector)[y].value);
							
				}
				if(control==1)
				sum.put(locA,temp1);
				else
				sum.put(locA,temp2);
				
				control=2;	
			}
		}
		
		for(int x=0;x<(b.vector).length;x++){
			int locB=(b.vector)[x].location;
			for(int v=0;v<(a.vector).length;v++){
				if(locB==(a.vector)[v].location){
					control=1;
				}
				else{
					temp2=(b.vector)[x].value;
				}
				
				if(control==2)
					sum.put(locB,temp2);
					
				control=2;
			}
		}
		
		
		return sum;
		
		
	}
	
	
	
	
	public SparseVector multiply(int constant){
		for(int m=0;m<(this.vector).length;m++){
			(this.vector)[m].value=((this.vector)[m].value)*constant;
						
		}
	return this;	
	}
	
	

	
	
	
}



public class NonZero{
	public int location,locationX,locationY, value;
	
	public NonZero(int loc, int val){
		location=loc;
		value=val;
	}
	
	public NonZero(int locx,int locy, int val){
		locationX=locx;
		locationY=locy;
		value=val;
	}
}
zxasqwedc is offline   Reply With Quote
Old Apr 26th, 2005, 3:01 AM   #16
zxasqwedc
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 zxasqwedc is an unknown quantity at this point
Quote:
Originally Posted by bl00dninja
yeah i was trying to be nice thinking he might post back with some effort. he can suck a donkey dick.


and this is the SparseMatrix class right up into your ass...

public class SparseMatrix{

	protected int verticalDimension=0;
	protected int horizontalDimension=0;
	private int index=0;
	public NonZero[] vector;
	
	public SparseMatrix(int dimv, int dimh){
		verticalDimension=dimv;
		horizontalDimension=dimh;
		
	}
	
	
	public void put(int locX,int locY,int val){
		NonZero a=new NonZero(locY,locX,val);
		vector[index]=a;
		index=index+1;
	}
	
	
	public int get(int whereX,int whereY){
		int walue=0;
		for(int i=0;i<=index;i++){
			if(vector[i].locationX==whereX && vector[i].locationY==whereY)
			walue=vector[i].value;
			
		}
		return walue;
	}
	
	
	
	public SparseMatrix add(SparseMatrix a,SparseMatrix b){
		
		int temp1=0; 
		int temp2=0;
		int control=2;
		SparseMatrix sum=new SparseMatrix(a.verticalDimension,a.horizontalDimension);
		for(int y=0;y<(a.vector).length;y++){
			int locAy=(a.vector)[y].locationY;
			int locAx=(a.vector)[y].locationX;
			for(int z=0;z<(b.vector).length;z++){
				if((locAy==(((b.vector)[z]).locationY))&&(locAx==(((b.vector)[z]).locationX))){
					temp1=((a.vector)[y].value)+((b.vector)[z].value);
					control=1;
				}
				else{
					temp2=((a.vector)[y].value);
							
				}
				if(control==1)
				sum.put(locAy,locAx,temp1);
				else
				sum.put(locAy,locAx,temp2);
				
				control=2;	
			}
		}
		
		for(int x=0;x<(b.vector).length;x++){
			int locBy=(b.vector)[x].locationY;
			int locBx=(b.vector)[x].locationX;
			for(int v=0;v<(a.vector).length;v++){
				if((locBy==(a.vector)[v].locationY)&&(locBx==(a.vector)[v].locationX)){
					control=1;
				}
				else{
					temp2=(b.vector)[x].value;
				}
				
				if(control==2)
					sum.put(locBy,locBx,temp2);
					
				control=2;
			}
		}
		
		
		return sum;
		
		
	}
	
	
	
	
	public SparseMatrix multiply(int constant){
			for(int m=0;m<(this.vector).length;m++){
			(this.vector)[m].value=((this.vector)[m].value)*constant;
						
		}
	return this;	
	}
	
	

	
	
	
}
zxasqwedc is offline   Reply With Quote
Old Apr 26th, 2005, 3:13 AM   #17
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 6 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
and now wasnt it better that you did it yourself?
Berto is offline   Reply With Quote
Old Apr 26th, 2005, 3:29 AM   #18
zxasqwedc
Newbie
 
Join Date: Apr 2005
Posts: 5
Rep Power: 0 zxasqwedc is an unknown quantity at this point
the original one done with arraylist class...

by the way, i'm not from china

3===================>

Last edited by zxasqwedc; Apr 26th, 2005 at 7:35 AM.
zxasqwedc is offline   Reply With Quote
Old Apr 26th, 2005, 12:22 PM   #19
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 406
Rep Power: 5 xavier is on a distinguished road
Send a message via Yahoo to xavier
If you would have shown a small amount of effort, and not just give us the problem and expect to solve it ... you would have been treated allot better.

Ps: are u sure YOU wrote that code ?.. or did someone had merci on you?
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Apr 26th, 2005, 2:16 PM   #20
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Wow, proved us wrong a 1+ poster...

Although, I still think you need to try it on your own first before having it done for you... that's how you learn.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:46 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC