473,473 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Compile-time matrix dimension checking and template friend question

Hi all,

I am writing a template matrix class in which the template parameters are
the number of rows and number of columns. There are a number of reasons
why this is an appropriate tradeoff for my particular application. One of the
advantages is that the _compiler_ can force inner matrix dimensions used in
multiplication to agree. A _complie-time_ error will be triggered if you
write A * B and the number of coluns in A does not equal the number of
rows in B. Here's simplified code that illustrates the concept:

template<int nRows, int nCols> class Matrix {
public:
double data[nRows][nCols];

// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Note that while this code works under all g++ versions I tested, from
g++-2.7 through g++-3.2, it causes an internal compiler error in MSVC++
6.

The problem with this code is that the data field must be public. Otherwise,
Matrix<4,3>::operator* will not have access to Matrix<4,1>'s or
Matrix<3,1>'s data. Thus, I would like to make Matrix<4,1> and
Matrix<3,1> friends of Matrix<4,3>. Is this possible? If so, what's the
syntax? I tried the code below and some other variations, but they were
all incorrect. The code below generated "partial specialization
`Matrix<nRows, nNewCols>' declared `friend'" and "partial specialization
`Matrix<nCols, nNewCols>' declared `friend'" errors under g++-3.0.4 and
did not give Matrix<4,3> access to the private data of Matrix<4,1> or
of Matrix<3,1>.

template<int nRows, int nCols> class Matrix {
private:
double data[nRows][nCols];

public:
// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}

template<int nNewCols> friend class Matrix<nRows,nNewCols>;
template<int nNewCols> friend class Matrix<nCols,nNewCols>;
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Can this be done and if so, how? Thanks for any help,

Ben :-)
Jul 22 '05 #1
6 3294

"Ben Ingram" <bt************@catgufu.mit.edu> wrote in message
news:a9******************************@news.sonicne ws.com...
Hi all,

I am writing a template matrix class in which the template parameters are
the number of rows and number of columns. There are a number of reasons
why this is an appropriate tradeoff for my particular application. One of the advantages is that the _compiler_ can force inner matrix dimensions used in multiplication to agree. A _complie-time_ error will be triggered if you
write A * B and the number of coluns in A does not equal the number of
rows in B. Here's simplified code that illustrates the concept:

template<int nRows, int nCols> class Matrix {
public:
double data[nRows][nCols];

// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Note that while this code works under all g++ versions I tested, from
g++-2.7 through g++-3.2, it causes an internal compiler error in MSVC++
6.

The problem with this code is that the data field must be public. Otherwise,
[SNIP]

Having the data field public is not really a good idea and it is not
necessary. I'd recommend to implement the data access via the operator()
like the following for example:

inline double& operator()( unsigned int Row, unsigned int Col ) {
assert( Row < MaxRow && Col < MaxCol ); // you
can store the dimensions at the time of construction!
return data[Row][Col];
}

inline double operator()( int Row, int Col ) const {
assert( Row < MaxRow && Col < MaxCol );
return data[Row][Col];
}

Therefore you can simply write A(3, 5) to access the respective matrix
element. Furthermore the physical way of data management is hidden, because
you might consider to use a 1D array for speed purposes or whatever reason.
However, the problem you're facing with VC++ 6.0 seems to be related to its
shortcomings regarding templates & partial specialization. I think that
using a later version should resolve your problem.

For an easy sample matrix implementation look at:

http://www.parashift.com/c++-faq-lit...html#faq-16.17

Can this be done and if so, how? Thanks for any help,

Ben :-)


HTH
Chris
Jul 22 '05 #2
On Thu, 29 Jan 2004 01:35:22 -0800, Chris Theis wrote:
"Ben Ingram" <bt************@catgufu.mit.edu> wrote in message
news:a9******************************@news.sonicne ws.com...
Hi all,

I am writing a template matrix class in which the template parameters
are the number of rows and number of columns. There are a number of
reasons why this is an appropriate tradeoff for my particular
application. One of

the
advantages is that the _compiler_ can force inner matrix dimensions
used

in
multiplication to agree. A _complie-time_ error will be triggered if
you write A * B and the number of coluns in A does not equal the number
of rows in B. Here's simplified code that illustrates the concept:

template<int nRows, int nCols> class Matrix { public:
double data[nRows][nCols];

// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&) //
since inner dimensions don't agree

return 0;
}
}
Note that while this code works under all g++ versions I tested, from
g++-2.7 through g++-3.2, it causes an internal compiler error in MSVC++
6.

The problem with this code is that the data field must be public.

Otherwise,
[SNIP]

Having the data field public is not really a good idea and it is not
necessary. I'd recommend to implement the data access via the operator()
like the following for example:

inline double& operator()( unsigned int Row, unsigned int Col ) {
assert( Row < MaxRow && Col < MaxCol ); //
you
can store the dimensions at the time of construction!
return data[Row][Col];
}
}
inline double operator()( int Row, int Col ) const {
assert( Row < MaxRow && Col < MaxCol ); return data[Row][Col];
}
}
Therefore you can simply write A(3, 5) to access the respective matrix
element. Furthermore the physical way of data management is hidden,
because you might consider to use a 1D array for speed purposes or
whatever reason. However, the problem you're facing with VC++ 6.0 seems
to be related to its shortcomings regarding templates & partial
specialization. I think that using a later version should resolve your
problem.

For an easy sample matrix implementation look at:

http://www.parashift.com/c++-faq-lit...html#faq-16.17

Can this be done and if so, how? Thanks for any help,

Ben :-)


HTH
Chris


Thank you for your suggestion, Chris, but if I can figure out the friend
issue, the template strategy has several advantages. As I mentioned in my
first post, dimensions can be checked at compile-time, not at run-time.
This is true for all operations - addition, subtraction, inversion, etc. -
not just multiplication. Compile-time dimension checking is a boon for me
because the library will be used in an airborne real-time system where
run-time failure is not an option. The template solution I proposed also
makes it easier for the compiler to optimize out bounds-checks that are
gaurantee to pass (like your A(3,5) example) and to perform the named
return value optimizations. Templates also facilitate a custom new() and
delete() strategy that improves the speed of the filter the library is
used for by a factor of 3 by avoiding the creation and deletion of
temporary objects. I know that one can avoid unnecessary creation and
deletion using expression templates, but it seems to me that expression
templates require O(n^4) operations to evaluate A * B * C instead of the
O(n^3) operations that are necessary.

What I'm most curious about isn't whether the template solution is the
best one for my needs, it's how can I use the template solution and keep
the data private at the same time. The template solution may not be the
best one, but I'm still curious if and how this kind of templated friendship
works.

Ben :-)
Jul 22 '05 #3
Ben Ingram wrote:
Hi all,

I am writing a template matrix class in which the template parameters are
the number of rows and number of columns. There are a number of reasons
why this is an appropriate tradeoff for my particular application. One of the
advantages is that the _compiler_ can force inner matrix dimensions used in
multiplication to agree. A _complie-time_ error will be triggered if you
write A * B and the number of coluns in A does not equal the number of
rows in B. Here's simplified code that illustrates the concept:

template<int nRows, int nCols> class Matrix {
public:
double data[nRows][nCols];

// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Note that while this code works under all g++ versions I tested, from
g++-2.7 through g++-3.2, it causes an internal compiler error in MSVC++
6.

The problem with this code is that the data field must be public. Otherwise,
Matrix<4,3>::operator* will not have access to Matrix<4,1>'s or
Matrix<3,1>'s data. Thus, I would like to make Matrix<4,1> and
Matrix<3,1> friends of Matrix<4,3>. Is this possible? If so, what's the
syntax? I tried the code below and some other variations, but they were
all incorrect. The code below generated "partial specialization
`Matrix<nRows, nNewCols>' declared `friend'" and "partial specialization
`Matrix<nCols, nNewCols>' declared `friend'" errors under g++-3.0.4 and
did not give Matrix<4,3> access to the private data of Matrix<4,1> or
of Matrix<3,1>.

template<int nRows, int nCols> class Matrix {
private:
double data[nRows][nCols];

public:
// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}

template<int nNewCols> friend class Matrix<nRows,nNewCols>;
template<int nNewCols> friend class Matrix<nCols,nNewCols>;
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Can this be done and if so, how? Thanks for any help,

Ben :-)

I'd make the multiply operator a friend, rather than an internal function:

template<int Rows, int Cols>
class Matrix {
friend template <int R, int C, int N>
Matrix<R,N> operator*(const Matrix<R,C>&, const Matrix<C, N>&);

};

template <int R, int C, int N>
Matrix<R,N> operator*(const Matrix<R,C>&, const Matrix<C, N>&);
Jul 22 '05 #4

"Ben Ingram" <bt************@catgufu.mit.edu> wrote in message
news:44******************************@news.sonicne ws.com...
[SNIP]
What I'm most curious about isn't whether the template solution is the
best one for my needs, it's how can I use the template solution and keep
the data private at the same time. The template solution may not be the
best one, but I'm still curious if and how this kind of templated friendship works.

Ben :-)


Well, to keep the data private without having to use friend declarations,
just use the operator() for access. The advantages of this are also covered
in the FAQ. However, to compile your class with VC++ you might have to
resort to version 7.X as there are many unresolved issures regarding partial
specialization with VC++ 6.0

Cheers
Chris
Jul 22 '05 #5
On Thu, 29 Jan 2004 08:59:42 -0800, red floyd wrote:
Ben Ingram wrote:
Hi all,

I am writing a template matrix class in which the template parameters
are the number of rows and number of columns. There are a number of
reasons why this is an appropriate tradeoff for my particular
application. One of the advantages is that the _compiler_ can force
inner matrix dimensions used in multiplication to agree. A
_complie-time_ error will be triggered if you write A * B and the
number of coluns in A does not equal the number of rows in B. Here's
simplified code that illustrates the concept:

template<int nRows, int nCols> class Matrix { public:
double data[nRows][nCols];

// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&) //
since inner dimensions don't agree

return 0;
}
}
Note that while this code works under all g++ versions I tested, from
g++-2.7 through g++-3.2, it causes an internal compiler error in MSVC++
6.

The problem with this code is that the data field must be public.
Otherwise, Matrix<4,3>::operator* will not have access to Matrix<4,1>'s
or Matrix<3,1>'s data. Thus, I would like to make Matrix<4,1> and
Matrix<3,1> friends of Matrix<4,3>. Is this possible? If so, what's the
syntax? I tried the code below and some other variations, but they were
all incorrect. The code below generated "partial specialization
`Matrix<nRows, nNewCols>' declared `friend'" and "partial
specialization `Matrix<nCols, nNewCols>' declared `friend'" errors
under g++-3.0.4 and did not give Matrix<4,3> access to the private data
of Matrix<4,1> or of Matrix<3,1>.

template<int nRows, int nCols> class Matrix { private:
double data[nRows][nCols];

public:
// operator*: return this * A
template<int nNewCols> Matrix<nRows,nNewCols>
operator*(const Matrix<nCols,nNewCols> &A) const {
Matrix<nRows,nNewCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nNewCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nCols; iInner++) {
innerProd += data[iRow][iInner] * A.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}
}
template<int nNewCols> friend class Matrix<nRows,nNewCols>;
template<int nNewCols> friend class Matrix<nCols,nNewCols>;
};

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&) //
since inner dimensions don't agree

return 0;
}
}
Can this be done and if so, how? Thanks for any help,

Ben :-)

I'd make the multiply operator a friend, rather than an internal
function:

template<int Rows, int Cols>
class Matrix {
friend template <int R, int C, int N>
Matrix<R,N> operator*(const Matrix<R,C>&, const Matrix<C, N>&);

};

template <int R, int C, int N>
Matrix<R,N> operator*(const Matrix<R,C>&, const Matrix<C, N>&);

Perfect!!! Almost. friend should come after, not before template<...>.
Thanks so much for the help!!! Below is the modified code:

template<int nRows, int nCols> class Matrix {
private:
double data[nRows][nCols];

public:
// operator*: return this * A
template<int multRows, int multInner, int multCols>
friend Matrix<multRows,multCols> operator*(
const Matrix<multRows,multInner> &,
const Matrix<multInner,multCols> &);
};

template <int nRows, int nInner, int nCols>
Matrix<nRows,nCols> operator*(const Matrix<nRows,nInner> &A,
const Matrix<nInner,nCols> &B) {
Matrix<nRows,nCols> ret;
for(int iRow = 0; iRow < nRows; iRow++) {
for(int iCol = 0; iCol < nCols; iCol++) {
double innerProd = 0.0;
for(int iInner = 0; iInner < nInner; iInner++) {
innerProd += A.data[iRow][iInner] * B.data[iInner][iCol];
}
ret.data[iRow][iCol] = innerProd;
}
}
return ret;
}

int main(int argc, char **argv) {
Matrix<4,3> A;
Matrix<3,1> x;
Matrix<2,1> y;

A*x; // compiler creates
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<3,1>&)
//A*y; // compile-time error thrown since compiler can't create
// Matrix<4,1> Matrix<4,3>::operator*(const Matrix<2,1>&)
// since inner dimensions don't agree

return 0;
}

Ben :-)
Jul 22 '05 #6
Ben Ingram wrote:
[Redacted for space]

Perfect!!! Almost. friend should come after, not before template<...>.
Thanks so much for the help!!! Below is the modified code:

[Redacted for space]


Glad I could help, Ben! To be honest, I've never tried playing with
friend templates, so I'm amazed that that I got the syntax as close as I
did.

red floyd
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: janeaustine50 | last post by:
Python's InteractiveInterpreter uses the built-in compile function. According to the ref. manual, it doesn't seem to concern about the encoding of the source string. When I hand in an unicode...
1
by: Mario T. Lanza | last post by:
I am working with Visual Studio. The solution I am developing is composed of about 8 separate projects. Some of these projects represent different tiers in the N-tiered architecture (data,...
2
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
10
by: Chris LaJoie | last post by:
Our company has been developing a program in C# for some time now, and we haven't had any problems with it, but just last night something cropped up that has me, and everyone else, stumped. I...
3
by: Peter | last post by:
Hi, I am trying to compile an existing project (originally c) in .NET (rename .c files to .cpp). After fixing some problems, here are the ones that I don't know how to deal with:...
6
by: Thomas Connolly | last post by:
I have 2 pages referencing the same codebehind file in my project. Originally the pages referenced separate code behind files. Once I changed the reference to the same file, everything worked...
7
by: Arne | last post by:
I am porting a website to ASP.net 2.0. Temporarily I compile with Visual Studio 2003 and deploying to ASP.net 2.0. How do I compile my website under ASP.Net 2.0? I know it can compile each page as...
3
by: NvrBst | last post by:
Right now I have C99 code in .c extensions. I compile it in VSC++ and it complains about a lot of errors. I change the extensions to .cpp and compile in VSC++ and it succeeds. Is there a way...
2
by: Andrus | last post by:
I need compile in-memory assembly which references to other in-memory assembly. Compiling second assembly fails with error Line: 0 - Metadata file 'eed7li9m, Version=0.0.0.0, Culture=neutral,...
6
by: Ed Leafe | last post by:
I've noticed an odd behavior with compile() and code that does not contain a trailing newline: if the last line is a comment inside of any block, a syntax error is thrown, but if the last line is a...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.