All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jnt.scimark2.SparseCompRow Maven / Gradle / Ivy

Go to download

SciMark 2.0 is a Java benchmark for scientific and numerical computing. It measures several computational kernels and reports a composite score in approximate Mflops (Millions of floating point operations per second).

The newest version!
package jnt.scimark2;

public class SparseCompRow
{
	/* multiple iterations used to make kernel have roughly
		same granulairty as other Scimark kernels. */

	public static double num_flops(int N, int nz, int num_iterations)
	{
		/* Note that if nz does not divide N evenly, then the
		   actual number of nonzeros used is adjusted slightly.
		*/
		int actual_nz = (nz/N) * N;
		return ((double)actual_nz) * 2.0 * ((double) num_iterations);
	}


	/* computes  a matrix-vector multiply with a sparse matrix
		held in compress-row format.  If the size of the matrix
		in MxN with nz nonzeros, then the val[] is the nz nonzeros,
		with its ith entry in column col[i].  The integer vector row[]
		is of size M+1 and row[i] points to the begining of the
		ith row in col[].  
	*/

	public static void matmult( double y[], double val[], int row[],
		int col[], double x[], int NUM_ITERATIONS)
	{
		int M = row.length - 1;

		for (int reps=0; reps




© 2015 - 2024 Weber Informatics LLC | Privacy Policy