0

Hi guys and girls
I am writing a program to solve a linear system equations using
gaussian elimination method by taking the factors and storing them in
a NxN+1 matrix,

this matrix can take integer numbers as well as floating point numbers
i need help in translating this program to floating point

it's ok to use pseudo code instruction but it's better to use real instruction

one last thing i need to promote the user to:
. choose N
. to choose the name of the input text file to store the matrix

and how to read the stored numbers from a file and converting them from string to single precision.

thanks in advance to you all

this is the code:

Gaussian:

addiu $s0,$Zero,0	#ALU Inst.
addiu $s1,$Zero,0	#Float. Point Inst.
addiu $s2,$Zero,0	#Load&Store Inst.
addiu $s3,$Zero,0	#Branch&Jmp Inst.

xor $t0,$t0,$t0

addiu $t0,$t0,0    	#t0=k=0

addiu $s0,$s0,1

addiu $t1,$t1,0    	#t1=N

addiu $s0,$s0,1

addiu $t2,$t2,-2	#t2=N-2

addiu $s0,$s0,1

addiu $t3,$t1,-1	#t3=n-1

addiu $s0,$s0,1

For1:
	beq $t0,$t3,Quit
	addiu $s3,$s3,1
For2:
	addiu $t4,$t0,1	#i=k+1
	addiu $s0,$s0,1
	beq $t4,$t1,Quit
	addiu $s3,$s3,1

	addiu $t7,$t1,1		#4k+(n+1)i
	addiu $s0,$s0,1
	mul $t7,$t4
	addiu $s0,$s0,1	
	mflo $s4
	addiu $s0,$s0,1
	addiu $t8,$zero,4
	addiu $s0,$s0,1
	mul $t8,$t0
	addiu $s0,$s0,1
	mflo $s5 
	addiu $s0,$s0,1
	addiu $s6,$s5,$s4
	addiu $s0,$s0,1

	lw $s7, 0($s6)
	addiu $s2,$s2,1
			
	mul $t7,$t0	#4k+(n+1)k
	addiu $s0,$s0,1
	mflo $t9 
	addiu $s0,$s0,1
	addiu $t9,$s5,$t9
	addiu $s0,$s0,1

	lw $s5, 0($t9)
	addiu $s2,$s2,1

	div $s7,$s5
	addiu $s0,$s0,1
	mflo $s4		# factor=$s4
	addiu $s0,$s0,1

	addiu $t5,$t0,1	#j=k+1
	addiu $s0,$s0,1	
	addiu $t6,$t1,1	#t6=N+1
	addiu $s0,$s0,1	
	beq $t5,$t6,Quit
	addiu $s3,$s3,1

For3:	
	mul $t8,$t5	#4j+(n+1)i
	addiu $s0,$s0,1
	mflo $s5 
	addiu $s0,$s0,1
	addiu $s6,$s5,$s4
	addiu $s0,$s0,1

	lw $s5,0($s6)
	addiu $s2,$s2,1

	mul $t7,$t0	#4j+(n+1)k
	addiu $s0,$s0,1
	mflo $s7 
	addiu $s0,$s0,1
	addiu $s6,$s5,$s7
	addiu $s0,$s0,1

	lw $s7,0($s6) 
	addiu $s2,$s2,1
	
	mul $s4,$s7
	addiu $s0,$s0,1
	mflo $xx
	addiu $s0,$s0,1
	subu $xx,$s5,$xx
	addiu $s0,$s0,1
	sw $xx,0($s6)
	addiu $s2,$s2,1
	addiu $t0,$t0,1
	addiu $s0,$s0,1
	jmp For1
	addiu $s3,$s3,1	
Quit:
	sw $zero,0($s6)
	addiu $s2,$s2,1
	addiu $s2,$s2,1

	addu $s4,$s0,$s1
	addu $s5,$s2,$s3
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Nick Evan
0

From PM:

i want to delete this post

We don't delete posts here. You can just ignore this thread and mark it as 'solved' to ensure that no-one wasts his/her time on this.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.