Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*******************************************************************************
! Copyright(C) 1999-2013 Intel Corporation. All Rights Reserved.
!
! The source code, information and material ("Material") contained herein is
! owned by Intel Corporation or its suppliers or licensors, and title to such
! Material remains with Intel Corporation or its suppliers or licensors. The
! Material contains proprietary information of Intel or its suppliers and
! licensors. The Material is protected by worldwide copyright laws and treaty
! provisions. No part of the Material may be used, copied, reproduced,
! modified, published, uploaded, posted, transmitted, distributed or disclosed
! in any way without Intel's prior express written permission. No license
! under any patent, copyright or other intellectual property rights in the
! Material is granted to or conferred upon you, either expressly, by
! implication, inducement, estoppel or otherwise. Any license under such
! intellectual property rights must be express and approved by Intel in
! writing.
!
! *Third Party trademarks are the property of their respective owners.
!
! Unless otherwise agreed by Intel in writing, you may not remove or alter
! this notice or any other notice embedded in Materials by Intel or Intel's
! suppliers or licensors in any way.
!
!*******************************************************************************
! Content:
!
!******************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <math.h>
#include "mkl_example.h"
#include "mkl_cblas.h"
MKL_INT MaxValue(MKL_INT n, MKL_INT *x)
{
MKL_INT i, indmax;
indmax = x[0];
for (i = 1; i < n; i++)
if (indmax < x[i]) indmax = x[i];
return indmax;
} /* MaxValue */
MKL_INT GetVectorI(FILE *in_file, MKL_INT n, MKL_INT *x)
{
return GetValuesI( in_file, x, 0, n );
} /* GetVectorI */
MKL_INT GetVectorS(FILE *in_file, MKL_INT n, float *x, MKL_INT incx)
{
return GetValuesS( in_file, x, 1, 0, (1+(n-1)*abs(incx)) );
} /* GetVectorS */
MKL_INT GetVectorD(FILE *in_file, MKL_INT n, double *x, MKL_INT incx)
{
return GetValuesD( in_file, x, 1, 0, (1+(n-1)*abs(incx)) );
} /* GetVectorD */
MKL_INT GetVectorC(FILE *in_file, MKL_INT n, MKL_Complex8 *x, MKL_INT incx)
{
return GetValuesC( in_file, x, 1, 0, (1+(n-1)*abs(incx)) );
} /* GetVectorC */
MKL_INT GetVectorZ(FILE *in_file, MKL_INT n, MKL_Complex16 *x, MKL_INT incx)
{
return GetValuesZ( in_file, x, 1, 0, (1+(n-1)*abs(incx)) );
} /* GetVectorZ */
MKL_INT GetArrayS(FILE *in_file, CBLAS_ORDER *order, MKL_INT flag, MKL_INT *m, MKL_INT *n,
float *a, MKL_INT *lda)
{
MKL_INT i, j, number;
float *addr;
if( *order == CblasRowMajor ) {
if( flag == GENERAL_MATRIX ) {
for( i = 0; i < (*m); i++ ) {
addr = a + i*(*lda);
number = GetValuesS( in_file, addr, 1, 0, *n );
if( number != *n ) return 1;
} /* for */
} else if( flag == UPPER_MATRIX ) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesS( in_file, addr, 1, i, *n-i );
if( number != *n-i ) return 1;
} /* for */
} else if( flag == LOWER_MATRIX ) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesS( in_file, addr, 1, 0, i+1 );
if( number != i+1 ) return 1;
} /* for */
} /* if */
} else if( *order == CblasColMajor ) {
if( flag == GENERAL_MATRIX ) {
for( j = 0; j < (*n); j++ ) {
addr = a + j*(*lda);
number = GetValuesS( in_file, addr, 1, 0, *m );
if( number != *m ) return 1;
} /* for */
} else if( flag == UPPER_MATRIX ) {
for( j = 0; j < (*n); j++ ) {
addr = a + j*(*lda);
number = GetValuesS( in_file, addr, 1, 0, j+1 );
if( number != j+1 ) return 1;
} /* for */
} else if( flag == LOWER_MATRIX ) {
for( j = 0; j < (*n); j++ ) {
addr = a + j*(*lda);
number = GetValuesS( in_file, addr, 1, j, *m-j );
if( number != *m-j ) return 1;
} /* for */
} /* if */
} /* if */
return 0;
} /* GetArrayS */
MKL_INT GetArrayD(FILE *in_file, CBLAS_ORDER *order, MKL_INT flag, MKL_INT *m, MKL_INT *n,
double *a, MKL_INT *lda)
{
MKL_INT i, j, number;
double *addr;
if (*order == CblasRowMajor) {
if (flag == GENERAL_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesD( in_file, addr, 1, 0, *n );
if( number != *n ) return 1;
} /* for */
} else if (flag == UPPER_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesD( in_file, addr, 1, i, *n-i );
if( number != *n-i ) return 1;
} /* for */
} else if (flag == LOWER_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesD( in_file, addr, 1, 0, i+1 );
if( number != i+1 ) return 1;
} /* for */
} /* if */
} else if (*order == CblasColMajor) {
if (flag == GENERAL_MATRIX) {
for (j = 0; j < (*n); j++) {
addr = a + j*(*lda);
number = GetValuesD( in_file, addr, 1, 0, *m );
if( number != *m ) return 1;
} /* for */
} else if (flag == UPPER_MATRIX) {
for (j = 0; j < (*n); j++) {
addr = a + j*(*lda);
number = GetValuesD( in_file, addr, 1, 0, j+1 );
if( number != j+1 ) return 1;
} /* for */
} else if (flag == LOWER_MATRIX) {
for (j = 0; j < (*n); j++) {
addr = a + j*(*lda);
number = GetValuesD( in_file, addr, 1, j, *m-j );
if( number != *m-j ) return 1;
} /* for */
} /* if */
} /* if */
return 0;
} /* GetArrayD */
MKL_INT GetArrayC(FILE *in_file, CBLAS_ORDER *order, MKL_INT flag, MKL_INT *m, MKL_INT *n,
MKL_Complex8 *a, MKL_INT *lda)
{
MKL_INT i, j, number;
MKL_Complex8 *addr;
if (*order == CblasRowMajor) {
if (flag == GENERAL_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesC( in_file, addr, 1, 0, *n );
if( number != *n ) return 1;
} /* for */
} else if (flag == UPPER_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesC( in_file, addr, 1, i, *n-i );
if( number != *n-i ) return 1;
} /* for */
} else if (flag == LOWER_MATRIX) {
for (i = 0; i < (*m); i++) {
addr = a + i*(*lda);
number = GetValuesC( in_file, addr, 1, 0, i+1 );
if( number != i+1 ) return 1;
} /* for */
} /* if */
} else if (*order == CblasColMajor) {
if (flag == GENERAL_MATRIX) {
Loading full blame...