Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:redwil:15.4
octave-forge-fl-core
fix_64bit_index_type.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix_64bit_index_type.patch of Package octave-forge-fl-core
--- a/fl-core/src/fl_compose.cc 2022-09-12 18:29:36.987608637 +0200 +++ b/fl-core/src/fl_compose.cc 2022-09-12 18:36:29.757451295 +0200 @@ -63,14 +63,14 @@ // Structure for thread arguments. Each thread will perform the computation between the start_index and end_index row. struct threadArg { - int start_index; - int end_index; + octave_idx_type start_index; + octave_idx_type end_index; }; // Functions prototype declaration -float get_elem(float vec[], int row, int col,int numCols); -void set_elem(float vec[], int row, int col, int numCols, float elem); +float get_elem(float vec[], octave_idx_type row, octave_idx_type col,octave_idx_type numCols); +void set_elem(float vec[], octave_idx_type row, octave_idx_type col, octave_idx_type numCols, float elem); int is_valid_function(octave_function *func); void *thread_function(void *arg); int get_available_cpus(); @@ -110,13 +110,13 @@ SparseMatrix sparseC; // Matrices dimensions -long int rowsA,rowsB,colsA,colsB,rowsC,colsC; +octave_idx_type rowsA,rowsB,colsA,colsB,rowsC,colsC; // Lock option. 1 = calculation executed only for the diagonal of the matrix int lock_option; -// The increment -int col_index_increment; +// The increment +octave_idx_type col_index_increment; // Number of threads that will be created int num_threads; @@ -357,8 +357,9 @@ else { Matrix outMatrix(rowsC,colsC); - for(int i=0;i<rowsC;i++) - for(int j=0;j<colsC;j++) + + for(octave_idx_type i=0;i<rowsC;i++) + for(octave_idx_type j=0;j<colsC;j++) outMatrix(i,j) = get_elem(c,i,j,colsC); if(sparse_res) @@ -390,17 +391,16 @@ // Initialize the first matrix Matrix tempMatrix = args(0).matrix_value(); a = new float[rowsA*colsA]; - for (int i=0; i<rowsA; i++) - for(int j=0; j<colsA;j++) + for (octave_idx_type i=0; i<rowsA; i++) + for(octave_idx_type j=0; j<colsA;j++) a[i*colsA+j] = tempMatrix(i,j); // Initialize the second matrix tempMatrix = args(1).matrix_value(); b = new float[rowsB*colsB]; - for (int i=0; i<rowsB; i++) - for(int j=0; j<colsB;j++) + for (octave_idx_type i=0; i<rowsB; i++) + for(octave_idx_type j=0; j<colsB;j++) b[i*colsB+j] = tempMatrix(i,j); - // Create the thread args array thread_args = new threadArg[num_threads]; @@ -417,9 +417,9 @@ rowsC = rowsA; } - // Define the number interval of rows for each thread - int interval = rowsA / num_threads; - + // Define the number interval of rows for each thread + octave_idx_type interval = rowsA / num_threads; + int i; // Define the threads for (i=0; i<num_threads; i++) @@ -465,22 +465,22 @@ float tnorm_val; // Initialize the result sparse matrix - sparseC = SparseMatrix((int)colsB, (int)rowsA, (int)(colsB*rowsA)); + sparseC = SparseMatrix(colsB, rowsA, (colsB*rowsA)); // Initialize the number of nonzero elements in the sparse matrix c int nel = 0; sparseC.xcidx(0) = 0; // Calculate the composition for each element - for (int i = 0; i < rowsC; i++) + for (octave_idx_type i = 0; i < rowsC; i++) { - for(int j = 0; j < colsC; j++) + for(octave_idx_type j = 0; j < colsC; j++) { // Get the index of the first element of the i-th column of a transpose (i-th row of a) // and the index of the first element of the j-th column of b - int ka = a.cidx(i); - int kb = b.cidx(j); + octave_idx_type ka = a.cidx(i); + octave_idx_type kb = b.cidx(j); snorm_val = 0; // Check if the values of the matrix are really not 0 (it happens if the column of a or b hasn't any value) @@ -547,22 +547,22 @@ // Declare variables for the T-Norm and S-Norm values float snorm_val; float tnorm_val; - - // Get the row start_index and end_index - int start_index = thread_args->start_index; - int end_index = thread_args->end_index; - + + // Get the row start_index and end_index + octave_idx_type start_index = thread_args->start_index; + octave_idx_type end_index = thread_args->end_index; + // Calculate the composition for the specified rows (between start_index and end_index) - for (int i=start_index; i<end_index; i++) - { - for(int j=lock_option*i; j<colsB; j=j+col_index_increment) + for (octave_idx_type i=start_index; i<end_index; i++) + { + for(octave_idx_type j=lock_option*i; j<colsB; j=j+col_index_increment) { snorm_val = calc_tnorm(get_elem(a,i,0,colsA),get_elem(b,0,j,colsB)); - for(int k=1; k<colsA; k++) - { - tnorm_val = calc_tnorm(get_elem(a,i,k,colsA),get_elem(b,k,j,colsB)); + for(octave_idx_type k=1; k<colsA; k++) + { + tnorm_val = calc_tnorm(get_elem(a,i,k,colsA),get_elem(b,k,j,colsB)); snorm_val = calc_snorm(snorm_val,tnorm_val); } set_elem(c,i,j*(1-lock_option),colsC,snorm_val); @@ -771,7 +771,7 @@ /* Get the (i,j)-th element from the vector vec. The column number of the original matrix (numCols) is required */ -float get_elem(float vec[], int row, int col,int numCols) +float get_elem(float vec[], octave_idx_type row, octave_idx_type col,octave_idx_type numCols) { return vec[row*numCols+col]; } @@ -779,7 +779,7 @@ /* Set the (i,j)-th element from the vector vec. The column number of the original matrix (numCols) is required */ -void set_elem(float vec[], int row, int col, int numCols, float elem) +void set_elem(float vec[], octave_idx_type row, octave_idx_type col, octave_idx_type numCols, float elem) { vec[row*numCols+col] = elem; return;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor