« Introduction au langage C/Matrices complexes 2 » : différence entre les versions

Contenu supprimé Contenu ajouté
m Robot : Remplacement de texte automatisé (-\bE(tud) +É\1)
m Robot : Remplacement de texte automatisé (- n'est pas + n’est pas , - Aujourd'hui + Aujourd’hui , - d'euros + d’euros , - d'agir + d’agir , - l'apparence + l’apparence ); changements de type cosmétique
Ligne 23 :
<source lang="c">
/* ------------------------------ */
/* Save as : c01.c */
/* ------------------------------ */
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
/* ------------------------------ */
#define C0 0
#define C1 1
#define C2 2
#define C3 3
#define C4 4
#define C5 5
 
#define R0 0
#define R1 1
#define R2 2
#define R3 3
#define R4 4
#define R5 5
 
#define RC0 0
#define RC1 1
#define RC2 2
#define RC3 3
#define RC4 4
 
#define OF 0
 
#define R_SIZE 0
#define C_SIZE 1
#define C_SIZE_A 2
 
#define ERROR_E +1.E-010
 
#define FIRST 1
#define FILENAME 11
 
#ifndef PI
#define PI 3.14159265359
#endif
/* ------------------------------ */
double **i_mZ(
int r,
int c
)
{
double **A;
int ar;
int ac;
int i;
 
if(r<1||c<1)
Ligne 116 :
for(i=1; i<ar; i++) A[i] = A[0]+i*ac;
 
/* Memorize the matrix size*/
A[R_SIZE][OF] = ar;/* A[R_SIZE][OF] = A[0][0] */
A[C_SIZE][OF] = ac;/* A[C_SIZE][OF] = A[1][0] */
 
/* I initialize the zero row and the zero column */
for(r=2; r<A[R_SIZE][OF]; r++) A[r][0] = 0.;
for(c=1; c<A[C_SIZE][OF]; c++) A[0][c] = 0.;
Ligne 159 :
/* ------------------------------ */
double **i_mZ(
int r,
int c
)
{
double **A;
int ar;
int ac;
int i;
 
if(r<R1||c<C1)
Ligne 230 :
for(i=1; i<ar; i++) A[i] = A[0]+i*ac;
 
/* Pour un tableau de 6 colonnes et 4 lignes.
 
A
Ligne 239 :
123456 123456 123456 123456 123456
A[0] A[1] A[2] A[3]
*/
 
 
/* On copie la taille de la matrice dans la matrice. */
A[R_SIZE][OF] = ar;/* A[R_SIZE][OF] = A[0][0] */
A[C_SIZE][OF] = ac;/* A[C_SIZE][OF] = A[1][0] */
 
/* On met zéro dans la ligne zéro et dans la colonne zéro. */
for(r=2; r<A[R_SIZE][OF]; r++) A[r][0] = 0.;
for(c=1; c<A[C_SIZE][OF]; c++) A[0][c] = 0.;
Ligne 256 :
Important :
 
* Vous n'estn’est pas obliger de comprendre ce code pour utiliser les matrices.
* Dans la librairie je mets à zéro tous les éléments de la matrice avec la fonction m_0_mZ(A);