www.fatihkabakci.com

Personal Website and Computer Science TUR EN

ORTAGONAL MATRIS

Last update: 2/22/2012 5:21:00 AM

Yazan ve Cevaplayan:Fatih KABAKCI

Bu soru Chip Online sayfasında 30.12.2010 tarihinde Matella adlı kullanıcı tarafından sorulmuştur.

Gelen Soru: 3.Dışarıdan girilen bir matrisin bir ortogonal matris olup olmadığını bulan c prograamını yazınız.

Verilen Cevap:

3. Bir matrisin transpozesi ile carpımı birim matrisi veriyorsa,ilgili matris ortogonal bir matris olarak adlandırılmaktadır.3-3 bir matris icin denklem takımlarını inceleyecek olursak,
M11 M12 M13       *        M11 M21 M31       =      1  0  0
M21 M22 M23                M12 M22 M32              0  1  0 
M31 M32 M33                M13 M23 M33              0  0  1
Yukarıdaki formülasyonu elde ederiz.O halde yapmamız gereken ilk iş,matrisin transpozesini almak olacaktır.Daha sonra aynı köke ait bu iki matrisi çarparak sonucun birim matrise endekslenebileceğini test etmemiz gerekecektir.Anlatılan bu algoritmanın C dilindeki karşılığı aşağıdaki gibi olabilir.
#include <stdio.h>
#define row 2
#define field 2

int birimMatris(int sonucMatris[][field]) {

int flag=1,i,j;
for(i=0;i<row;i++) {
for(j=0;j<field;j++) {
if(i==j && sonucMatris[i][j]!=1) 
flag=0;
else if(i!=j && sonucMatris[i][j]!=0) 
flag=0;
}
if(!flag)
break;
}
if(flag)
printf("Matris ortogonal bir matristir\n");
else
printf("Matris ortogonal bir matris degildir\n");
}
void tranzpozAl(int tranzpozMatris[][field],int ilkMatris[][field]) {

int i,j;
for(i=0;i<row;i++)
for(j=0;j<field;j++)
tranzpozMatris[i][j]=ilkMatris[j][i]; // transpose alinir
}

void matrisCarp(int resultMatrix[][field],int ilkMatris[][field],int transpozMatris[][field]) {
int i,j,k;
for(i=0;i<row;i++)
for(j=0;j<field;j++)
for(k=0;k<2;k++) 
resultMatrix[i][j]+=ilkMatris[i][k]*transpozMatris[k][j]; // iki matris carpilir
}

int main()  {

int sonucMatris[row][field]={0,0};
int ilkMatris[row][field]={{1,0},{0,-1}};
int transpozMatris[field][row];
tranzpozAl(transpozMatris,ilkMatris);
matrisCarp(sonucMatris,ilkMatris,transpozMatris);
birimMatris(sonucMatris);
getchar();
return 0;
}
Yukarıdaki programda dikkat edilirse uygulanan her işlem ayrı bir fonksiyon baslıgında yer almaktadır.Bilgisayar biliminde bir cok problemin matris yoluyla cozuldugunden dolayı,görev akışının bagımsız parcalardan bir araya gelmesini anlamak daha kolay olacagının kanaatindeyim.

Başarılar
There has been no comment yet

Name:


Question/Comment
   Please verify the image




The Topics in Computer Science

Search this site for





 

Software & Algorithms

icon

In mathematics and computer science, an algorithm is a step-by-step procedure for calculations. Algorithms are used for calculation, data processing, and automated reasoning.

Programming Languages

icon

A programming language is a formal constructed language designed to communicate instructions to a machine, particularly a computer. It can be used to create programs to control the behavior of a machine. Java,C, C++,C#

Database

icon

A database is an organized collection of data. The data are typically organized to model aspects of reality in a way that supports processes requiring information.

Hardware

icon

Computer hardware is the collection of physical elements that constitutes a computer system. Computer hardware refers to the physical parts or components of a computer such as the monitor, memory, cpu.

Web Technologies

icon

Web development is a broad term for the work involved in developing a web site for the Internet or an intranet. Html,Css,JavaScript,ASP.Net,PHP are one of the most popular technologies. J2EE,Servlet, JSP,JSF, ASP

Mobile Technologies

icon

Mobile application development is the process by which application software is developed for low-power handheld devices, such as personal digital assistants, enterprise digital assistants or mobile phones. J2ME

Network

icon

A computer network or data network is a telecommunications network that allows computers to exchange data. In computer networks, networked computing devices pass data to each other along data connections.

Operating Systems

icon

An operating system is software that manages computer hardware and software resources and provides common services for computer programs. The OS is an essential component of the system software in a computer system. Linux,Windows

Computer Science

icon

Computer science is the scientific and practical approach to computation and its applications.A computer scientist specializes in the theory of computation and the design of computational systems.