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 10 years, 7 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

  • flexible copper cable January 13, 2026
  • Sears 40/20 200amp starter/battery charger switch pinout January 13, 2026
  • renewed interest in old project I call it WICKED 8 January 13, 2026
  • Drawing software January 13, 2026
  • updating circuit with power on off switching January 13, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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