WE ARE THE THINKERS
Search This Blog
Tuesday, 30 September 2014
MOVIE REVIEW - The Silence of The Lambs(1991)
Play on your fears, meet the psychopaths !
Directed by Jonathan Demme, based upon the novel by the same name by Thomas Harris (1988), the movie takes us through a journey of psychopath minds: the way they think, the way they justify their crimes (even to themselves), the methods they use, and how the FBI works to catch them.
The movie has the seriousness and intensity that has been entirely lacking in horror movies lately. It features two serial killers, one who is an imprisoned criminal, Dr. Hannibal Lecter (Anthony Hopkins), the other one nicknamed as Buffalo Bill by the FBI. Clarice Starling(Jodie Foster), a top student at the FBI's training academy is set upon the assignment of investigating Buffalo Bill, who kills young women and removes the skin from their bodies for purposes unrevealed(Spoiler alert!).He is an amateur, has his weaknesses and can be caught, although only someone who has begun to think like him can defeat him.
Clarice is advised by her boss Jack Crawford (Scott Glenn) to interview "Hannibal the Cannibal" Dr.Lecter, to find out any leads to track down Buffalo. Lecter being an interesting character throughout the movie, is a prize-winning psychiatrist turned a killer and cannibal who gently manipulates her mind and plays on her fears.
The intimidating intellect of Hopkins' character is also reflected in his abundant wit, which he uses to provoke and torment his jailers and later confuse the forces to get away. He remains an unrepentant killer, almost as dangerous in his cell as he is on the loose. With his cunning facial expressions and amazing telepathic performances, he's the monster as genius, and Hopkins plays him with disturbing authority.
Cinematography and screenplay have very well put the seriousness intended by Harris in his novel. A tale of bloody scenes, suspense, deception, manipulation and a masterpiece for those longing to watch horror movies.
Monday, 11 February 2013
code to find the inverse of a matrix:
#include<stdio.h>
#include<stdlib.h>
int n;
void copym(float **a,float **b,int p)
{
int i,j;for (i=0;i<p;i++){for (j=0;j<p;j++){b[i][j]=a[i][j];}}return;
}
float **divm(float **a,float k)
{int i,j;for (i=0;i<n;i++){for (j=0;j<n;j++){a[i][j]=a[i][j]/k;}}return a;}
int powm1(int i)
{if (i%2==0)return 1;else return -1;}
void print_mat(float **a)
{int i,j;for (i=0;i<n;i++){for(j=0;j<n;j++){printf("%f ",a[i][j]);}printf("\n");}}
void swap(float * a,float * b)
{float t;t=*a;*a=*b;*b=t;return;}
void row_change(float * a,float * b)
{int i;for (i=0;i<n;i++){swap (&a[i],&b[i]);}return;}
void row_trans(float * a,float *b,float f)
{int i;for (i=0;i<n;i++){a[i]=a[i]+f*b[i];}return;}
float **extract(float **a,int i,int j)
{int k,l,m,p; float **b=calloc(n-1,sizeof(float *));for (k=0,m=0;k<n&&m<n-1;k++,m++){if (k==i)k++;}b[m]=calloc(n-1,sizeof(float));for (l=0,p=0;l<n&&p<n-1;l++,p++){if (l==j){l++;}b[m][p]=a[k][l];}}return b;}
float det(float **b,int m)
{
float **a=calloc(m,sizeof(float *));
int i,j,k,count=0;for (i=0;i<m;i++){a[i]=calloc(m,sizeof(float));}copym(b,a,m);
for (i=0;i<m;i++){if (a[i][i]==0){for (j=i;j<m;j++){if (a[j][i] !=0){row_change(a[i],a[j]);count=count+1;break;}}if (a[i][i] == 0){for (j=i;j<m;j++){if(a[i][j] !=0){for (k=0;k<m;k++){ if (k !=i){row_trans(a[k],a[i],-a[k][j]/a[i][j]);}}break;}}}}else{for (j=0;j<m;j++){if (j !=i){row_trans(a[j],a[i],-a[j][i]/a[i][i]);}}}}float pro=1;for (i=0;i<m;i++){pro=pro*a[i][i];}if (count%2==0){return pro;}else return (-1*pro);}
float **cof(float **a)
{int i,j;float **c=calloc(n,sizeof(float *));for (i=0;i<n;i++){*(c+i)=calloc(n,sizeof(float));for (j=0;j<n;j++){c[i][j]=powm1(i+j)*det(extract(a,i,j),n-1);}}return c;}
float **trpose(float **a)
{int i,j;for (i=0;i<n;i++){for(j=0;j<n;j++){if(i>=j){swap(&a[i][j],&a[j][i]);}}}return a;}
main()
{printf("enter the order\n");
scanf("%d",&n);
float **a=calloc(n,sizeof(float *));
int i,j;for (i=0;i<n;i++){a[i]=calloc(n,sizeof(float));for (j=0;j<n;j++){scanf("%f",&a[i][j]);}}
float d=det(a,n);
if (d !=0)
{
print_mat(divm(trpose(cof(a)),d));
}
else
printf("inverse doesn't exist\n");}
paste this code and see what happens.........keep wondering till the next program.
#include<stdio.h>
#include<stdlib.h>
int n;
void copym(float **a,float **b,int p)
{
int i,j;for (i=0;i<p;i++){for (j=0;j<p;j++){b[i][j]=a[i][j];}}return;
}
float **divm(float **a,float k)
{int i,j;for (i=0;i<n;i++){for (j=0;j<n;j++){a[i][j]=a[i][j]/k;}}return a;}
int powm1(int i)
{if (i%2==0)return 1;else return -1;}
void print_mat(float **a)
{int i,j;for (i=0;i<n;i++){for(j=0;j<n;j++){printf("%f ",a[i][j]);}printf("\n");}}
void swap(float * a,float * b)
{float t;t=*a;*a=*b;*b=t;return;}
void row_change(float * a,float * b)
{int i;for (i=0;i<n;i++){swap (&a[i],&b[i]);}return;}
void row_trans(float * a,float *b,float f)
{int i;for (i=0;i<n;i++){a[i]=a[i]+f*b[i];}return;}
float **extract(float **a,int i,int j)
{int k,l,m,p; float **b=calloc(n-1,sizeof(float *));for (k=0,m=0;k<n&&m<n-1;k++,m++){if (k==i)k++;}b[m]=calloc(n-1,sizeof(float));for (l=0,p=0;l<n&&p<n-1;l++,p++){if (l==j){l++;}b[m][p]=a[k][l];}}return b;}
float det(float **b,int m)
{
float **a=calloc(m,sizeof(float *));
int i,j,k,count=0;for (i=0;i<m;i++){a[i]=calloc(m,sizeof(float));}copym(b,a,m);
for (i=0;i<m;i++){if (a[i][i]==0){for (j=i;j<m;j++){if (a[j][i] !=0){row_change(a[i],a[j]);count=count+1;break;}}if (a[i][i] == 0){for (j=i;j<m;j++){if(a[i][j] !=0){for (k=0;k<m;k++){ if (k !=i){row_trans(a[k],a[i],-a[k][j]/a[i][j]);}}break;}}}}else{for (j=0;j<m;j++){if (j !=i){row_trans(a[j],a[i],-a[j][i]/a[i][i]);}}}}float pro=1;for (i=0;i<m;i++){pro=pro*a[i][i];}if (count%2==0){return pro;}else return (-1*pro);}
float **cof(float **a)
{int i,j;float **c=calloc(n,sizeof(float *));for (i=0;i<n;i++){*(c+i)=calloc(n,sizeof(float));for (j=0;j<n;j++){c[i][j]=powm1(i+j)*det(extract(a,i,j),n-1);}}return c;}
float **trpose(float **a)
{int i,j;for (i=0;i<n;i++){for(j=0;j<n;j++){if(i>=j){swap(&a[i][j],&a[j][i]);}}}return a;}
main()
{printf("enter the order\n");
scanf("%d",&n);
float **a=calloc(n,sizeof(float *));
int i,j;for (i=0;i<n;i++){a[i]=calloc(n,sizeof(float));for (j=0;j<n;j++){scanf("%f",&a[i][j]);}}
float d=det(a,n);
if (d !=0)
{
print_mat(divm(trpose(cof(a)),d));
}
else
printf("inverse doesn't exist\n");}
paste this code and see what happens.........keep wondering till the next program.
Sunday, 10 February 2013
Saturday, 9 February 2013
c code to find the determinant of a matrix.
code to find the determinant of a matrix:
#include<stdio.h>
int n;
void swap(float * a,float * b)
{
float t;
t=*a;
*a=*b;
*b=t;
return;
}
void print_mat(float a[100][100])
{
int i,j;
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%f ",a[i][j]);
}
printf("\n");}
}
void row_change(float * a,float * b)
{
int i;
for (i=0;i<n;i++)
{
swap (&a[i],&b[i]);
}
return;}
void row_trans(float * a,float *b,float f)
{int i;
for (i=0;i<n;i++)
{
a[i]=a[i]+f*b[i];
}
return;
}
/* int **extract(int a[s][s],int j)
{
int k,l,i;
int b[s-1][s-1];
for (k=1;k<s;k++)
{
for (i=0,l=0;l<s && l !=j;l++)
{
b[k-1][i]=a[k][l];
i++;
}
}
return b;
}*/
main ()
{
float a[100][100];
scanf("%d",&n);
int i,j,k,count=0;
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
{
scanf("%f",&a[i][j]);
}
}
print_mat(a);
for (i=0;i<n;i++)
{
if (a[i][i]==0)
{
for (j=i;j<n;j++)
{
if (a[j][i] !=0)
{
row_change(a[i],a[j]);
count=count+1;
break;
}
}
if (a[i][i] == 0)
{
for (j=i;j<n;j++)
{
if(a[i][j] !=0)
{
for (k=0;k<n;k++)
{ if (k !=i)
{
row_trans(a[k],a[i],-a[k][j]/a[i][j]);
}
}
break;
}
}
}
}
else
{
for (j=0;j<n;j++)
{
if (j !=i)
{
row_trans(a[j],a[i],-a[j][i]/a[i][i]);
}
}
}
}
print_mat(a);
float pro=1;
for (i=0;i<n;i++)
{
pro=pro*a[i][i];
}
if (count%2==0)
{
printf("%f\n",pro);
}
else
printf("%f\n",-1*pro);
}
you may wonder why the extract function is written there in comments...just to facilitate you get the cofactor of an element.
#include<stdio.h>
int n;
void swap(float * a,float * b)
{
float t;
t=*a;
*a=*b;
*b=t;
return;
}
void print_mat(float a[100][100])
{
int i,j;
for (i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%f ",a[i][j]);
}
printf("\n");}
}
void row_change(float * a,float * b)
{
int i;
for (i=0;i<n;i++)
{
swap (&a[i],&b[i]);
}
return;}
void row_trans(float * a,float *b,float f)
{int i;
for (i=0;i<n;i++)
{
a[i]=a[i]+f*b[i];
}
return;
}
/* int **extract(int a[s][s],int j)
{
int k,l,i;
int b[s-1][s-1];
for (k=1;k<s;k++)
{
for (i=0,l=0;l<s && l !=j;l++)
{
b[k-1][i]=a[k][l];
i++;
}
}
return b;
}*/
main ()
{
float a[100][100];
scanf("%d",&n);
int i,j,k,count=0;
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
{
scanf("%f",&a[i][j]);
}
}
print_mat(a);
for (i=0;i<n;i++)
{
if (a[i][i]==0)
{
for (j=i;j<n;j++)
{
if (a[j][i] !=0)
{
row_change(a[i],a[j]);
count=count+1;
break;
}
}
if (a[i][i] == 0)
{
for (j=i;j<n;j++)
{
if(a[i][j] !=0)
{
for (k=0;k<n;k++)
{ if (k !=i)
{
row_trans(a[k],a[i],-a[k][j]/a[i][j]);
}
}
break;
}
}
}
}
else
{
for (j=0;j<n;j++)
{
if (j !=i)
{
row_trans(a[j],a[i],-a[j][i]/a[i][i]);
}
}
}
}
print_mat(a);
float pro=1;
for (i=0;i<n;i++)
{
pro=pro*a[i][i];
}
if (count%2==0)
{
printf("%f\n",pro);
}
else
printf("%f\n",-1*pro);
}
you may wonder why the extract function is written there in comments...just to facilitate you get the cofactor of an element.
Subscribe to:
Posts (Atom)