MIST (Media Integration Standard Toolkit)
Revision | fffc7c1358cfd8df15355d7c4b4fbc7bff229f4a (tree) |
---|---|
Time | 2003-09-05 21:02:36 |
Author | Daisuke Deguchi <ddeguchi@nago...> |
Commiter | Daisuke Deguchi |
属性を追加
@@ -0,0 +1,16 @@ | ||
1 | +include ./makeinclude | |
2 | + | |
3 | + | |
4 | +DIRS = ../test | |
5 | + | |
6 | +all: makeinclude | |
7 | + for dir in $(DIRS); do\ | |
8 | + echo "=== making $$dir ===";\ | |
9 | + ( cd $$dir; $(MAKE) $(MFLAGS) ) || break;\ | |
10 | + done | |
11 | + | |
12 | +clean: | |
13 | + for dir in $(DIRS); do\ | |
14 | + echo "=== cleaning $$dir ===";\ | |
15 | + ( cd $$dir; $(MAKE) $(MFLAGS) clean ) || break;\ | |
16 | + done | |
\ No newline at end of file |
@@ -0,0 +1,29 @@ | ||
1 | +CC = gcc | |
2 | +CXX = g++ | |
3 | + | |
4 | +INCLUDE = -I../ -I/usr/local/include -I/usr/X11R6/include | |
5 | +LDLIBS = -L../lib -L/usr/local/lib -L/usr/X11R6/lib | |
6 | + | |
7 | +CFLGS = -Wall -O2 | |
8 | +CXXFLGS = -Wall -O2 | |
9 | +IMGLIBS = -ljpeg -lpng -ltiff | |
10 | +LIBS = -lpthread -lz -lXext -lX11 -lm -lGL | |
11 | + | |
12 | + | |
13 | +# Be quiet when building... | |
14 | +.SILENT: | |
15 | + | |
16 | +# Build commands and filename extensions... | |
17 | +.SUFFIXES: .c .cpp .cxx .h .o | |
18 | + | |
19 | +.c.o: | |
20 | + echo Compiling $<... | |
21 | + $(CC) -I.. $(CFLAGS) -c $< | |
22 | + | |
23 | +.cxx.o: | |
24 | + echo Compiling $<... | |
25 | + $(CXX) $(CFLAGS) -c $< $(INCLUDE) | |
26 | + | |
27 | +.cpp.o: | |
28 | + echo Compiling $<... | |
29 | + $(CXX) $(CFLAGS) -c $< $(INCLUDE) | |
\ No newline at end of file |
@@ -0,0 +1,112 @@ | ||
1 | +# Microsoft Developer Studio Project File - Name="matrix_test" - Package Owner=<4> | |
2 | +# Microsoft Developer Studio Generated Build File, Format Version 6.00 | |
3 | +# ** 編集しないでください ** | |
4 | + | |
5 | +# TARGTYPE "Win32 (x86) Console Application" 0x0103 | |
6 | + | |
7 | +CFG=matrix_test - Win32 Debug | |
8 | +!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。 | |
9 | +!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください | |
10 | +!MESSAGE | |
11 | +!MESSAGE NMAKE /f "matrix_test.mak". | |
12 | +!MESSAGE | |
13 | +!MESSAGE NMAKE の実行時に構成を指定できます | |
14 | +!MESSAGE コマンド ライン上でマクロの設定を定義します。例: | |
15 | +!MESSAGE | |
16 | +!MESSAGE NMAKE /f "matrix_test.mak" CFG="matrix_test - Win32 Debug" | |
17 | +!MESSAGE | |
18 | +!MESSAGE 選択可能なビルド モード: | |
19 | +!MESSAGE | |
20 | +!MESSAGE "matrix_test - Win32 Release" ("Win32 (x86) Console Application" 用) | |
21 | +!MESSAGE "matrix_test - Win32 Debug" ("Win32 (x86) Console Application" 用) | |
22 | +!MESSAGE | |
23 | + | |
24 | +# Begin Project | |
25 | +# PROP AllowPerConfigDependencies 0 | |
26 | +# PROP Scc_ProjName "" | |
27 | +# PROP Scc_LocalPath "" | |
28 | +CPP=cl.exe | |
29 | +RSC=rc.exe | |
30 | + | |
31 | +!IF "$(CFG)" == "matrix_test - Win32 Release" | |
32 | + | |
33 | +# PROP BASE Use_MFC 0 | |
34 | +# PROP BASE Use_Debug_Libraries 0 | |
35 | +# PROP BASE Output_Dir "Release" | |
36 | +# PROP BASE Intermediate_Dir "Release" | |
37 | +# PROP BASE Target_Dir "" | |
38 | +# PROP Use_MFC 0 | |
39 | +# PROP Use_Debug_Libraries 0 | |
40 | +# PROP Output_Dir "Release" | |
41 | +# PROP Intermediate_Dir "Release" | |
42 | +# PROP Target_Dir "" | |
43 | +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c | |
44 | +# ADD CPP /nologo /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c | |
45 | +# ADD BASE RSC /l 0x411 /d "NDEBUG" | |
46 | +# ADD RSC /l 0x411 /d "NDEBUG" | |
47 | +BSC32=bscmake.exe | |
48 | +# ADD BASE BSC32 /nologo | |
49 | +# ADD BSC32 /nologo | |
50 | +LINK32=link.exe | |
51 | +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | |
52 | +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 | |
53 | + | |
54 | +!ELSEIF "$(CFG)" == "matrix_test - Win32 Debug" | |
55 | + | |
56 | +# PROP BASE Use_MFC 0 | |
57 | +# PROP BASE Use_Debug_Libraries 1 | |
58 | +# PROP BASE Output_Dir "matrix_test___Win32_Debug" | |
59 | +# PROP BASE Intermediate_Dir "matrix_test___Win32_Debug" | |
60 | +# PROP BASE Target_Dir "" | |
61 | +# PROP Use_MFC 0 | |
62 | +# PROP Use_Debug_Libraries 1 | |
63 | +# PROP Output_Dir "matrix_test___Win32_Debug" | |
64 | +# PROP Intermediate_Dir "matrix_test___Win32_Debug" | |
65 | +# PROP Target_Dir "" | |
66 | +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c | |
67 | +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c | |
68 | +# ADD BASE RSC /l 0x411 /d "_DEBUG" | |
69 | +# ADD RSC /l 0x411 /d "_DEBUG" | |
70 | +BSC32=bscmake.exe | |
71 | +# ADD BASE BSC32 /nologo | |
72 | +# ADD BSC32 /nologo | |
73 | +LINK32=link.exe | |
74 | +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | |
75 | +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept | |
76 | + | |
77 | +!ENDIF | |
78 | + | |
79 | +# Begin Target | |
80 | + | |
81 | +# Name "matrix_test - Win32 Release" | |
82 | +# Name "matrix_test - Win32 Debug" | |
83 | +# Begin Group "Source Files" | |
84 | + | |
85 | +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" | |
86 | +# Begin Source File | |
87 | + | |
88 | +SOURCE=\mist\test\matrix_test.cpp | |
89 | +# End Source File | |
90 | +# End Group | |
91 | +# Begin Group "Header Files" | |
92 | + | |
93 | +# PROP Default_Filter "h;hpp;hxx;hm;inl" | |
94 | +# Begin Source File | |
95 | + | |
96 | +SOURCE=\mist\mist\matrix.h | |
97 | +# End Source File | |
98 | +# Begin Source File | |
99 | + | |
100 | +SOURCE=\mist\mist\matrix_et.h | |
101 | +# End Source File | |
102 | +# Begin Source File | |
103 | + | |
104 | +SOURCE=\mist\mist\mist.h | |
105 | +# End Source File | |
106 | +# End Group | |
107 | +# Begin Group "Resource Files" | |
108 | + | |
109 | +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" | |
110 | +# End Group | |
111 | +# End Target | |
112 | +# End Project |
@@ -0,0 +1,164 @@ | ||
1 | +<?xml version="1.0" encoding="shift_jis"?> | |
2 | +<VisualStudioProject | |
3 | + ProjectType="Visual C++" | |
4 | + Version="7.10" | |
5 | + Name="matrix_test" | |
6 | + ProjectGUID="{5B87E451-7196-400B-9898-D276C6418B72}" | |
7 | + Keyword="Win32Proj"> | |
8 | + <Platforms> | |
9 | + <Platform | |
10 | + Name="Win32"/> | |
11 | + </Platforms> | |
12 | + <Configurations> | |
13 | + <Configuration | |
14 | + Name="Debug|Win32" | |
15 | + OutputDirectory="Debug" | |
16 | + IntermediateDirectory="Debug" | |
17 | + ConfigurationType="1" | |
18 | + CharacterSet="2"> | |
19 | + <Tool | |
20 | + Name="VCCLCompilerTool" | |
21 | + Optimization="0" | |
22 | + AdditionalIncludeDirectories=".." | |
23 | + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | |
24 | + MinimalRebuild="TRUE" | |
25 | + BasicRuntimeChecks="3" | |
26 | + RuntimeLibrary="5" | |
27 | + UsePrecompiledHeader="0" | |
28 | + WarningLevel="3" | |
29 | + Detect64BitPortabilityProblems="TRUE" | |
30 | + DebugInformationFormat="4"/> | |
31 | + <Tool | |
32 | + Name="VCCustomBuildTool"/> | |
33 | + <Tool | |
34 | + Name="VCLinkerTool" | |
35 | + OutputFile="$(OutDir)/matrix_test.exe" | |
36 | + LinkIncremental="2" | |
37 | + GenerateDebugInformation="TRUE" | |
38 | + ProgramDatabaseFile="$(OutDir)/matrix_test.pdb" | |
39 | + SubSystem="1" | |
40 | + TargetMachine="1"/> | |
41 | + <Tool | |
42 | + Name="VCMIDLTool"/> | |
43 | + <Tool | |
44 | + Name="VCPostBuildEventTool"/> | |
45 | + <Tool | |
46 | + Name="VCPreBuildEventTool"/> | |
47 | + <Tool | |
48 | + Name="VCPreLinkEventTool"/> | |
49 | + <Tool | |
50 | + Name="VCResourceCompilerTool"/> | |
51 | + <Tool | |
52 | + Name="VCWebServiceProxyGeneratorTool"/> | |
53 | + <Tool | |
54 | + Name="VCXMLDataGeneratorTool"/> | |
55 | + <Tool | |
56 | + Name="VCWebDeploymentTool"/> | |
57 | + <Tool | |
58 | + Name="VCManagedWrapperGeneratorTool"/> | |
59 | + <Tool | |
60 | + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | |
61 | + </Configuration> | |
62 | + <Configuration | |
63 | + Name="Release|Win32" | |
64 | + OutputDirectory="Release" | |
65 | + IntermediateDirectory="Release" | |
66 | + ConfigurationType="1" | |
67 | + CharacterSet="2"> | |
68 | + <Tool | |
69 | + Name="VCCLCompilerTool" | |
70 | + AdditionalIncludeDirectories=".." | |
71 | + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | |
72 | + RuntimeLibrary="4" | |
73 | + UsePrecompiledHeader="0" | |
74 | + WarningLevel="3" | |
75 | + Detect64BitPortabilityProblems="TRUE" | |
76 | + DebugInformationFormat="3"/> | |
77 | + <Tool | |
78 | + Name="VCCustomBuildTool"/> | |
79 | + <Tool | |
80 | + Name="VCLinkerTool" | |
81 | + OutputFile="$(OutDir)/matrix_test.exe" | |
82 | + LinkIncremental="1" | |
83 | + GenerateDebugInformation="TRUE" | |
84 | + SubSystem="1" | |
85 | + OptimizeReferences="2" | |
86 | + EnableCOMDATFolding="2" | |
87 | + TargetMachine="1"/> | |
88 | + <Tool | |
89 | + Name="VCMIDLTool"/> | |
90 | + <Tool | |
91 | + Name="VCPostBuildEventTool"/> | |
92 | + <Tool | |
93 | + Name="VCPreBuildEventTool"/> | |
94 | + <Tool | |
95 | + Name="VCPreLinkEventTool"/> | |
96 | + <Tool | |
97 | + Name="VCResourceCompilerTool"/> | |
98 | + <Tool | |
99 | + Name="VCWebServiceProxyGeneratorTool"/> | |
100 | + <Tool | |
101 | + Name="VCXMLDataGeneratorTool"/> | |
102 | + <Tool | |
103 | + Name="VCWebDeploymentTool"/> | |
104 | + <Tool | |
105 | + Name="VCManagedWrapperGeneratorTool"/> | |
106 | + <Tool | |
107 | + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> | |
108 | + </Configuration> | |
109 | + </Configurations> | |
110 | + <References> | |
111 | + </References> | |
112 | + <Files> | |
113 | + <Filter | |
114 | + Name="ソース ファイル" | |
115 | + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" | |
116 | + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> | |
117 | + <File | |
118 | + RelativePath="..\test\matrix_test.cpp"> | |
119 | + </File> | |
120 | + </Filter> | |
121 | + <Filter | |
122 | + Name="ヘッダー ファイル" | |
123 | + Filter="h;hpp;hxx;hm;inl;inc;xsd" | |
124 | + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"> | |
125 | + <File | |
126 | + RelativePath="..\mist\matrix.h"> | |
127 | + </File> | |
128 | + <File | |
129 | + RelativePath="..\mist\matrix_et.h"> | |
130 | + </File> | |
131 | + <File | |
132 | + RelativePath="..\mist\mist.h"> | |
133 | + </File> | |
134 | + <File | |
135 | + RelativePath="..\mist\config\mist_alloc.h"> | |
136 | + </File> | |
137 | + <File | |
138 | + RelativePath="..\mist\config\mist_conf.h"> | |
139 | + </File> | |
140 | + <File | |
141 | + RelativePath="..\mist\operator\operator_array.h"> | |
142 | + </File> | |
143 | + <File | |
144 | + RelativePath="..\mist\operator\operator_array1.h"> | |
145 | + </File> | |
146 | + <File | |
147 | + RelativePath="..\mist\operator\operator_array2.h"> | |
148 | + </File> | |
149 | + <File | |
150 | + RelativePath="..\mist\operator\operator_array3.h"> | |
151 | + </File> | |
152 | + <File | |
153 | + RelativePath="..\mist\operator\operator_matrix.h"> | |
154 | + </File> | |
155 | + </Filter> | |
156 | + <Filter | |
157 | + Name="リソース ファイル" | |
158 | + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" | |
159 | + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"> | |
160 | + </Filter> | |
161 | + </Files> | |
162 | + <Globals> | |
163 | + </Globals> | |
164 | +</VisualStudioProject> |
@@ -0,0 +1,29 @@ | ||
1 | +Microsoft Developer Studio Workspace File, Format Version 6.00 | |
2 | +# 警告: このワークスペース ファイル を編集または削除しないでください! | |
3 | + | |
4 | +############################################################################### | |
5 | + | |
6 | +Project: "matrix_test"=.\matrix_test.dsp - Package Owner=<4> | |
7 | + | |
8 | +Package=<5> | |
9 | +{{{ | |
10 | +}}} | |
11 | + | |
12 | +Package=<4> | |
13 | +{{{ | |
14 | +}}} | |
15 | + | |
16 | +############################################################################### | |
17 | + | |
18 | +Global: | |
19 | + | |
20 | +Package=<5> | |
21 | +{{{ | |
22 | +}}} | |
23 | + | |
24 | +Package=<3> | |
25 | +{{{ | |
26 | +}}} | |
27 | + | |
28 | +############################################################################### | |
29 | + |
@@ -0,0 +1,21 @@ | ||
1 | +Microsoft Visual Studio Solution File, Format Version 8.00 | |
2 | +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "matrix_test", "matrix_test.vcproj", "{5B87E451-7196-400B-9898-D276C6418B72}" | |
3 | + ProjectSection(ProjectDependencies) = postProject | |
4 | + EndProjectSection | |
5 | +EndProject | |
6 | +Global | |
7 | + GlobalSection(SolutionConfiguration) = preSolution | |
8 | + Debug = Debug | |
9 | + Release = Release | |
10 | + EndGlobalSection | |
11 | + GlobalSection(ProjectConfiguration) = postSolution | |
12 | + {5B87E451-7196-400B-9898-D276C6418B72}.Debug.ActiveCfg = Debug|Win32 | |
13 | + {5B87E451-7196-400B-9898-D276C6418B72}.Debug.Build.0 = Debug|Win32 | |
14 | + {5B87E451-7196-400B-9898-D276C6418B72}.Release.ActiveCfg = Release|Win32 | |
15 | + {5B87E451-7196-400B-9898-D276C6418B72}.Release.Build.0 = Release|Win32 | |
16 | + EndGlobalSection | |
17 | + GlobalSection(ExtensibilityGlobals) = postSolution | |
18 | + EndGlobalSection | |
19 | + GlobalSection(ExtensibilityAddIns) = postSolution | |
20 | + EndGlobalSection | |
21 | +EndGlobal |
@@ -0,0 +1,19 @@ | ||
1 | +include ../build/makeinclude | |
2 | + | |
3 | + | |
4 | +ALL = \ | |
5 | + matrix_test \ | |
6 | + | |
7 | + | |
8 | +all: $(ALL) | |
9 | + | |
10 | +matrix_test : matrix_test.o | |
11 | + $(CXX) $(CXXFLAGS) -o $@ matrix_test.o $(LIBS) $(LDLIBS) | |
12 | + | |
13 | +clean: | |
14 | + for binary in $(ALL); do\ | |
15 | + echo "=== deleting $$binary ===";\ | |
16 | + ( cd ./; rm -f $$binary ) || break;\ | |
17 | + done | |
18 | + rm -f ./*.o | |
19 | + rm -f ./*~ |
@@ -0,0 +1,159 @@ | ||
1 | +#include <iostream> | |
2 | + | |
3 | +#include <mist/mist.h> | |
4 | +#include <mist/matrix.h> | |
5 | +#include <mist/matrix_et.h> | |
6 | + | |
7 | +#ifndef WIN32 | |
8 | +#include <ctime> | |
9 | +#else | |
10 | +#include <windows.h> | |
11 | +#include <mmsystem.h> | |
12 | +#pragma comment ( lib, "winmm.lib" ) | |
13 | +#endif | |
14 | + | |
15 | +class timer | |
16 | +{ | |
17 | +public: | |
18 | + timer( ) | |
19 | + { | |
20 | +#ifndef WIN32 | |
21 | + _start_time = std::clock( ); | |
22 | +#else | |
23 | + _start_time = timeGetTime( ); | |
24 | +#endif | |
25 | + } // postcondition: elapsed()==0 | |
26 | + | |
27 | + void restart( ) | |
28 | + { | |
29 | +#ifndef WIN32 | |
30 | + _start_time = std::clock( ); | |
31 | +#else | |
32 | + _start_time = timeGetTime( ); | |
33 | +#endif | |
34 | + } // post: elapsed()==0 | |
35 | + | |
36 | + double elapsed( ) const // return elapsed time in seconds | |
37 | + { | |
38 | +#ifndef WIN32 | |
39 | + return( double(std::clock( ) - _start_time) / CLOCKS_PER_SEC ); | |
40 | +#else | |
41 | + return( double(timeGetTime( ) - _start_time) / 1000.0 ); | |
42 | +#endif | |
43 | + } | |
44 | + | |
45 | +private: | |
46 | +#ifndef WIN32 | |
47 | + std::clock_t _start_time; | |
48 | +#else | |
49 | + DWORD _start_time; | |
50 | +#endif | |
51 | +}; // timer | |
52 | + | |
53 | + | |
54 | +/* | |
55 | +int main( ) | |
56 | +{ | |
57 | + using namespace std; | |
58 | + | |
59 | + cout << "transpose( mat1 + mat2 * mat3 + mat4 )" << endl << endl; | |
60 | + | |
61 | + mist::matrix< double > mat1( 100, 100 ); | |
62 | + mist::matrix< double > mat2( 100, 100 ); | |
63 | + mist::matrix< double > mat3( 100, 100 ); | |
64 | + mist::matrix< double > mat4( 100, 100 ); | |
65 | + mist::matrix< double > mat( 100, 100 ); | |
66 | + mist::matrix< double > dmy; | |
67 | + | |
68 | + // transpose( mat1 + mat2 * mat3 + mat4 ) | |
69 | + long i, j, k, l, loop = 1000; | |
70 | + { | |
71 | + timer t; | |
72 | + double tmp; | |
73 | + for( l = 0 ; l < loop ; l++ ) | |
74 | + { | |
75 | + for( i = 0 ; i < mat.cols( ) ; i++ ) | |
76 | + { | |
77 | + for( j = 0 ; j < mat.rows( ) ; j++ ) | |
78 | + { | |
79 | + tmp = 0.0; | |
80 | + for( k = 0 ; k < mat3.rows( ) ; k++ ) | |
81 | + { | |
82 | + tmp += mat2( i, k ) * mat3( k, j ); | |
83 | + } | |
84 | + mat( j, i ) = mat1( i, j ) + tmp + mat4( i, j ); | |
85 | + } | |
86 | + } | |
87 | + dmy = mat; | |
88 | + } | |
89 | + cout << "< In the case of Non Expression Template >" << endl; | |
90 | + cout << "Calculation Time: " << t.elapsed( ) << " (sec)" << endl; | |
91 | + } | |
92 | + | |
93 | + { | |
94 | + timer t; | |
95 | + for( i = 0 ; i < loop ; i++ ) | |
96 | + { | |
97 | + mat = ( mat1 + mat2 * mat3 + mat4 ).t( ); | |
98 | + } | |
99 | + cout << "< In the case of Expression Template >" << endl; | |
100 | + cout << "Calculation Time: " << t.elapsed( ) << " (sec)" << endl; | |
101 | + } | |
102 | + | |
103 | + return( 0 ); | |
104 | +} | |
105 | + | |
106 | + | |
107 | +/*/ | |
108 | + | |
109 | +int main( ) | |
110 | +{ | |
111 | + using namespace std; | |
112 | + | |
113 | + cout << "transpose( mat1 + mat2 * mat3 + mat4 )" << endl << endl; | |
114 | + | |
115 | + mist::matrix< double > mat1( 3, 3 ); | |
116 | + mist::matrix< double > mat2( 3, 3 ); | |
117 | + mist::matrix< double > mat3( 3, 3 ); | |
118 | + mist::matrix< double > mat4( 3, 3 ); | |
119 | + mist::matrix< double > mat( 3, 3, 1.0 ); | |
120 | + | |
121 | + mat1( 0, 0 ) = 1; | |
122 | + mat1( 0, 1 ) = 2; | |
123 | + mat1( 0, 2 ) = 3; | |
124 | + mat1( 1, 0 ) = 4; | |
125 | + mat1( 1, 1 ) = 5; | |
126 | + mat1( 1, 2 ) = 6; | |
127 | + mat1( 2, 0 ) = 7; | |
128 | + mat1( 2, 1 ) = 8; | |
129 | + mat1( 2, 2 ) = 9; | |
130 | + | |
131 | + mat2 = mat3 = mat4 = mat1; | |
132 | + long i, j, k; | |
133 | + double tmp; | |
134 | + | |
135 | + for( i = 0 ; i < mat.rows( ) ; i++ ) | |
136 | + { | |
137 | + for( j = 0 ; j < mat.cols( ) ; j++ ) | |
138 | + { | |
139 | + tmp = 0.0; | |
140 | + for( k = 0 ; k < mat3.rows( ) ; k++ ) | |
141 | + { | |
142 | + tmp += mat2( i, k ) * mat3( k, j ); | |
143 | + } | |
144 | + mat( j, i ) = mat1( i, j ) + tmp + mat4( i, j ); | |
145 | + } | |
146 | + } | |
147 | + | |
148 | + cout << "< In the case of Non Expression Template >" << endl; | |
149 | + cout << mat << endl << endl; | |
150 | + | |
151 | + | |
152 | + cout << "< In the case of Expression Template >" << endl; | |
153 | + mat = ( mat1 + mat2 * mat3 + mat4 ).t( ); | |
154 | + cout << mat << endl << endl << endl; | |
155 | + | |
156 | + return( 0 ); | |
157 | +} | |
158 | + | |
159 | +//*/ |