EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / coding

coding

|

Projects › Projects › coding

  • This topic has 0 replies, 1 voice, and was last updated 9 years, 11 months ago by Prabin garhwal.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • June 10, 2015 at 8:31 am #3704
    Prabin garhwal
    Participant

    Hello!.. m trying to implement a code to transform any matrix to row reduced echelon form.. i have done some coding over it bt still canoot get the output correctly… can u please help me through it…here is how i have done..

    #include<stdio.h>
    #include<math.h>
    main()
    {
    int orgp[20][20],dupp[20][20];
    int rc,cc,i,j,r,lead=0,c;
    int z,a,b;
     
    printf("Enter row size::n");
    scanf("%d",&rc);
    printf("Enter column size ::n");
    scanf("%d",&cc);
    printf("Enter the parity check matrix row wise :: n");
    for(i=0;i<rc;i++)
    {
    for(j=0;j<cc;j++)
    {
    scanf("%d",&orgp[j]);
    dupp[j]=orgp[j];
    }
    }
    printf("Enter matrix is :: n");
    for(i=0;i<rc;i++)
    {
            for(j=0;j<cc;j++)
            {
            printf("%d",orgp[j]);
            printf("t");
            }
    printf("n");
    }
     
    for(r=0;r<rc;r++)
    {
    if(cc<=lead)
    {
    break;
    }
    i=r;
    while(orgp[lead]==0)
    {
    i=i+1;
    if(rc==1)
    {
    i=r;
    lead=lead+1;
    if(cc=lead)
    {
    break;
    }
    }
    }
     
     
    a=i;
    b=r;
    for(i=0;i<rc;i++)
    {
    c=orgp[a-1];
    orgp[a-1]=dupp[b-1];
    dupp[b-1]=c;
     
    }
     
    if(orgp[r][lead]!=0)
    {
    z=orgp[r][lead];
    for(j=0;j<cc;j++)
    {
    orgp[r][j]=orgp[r][j]/z;
    }
    }
     
    for(i=0;i<rc;i++)
    {
    if(i!=r)
    {
    for(j=0;j<cc;j++)
    {
    orgp[j]=orgp[j]-orgp[lead]*orgp[r][j];
    }
    }
     
    }
    lead=lead+1;
    }
     
    printf("The matrix in reduced echelon form is ::n");
    for(i=0;i<rc;i++)
    {
            for(j=0;j<cc;j++)
            {
            printf("%d",orgp[j]);
            printf("t");
            }
            printf("n");
    }
     
     
     
     
    }
     
  • Author
    Posts
Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • 12v battery, 18v magic May 23, 2025
  • JBL charge 4 dead motherboard? May 23, 2025
  • Back to the old BASIC days May 23, 2025
  • Reclaiming missing motherboard header May 23, 2025
  • Need help in repairing a dead motherboard May 23, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise