add license info on a few things

This commit is contained in:
Timothee 'TTimo' Besset 2012-06-04 23:42:31 -05:00
parent f99c697a57
commit 61a03e2ee7
24 changed files with 333 additions and 349 deletions

View file

@ -1,3 +1,21 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "StdAfx.h" #include "StdAfx.h"
#include "ScriptParser.h" #include "ScriptParser.h"

View file

@ -1,3 +1,21 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _SCRIPTPARSER_H_ #ifndef _SCRIPTPARSER_H_
#define _SCRIPTPARSER_H_ #define _SCRIPTPARSER_H_

View file

@ -1,3 +1,22 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "StdAfx.h" #include "StdAfx.h"
#include "./dialogs/dialogs-gtk.h" #include "./dialogs/dialogs-gtk.h"
#include "bsploader.h" #include "bsploader.h"

View file

@ -1,3 +1,22 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define LUMP_ENTITIES 0 #define LUMP_ENTITIES 0
#define LUMP_SHADERS 1 #define LUMP_SHADERS 1
#define LUMP_PLANES 2 #define LUMP_PLANES 2

View file

@ -1,3 +1,21 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _ISCRIPTPARSER_H_ #ifndef _ISCRIPTPARSER_H_
#define _ISCRIPTPARSER_H_ #define _ISCRIPTPARSER_H_

View file

@ -1 +1,19 @@
/*
BobToolz plugin for GtkRadiant
Copyright (C) 2001 Gordon Biggans
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
list<DWinding*> *BuildTrace( char* filename, vec3_t v_origin ); list<DWinding*> *BuildTrace( char* filename, vec3_t v_origin );

View file

@ -1,2 +1,2 @@
// generated header, see makeversion.py // generated header, see makeversion.py
#define RADIANT_ABOUTMSG "Experimental Build - Official" #define RADIANT_ABOUTMSG "http://icculus.org/GtkRadiant/"

View file

@ -1,3 +1,24 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __BYTEBOOL__ #ifndef __BYTEBOOL__
#define __BYTEBOOL__ #define __BYTEBOOL__

View file

@ -1,108 +0,0 @@
#ifndef __APPLE__
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#include <limits.h>
#include <float.h>
#include "mathlib.h"
#define TINY FLT_MIN
void lubksb( float **a, int n, int *indx, float b[] ){
// Solves the set of n linear equations A.X=B. Here a[n][n] is input, not as the matrix
// A but rather as its LU decomposition determined by the routine ludcmp. indx[n] is input
// as the permutation vector returned by ludcmp. b[n] is input as the right-hand side vector
// B, and returns with the solution vector X. a, n and indx are not modified by this routine
// and can be left in place for successive calls with different right-hand sides b. This routine takes
// into account the possibility that b will begin with many zero elements, so it is efficient for use
// in matrix inversion
int i,ii = -1,ip,j;
float sum;
for ( i = 0; i < n; i++ ) {
ip = indx[i];
sum = b[ip];
b[ip] = b[i];
if ( ii >= 0 ) {
for ( j = ii; j < i; j++ ) sum -= a[i][j] * b[j];
}
else if ( sum ) {
ii = i;
}
b[i] = sum;
}
for ( i = n - 1; i >= 0; i-- ) {
sum = b[i];
for ( j = i + 1; j < n; j++ ) sum -= a[i][j] * b[j];
b[i] = sum / a[i][i];
}
}
/* (C) Copr. 1986-92 Numerical Recipes Software */
int ludcmp( float **a, int n, int *indx, float *d ){
// given a matrix a[n][n] this routine replaces it with the LU decomposition of a rowwise
// permutation of itself. a and n are input. a is output, arranged as in above equation;
// indx[n] is an output vector that records the row permutation effected by the partial
// pivoting; d is output as +/-1 depending on whether the number of row interchanges was even
// or odd, respectively. This routine is used in combination with lubksb to solve linear
// equations or invert a matrix.
int i,imax,j,k;
float big,dum,sum,temp;
float *vv;
imax = 0;
vv = (float*)malloc( sizeof( float ) * n );
*d = 1.0;
for ( i = 0; i < n; i++ ) {
big = 0.0;
for ( j = 0; j < n; j++ )
if ( ( temp = (float)fabs( a[i][j] ) ) > big ) {
big = temp;
}
if ( big == 0.0 ) {
return 1;
}
vv[i] = 1.0f / big;
}
for ( j = 0; j < n; j++ ) {
for ( i = 0; i < j; i++ ) {
sum = a[i][j];
for ( k = 0; k < i; k++ ) sum -= a[i][k] * a[k][j];
a[i][j] = sum;
}
big = 0.0;
for ( i = j; i < n; i++ ) {
sum = a[i][j];
for ( k = 0; k < j; k++ )
sum -= a[i][k] * a[k][j];
a[i][j] = sum;
if ( ( dum = vv[i] * (float)fabs( sum ) ) >= big ) {
big = dum;
imax = i;
}
}
if ( j != imax ) {
for ( k = 0; k < n; k++ ) {
dum = a[imax][k];
a[imax][k] = a[j][k];
a[j][k] = dum;
}
*d = -( *d );
vv[imax] = vv[j];
}
indx[j] = imax;
if ( a[j][j] == 0.0 ) {
a[j][j] = TINY;
}
if ( j != n ) {
dum = 1.0f / ( a[j][j] );
for ( i = j + 1; i < n; i++ ) a[i][j] *= dum;
}
}
free( vv );
return 0;
}
/* (C) Copr. 1986-92 Numerical Recipes Software */

View file

@ -146,10 +146,6 @@
RelativePath=".\bbox.c" RelativePath=".\bbox.c"
> >
</File> </File>
<File
RelativePath=".\linear.c"
>
</File>
<File <File
RelativePath=".\m4x4.c" RelativePath=".\m4x4.c"
> >

View file

@ -1,3 +1,24 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __SPLINES_H #ifndef __SPLINES_H
#define __SPLINES_H #define __SPLINES_H

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "plugin.h" #include "plugin.h"
#include "entity.h" #include "entity.h"

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "plugin.h" #include "plugin.h"
// ============================================================================= // =============================================================================

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _PLUGIN_H_ #ifndef _PLUGIN_H_
#define _PLUGIN_H_ #define _PLUGIN_H_

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// //
// parses xml tree format into internal objects // parses xml tree format into internal objects
// //

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// //
// writes xml tree format from internal objects // writes xml tree format from internal objects
// //

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "cpicomodel.h" #include "cpicomodel.h"
#include "qertypes.h" #include "qertypes.h"

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _WAD3_H_ #ifndef _WAD3_H_
#define _WAD3_H_ #define _WAD3_H_

View file

@ -1,3 +1,23 @@
/*
Copyright (C) 1999-2007 id Software, Inc. and contributors.
For a list of contributors, see the accompanying CONTRIBUTORS file.
This file is part of GtkRadiant.
GtkRadiant is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GtkRadiant is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GtkRadiant; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _SURFACEPLUGIN_H #ifndef _SURFACEPLUGIN_H
#define _SURFACEPLUGIN_H #define _SURFACEPLUGIN_H

View file

@ -1,214 +0,0 @@
#include <stdlib.h>
#include <limits.h>
#include <float.h>
#include "mathlib.h"
#define TINY FLT_MIN
void lubksb( float **a, int n, int *indx, float b[] ){
// Solves the set of n linear equations A.X=B. Here a[n][n] is input, not as the matrix
// A but rather as its LU decomposition determined by the routine ludcmp. indx[n] is input
// as the permutation vector returned by ludcmp. b[n] is input as the right-hand side vector
// B, and returns with the solution vector X. a, n and indx are not modified by this routine
// and can be left in place for successive calls with different right-hand sides b. This routine takes
// into account the possibility that b will begin with many zero elements, so it is efficient for use
// in matrix inversion
int i,ii = -1,ip,j;
float sum;
for ( i = 0; i < n; i++ ) {
ip = indx[i];
sum = b[ip];
b[ip] = b[i];
if ( ii >= 0 ) {
for ( j = ii; j < i; j++ ) sum -= a[i][j] * b[j];
}
else if ( sum ) {
ii = i;
}
b[i] = sum;
}
for ( i = n - 1; i >= 0; i-- ) {
sum = b[i];
for ( j = i + 1; j < n; j++ ) sum -= a[i][j] * b[j];
b[i] = sum / a[i][i];
}
}
/* (C) Copr. 1986-92 Numerical Recipes Software */
int ludcmp( float **a, int n, int *indx, float *d ){
// given a matrix a[n][n] this routine replaces it with the LU decomposition of a rowwise
// permutation of itself. a and n are input. a is output, arranged as in above equation;
// indx[n] is an output vector that records the row permutation effected by the partial
// pivoting; d is output as +/-1 depending on whether the number of row interchanges was even
// or odd, respectively. This routine is used in combination with lubksb to solve linear
// equations or invert a matrix.
int i,imax,j,k;
float big,dum,sum,temp;
float *vv;
vv = (float*)malloc( sizeof( float ) * n );
*d = 1.0;
for ( i = 0; i < n; i++ ) {
big = 0.0;
for ( j = 0; j < n; j++ )
if ( ( temp = (float)fabs( a[i][j] ) ) > big ) {
big = temp;
}
if ( big == 0.0 ) {
return 1;
}
vv[i] = 1.0f / big;
}
for ( j = 0; j < n; j++ ) {
for ( i = 0; i < j; i++ ) {
sum = a[i][j];
for ( k = 0; k < i; k++ ) sum -= a[i][k] * a[k][j];
a[i][j] = sum;
}
big = 0.0;
for ( i = j; i < n; i++ ) {
sum = a[i][j];
for ( k = 0; k < j; k++ )
sum -= a[i][k] * a[k][j];
a[i][j] = sum;
if ( ( dum = vv[i] * (float)fabs( sum ) ) >= big ) {
big = dum;
imax = i;
}
}
if ( j != imax ) {
for ( k = 0; k < n; k++ ) {
dum = a[imax][k];
a[imax][k] = a[j][k];
a[j][k] = dum;
}
*d = -( *d );
vv[imax] = vv[j];
}
indx[j] = imax;
if ( a[j][j] == 0.0 ) {
a[j][j] = TINY;
}
if ( j != n ) {
dum = 1.0f / ( a[j][j] );
for ( i = j + 1; i < n; i++ ) a[i][j] *= dum;
}
}
free( vv );
return 0;
}
/* (C) Copr. 1986-92 Numerical Recipes Software */
/*
void ludcmp(float **a, int n, int *indx, float *d)
//Given a matrix a[1..n][1..n], this routine replaces it by the LU decomposition of a rowwise
//permutation of itself. a and n are input. a is output, arranged as in equation (2.3.14) above;
//indx[1..n] is an output vector that records the row permutation e ected by the partial
//pivoting; d is output as .1 depending on whether the number of row interchanges was even
//or odd, respectively. This routine is used in combination with lubksb to solve linear equations
//or invert a matrix.
{
int i,imax,j,k;
float big,dum,sum,temp;
float *vv; //vv stores the implicit scaling of each row.
vv=vector(1,n);
*d=1.0; //No row interchanges yet.
for (i=1;i<=n;i++) { //Loop over rows to get the implicit scaling information.
big=0.0;
for (j=1;j<=n;j++)
if ((temp=fabs(a[i][j])) > big) big=temp;
if (big == 0.0) nrerror("Singular matrix in routine ludcmp");
//No nonzero largest element.
vv[i]=1.0/big; //Save the scaling.
}
for (j=1;j<=n;j++) { //This is the loop over columns of Crout's method.
for (i=1;i<j;i++) { //This is equation (2.3.12) except for i = j.
sum=a[i][j];
for (k=1;k<i;k++) sum -= a[i][k]*a[k][j];
a[i][j]=sum;
}
big=0.0; //Initialize for the search for largest pivot element.
for (i=j;i<=n;i++) { //This is i = j of equation (2.3.12) and i = j+1 : ::N
of equation (2.3.13). sum=a[i][j];
for (k=1;k<j;k++)
sum -= a[i][k]*a[k][j];
a[i][j]=sum;
if ( (dum=vv[i]*fabs(sum)) >= big) {
//Is the figure of merit for the pivot better than the best so far?
big=dum;
imax=i;
}
}
if (j != imax) { //Do we need to interchange rows?
for (k=1;k<=n;k++) { Yes, do so...
dum=a[imax][k];
a[imax][k]=a[j][k];
a[j][k]=dum;
}
*d = -(*d); //...and change the parity of d.
vv[imax]=vv[j]; //Also interchange the scale factor.
}
indx[j]=imax;
if (a[j][j] == 0.0) a[j][j]=TINY;
//If the pivot element is zero the matrix is singular (at least to the precision of the
// algorithm). For some applications on singular matrices, it is desirable to substitute
// TINY for zero.
if (j != n) { //Now, finally, divide by the pivot element.
dum=1.0/(a[j][j]);
for (i=j+1;i<=n;i++) a[i][j] *= dum;
}
} //Go back for the next column in the reduction.
free_vector(vv,1,n);
}
void lubksb(float **a, int n, int *indx, float b[])
//Solves the set of n linear equations A.X = B. Here a[1..n][1..n] is input, not as the matrix
//A but rather as its LU decomposition, determined by the routine ludcmp. indx[1..n] is input
//as the permutation vector returned by ludcmp. b[1..n] is input as the right-hand side vector
//B, and returns with the solution vector X. a, n, and indx are not modi ed by this routine
//and can be left in place for successive calls with di erent right-hand sides b. This routine takes
//into account the possibility that b will begin with many zero elements, so it is e.cient for use
//in matrix inversion.
{
int i,ii=0,ip,j;
float sum;
for (i=1;i<=n;i++) { //When ii is set to a positive value, it will become the
//index of the first nonvanishing element of b. Wenow
//do the forward substitution, equation (2.3.6). The
//only new wrinkle is to unscramble the permutation
//as we go.
ip=indx[i];
sum=b[ip];
b[ip]=b[i];
if (ii)
for (j=ii;j<=i-1;j++) sum -= a[i][j]*b[j];
else if (sum) ii=i; //A nonzero element was encountered, so from now on we
//will have to do the sums in the loop above. b[i]=sum;
}
for (i=n;i>=1;i--) { //Now we do the backsubstitution, equation (2.3.7).
sum=b[i];
for (j=i+1;j<=n;j++) sum -= a[i][j]*b[j];
b[i]=sum/a[i][i]; //Store a component of the solution vector X.
} //All done!
}
void bleh()
{
#define N ...
float **a,**y,d,*col;
int i,j,*indx;
...
ludcmp(a,N,indx,&d); //Decompose the matrix just once.
for(j=1;j<=N;j++) { //Find inverse by columns.
for(i=1;i<=N;i++) col[i]=0.0;
col[j]=1.0;
lubksb(a,N,indx,col);
for(i=1;i<=N;i++) y[i][j]=col[i];
}
}
*/

View file

@ -216,28 +216,6 @@
/> />
</FileConfiguration> </FileConfiguration>
</File> </File>
<File
RelativePath="linear.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File <File
RelativePath="m4x4.c" RelativePath="m4x4.c"
> >