1 Replies - 862 Views - Last Post: 13 October 2009 - 01:47 PM Rate Topic: -----

#1 Lip  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 12-October 09

error C3861 for existing head files

Posted 12 October 2009 - 01:18 AM

Dear all professionals,

I got really dont understand why the compiler keep saying that some of the functions are not identified.
My situation is, I am using others supplementry source files for my coding. These files are mainly for matrix operations like finding inverse and solve linear systems. Yet I included the header files but the compiler keep saying there does not exist the identifier of the functions. What is wrong with the code.?
#include <windows.h>		// Header File For Windows
#include <windowsx.h>
#include <gl\gl.h>			// Header File For The OpenGL32 Library
#include <gl\glu.h>			// Header File For The GLu32 Library
#include <gl\glut.h>
#include <gl\glaux.h>		// Header File For The Glaux Library
#include <cmath>
#include <mpfr.h>
#include <gmp.h>
#include <lu.h>
#include <inv.h>
#include <rsolve.h>


......................


This is one of the Headers code
#ifndef _inv_h
#define _inv_h

#include "ap.h"
#include "amp.h"
#include "lu.h"
#include "trinverse.h"
namespace inv
{
	template<unsigned int Precision>
	bool rmatrixluinverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		const ap::template_1d_array< int >& pivots,
		int n);
	template<unsigned int Precision>
	bool rmatrixinverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		int n);
	template<unsigned int Precision>
	bool inverselu(ap::template_2d_array< amp::ampf<Precision> >& a,
		const ap::template_1d_array< int >& pivots,
		int n);
	template<unsigned int Precision>
	bool inverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		int n);


	/*************************************************************************
	Inversion of a matrix given by its LU decomposition.

	Input parameters:
		A	   -   LU decomposition of the matrix (output of RMatrixLU subroutine).
		Pivots  -   table of permutations which were made during the LU decomposition
					(the output of RMatrixLU subroutine).
		N	   -   size of matrix A.

	Output parameters:
		A	   -   inverse of matrix A.
					Array whose indexes range within [0..N-1, 0..N-1].

	Result:
		True, if the matrix is not singular.
		False, if the matrix is singular.

	  -- LAPACK routine (version 3.0) --
		 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
		 Courant Institute, Argonne National Lab, and Rice University
		 February 29, 1992
	*************************************************************************/
	template<unsigned int Precision>
	bool rmatrixluinverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		const ap::template_1d_array< int >& pivots,
		int n)
	{
		bool result;
		ap::template_1d_array< amp::ampf<Precision> > work;
		int i;
		int iws;
		int j;
		int jb;
		int jj;
		int jp;
		amp::ampf<Precision> v;


		result = true;
		
		//
		// Quick return if possible
		//
		if( n==0 )
		{
			return result;
		}
		work.setbounds(0, n-1);
		
		//
		// Form inv(U)
		//
		if( !trinverse::rmatrixtrinverse<Precision>(a, n, true, false) )
		{
			result = false;
			return result;
		}
		
		//
		// Solve the equation inv(A)*L = inv(U) for inv(A).
		//
		for(j=n-1; j>=0; j--)
		{
			
			//
			// Copy current column of L to WORK and replace with zeros.
			//
			for(i=j+1; i<=n-1; i++)
			{
				work(i) = a(i,j);
				a(i,j) = 0;
			}
			
			//
			// Compute current column of inv(A).
			//
			if( j<n-1 )
			{
				for(i=0; i<=n-1; i++)
				{
					v = amp::vdotproduct(a.getrow(i, j+1, n-1), work.getvector(j+1, n-1));
					a(i,j) = a(i,j)-v;
				}
			}
		}
		
		//
		// Apply column interchanges.
		//
		for(j=n-2; j>=0; j--)
		{
			jp = pivots(j);
			if( jp!=j )
			{
				amp::vmove(work.getvector(0, n-1), a.getcolumn(j, 0, n-1));
				amp::vmove(a.getcolumn(j, 0, n-1), a.getcolumn(jp, 0, n-1));
				amp::vmove(a.getcolumn(jp, 0, n-1), work.getvector(0, n-1));
			}
		}
		return result;
	}


	/*************************************************************************
	Inversion of a general matrix.

	Input parameters:
		A   -   matrix. Array whose indexes range within [0..N-1, 0..N-1].
		N   -   size of matrix A.

	Output parameters:
		A   -   inverse of matrix A.
				Array whose indexes range within [0..N-1, 0..N-1].

	Result:
		True, if the matrix is not singular.
		False, if the matrix is singular.

	  -- ALGLIB --
		 Copyright 2005 by Bochkanov Sergey
	*************************************************************************/
	template<unsigned int Precision>
	bool rmatrixinverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		int n)
	{
		bool result;
		ap::template_1d_array< int > pivots;


		lu::rmatrixlu<Precision>(a, n, n, pivots);
		result = rmatrixluinverse<Precision>(a, pivots, n);
		return result;
	}


	/*************************************************************************
	Obsolete 1-based subroutine.

	See RMatrixLUInverse for 0-based replacement.
	*************************************************************************/
	template<unsigned int Precision>
	bool inverselu(ap::template_2d_array< amp::ampf<Precision> >& a,
		const ap::template_1d_array< int >& pivots,
		int n)
	{
		bool result;
		ap::template_1d_array< amp::ampf<Precision> > work;
		int i;
		int iws;
		int j;
		int jb;
		int jj;
		int jp;
		int jp1;
		amp::ampf<Precision> v;


		result = true;
		
		//
		// Quick return if possible
		//
		if( n==0 )
		{
			return result;
		}
		work.setbounds(1, n);
		
		//
		// Form inv(U)
		//
		if( !trinverse::invtriangular<Precision>(a, n, true, false) )
		{
			result = false;
			return result;
		}
		
		//
		// Solve the equation inv(A)*L = inv(U) for inv(A).
		//
		for(j=n; j>=1; j--)
		{
			
			//
			// Copy current column of L to WORK and replace with zeros.
			//
			for(i=j+1; i<=n; i++)
			{
				work(i) = a(i,j);
				a(i,j) = 0;
			}
			
			//
			// Compute current column of inv(A).
			//
			if( j<n )
			{
				jp1 = j+1;
				for(i=1; i<=n; i++)
				{
					v = amp::vdotproduct(a.getrow(i, jp1, n), work.getvector(jp1, n));
					a(i,j) = a(i,j)-v;
				}
			}
		}
		
		//
		// Apply column interchanges.
		//
		for(j=n-1; j>=1; j--)
		{
			jp = pivots(j);
			if( jp!=j )
			{
				amp::vmove(work.getvector(1, n), a.getcolumn(j, 1, n));
				amp::vmove(a.getcolumn(j, 1, n), a.getcolumn(jp, 1, n));
				amp::vmove(a.getcolumn(jp, 1, n), work.getvector(1, n));
			}
		}
		return result;
	}


	/*************************************************************************
	Obsolete 1-based subroutine.

	See RMatrixInverse for 0-based replacement.
	*************************************************************************/
	template<unsigned int Precision>
	bool inverse(ap::template_2d_array< amp::ampf<Precision> >& a,
		int n)
	{
		bool result;
		ap::template_1d_array< int > pivots;


		lu::ludecomposition<Precision>(a, n, n, pivots);
		result = inverselu<Precision>(a, pivots, n);
		return result;
	}
} // namespace

#endif

Attached image(s)

  • Attached Image

This post has been edited by Lip: 12 October 2009 - 01:25 AM


Is This A Good Question/Topic? 0
  • +

Replies To: error C3861 for existing head files

#2 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 291
  • View blog
  • Posts: 1,900
  • Joined: 25-October 06

Re: error C3861 for existing head files

Posted 13 October 2009 - 01:47 PM

the functions in
#include <inv.h>


are in namespace inv

do you have the statement to include the namespace
using namespace inv;


or explicitly specify that functions you call are in inv using the :: scope resolution operator
	inv::rmatrixluinverse( ....


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1