Java Reference
In-Depth Information
procedure
()
/
A
,
B
, and
C
are declared as
N
×
N
matrices
main
/
A
=
B
×
C
end
function
×
(
Y
,
Z
)
returns
Matrix
if
Y
.
cols
Z
.
rows
then
1
/
Throw an exception
/
else
for
i
=
1
to
Y
.
rows
do
for
j
=
1
to
Z
.
cols
do
Result
[
i
,
j
]
←
0
for
k
=
1
to
Y
.
cols
do
Result
[
i
,
j
]
←
Result
[
i
,
j
]
+
Y
[
i
,
k
]
×
Z
[
k
,
j
]
return
(
Result
)
end
procedure
=
(
To
,
From
)
if
To
.
cols
From
.
cols
or
To
.
rows
From
.
rows
then
2
/
Throw an exception
/
else
for
i
=
1
to
To
.
rows
do
for
j
=
1
to
To
.
cols
do
To
[
i
,
j
]
←
From
[
i
,
j
]
end
Figure 14.1: Matrix multiplication using overloaded operators.
When compilers were first pioneered, they were considered successful if pro-
gramswritten in a high-level language attainedperformance that rivaled hand-
coded e
orts. By today's standards, the programming languages of those days
may seem primitive. However, the technology that achieved the requisite per-
formance is very impressive—these techniques are still used in compilers for
modern programming languages. The scale of today's software projects would
be impossible without the advent of advanced programming paradigms and
languages. As a result, the goal of hand-coded performance has yielded to the
goal of obtaining a
reasonable
fraction of a target machine's potential speed.
Meanwhile, the trend in
reduced instruction set computer
(RISC) archi-
tectures continues toward relatively low-level instruction sets. Such architec-
tures feature shorter instruction times with correspondingly faster clock rates.
Other developments include
liquid architectures
, whose operations, regis-
ff