MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / r8mat_gen

Function r8mat_gen

test/benchmark/linpack2.c:1108–1145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1106/******************************************************************************/
1107
1108double *r8mat_gen ( int lda, int n )
1109
1110/******************************************************************************/
1111/*
1112 Purpose:
1113
1114 R8MAT_GEN generates a random R8MAT.
1115
1116 Modified:
1117
1118 06 June 2005
1119
1120 Parameters:
1121
1122 Input, integer LDA, the leading dimension of the matrix.
1123
1124 Input, integer N, the order of the matrix.
1125
1126 Output, double R8MAT_GEN[LDA*N], the N by N matrix.
1127*/
1128{
1129 double *a;
1130 int i;
1131 int init[4] = { 1, 2, 3, 1325 };
1132 int j;
1133
1134 a = ( double * ) malloc ( lda * n * sizeof ( double ) );
1135
1136 for ( j = 1; j <= n; j++ )
1137 {
1138 for ( i = 1; i <= n; i++ )
1139 {
1140 a[i-1+(j-1)*lda] = r8_random ( init ) - 0.5;
1141 }
1142 }
1143
1144 return a;
1145}
1146/******************************************************************************/
1147
1148void timestamp ( void )

Callers 1

mainFunction · 0.85

Calls 2

r8_randomFunction · 0.85
mallocFunction · 0.50

Tested by

no test coverage detected