C/C++ :: Sequential Matrix Multiplication - Error In Execution Time

Apr 30, 2014

I wrote program for Sequential matrix multiplication .But after execution for any input value( ex. 100,150,400) it shows the execution time is 0.000 msec.

#include <stdio.h>
#include <math.h>
#include <sys/time.h>
void print_results(char *prompt, int N, float *a);
int main(int argc, char *argv[])

[Code] ......

View 2 Replies


ADVERTISEMENT

C/C++ :: Sequential Matrix Multiplication Program - Syntax Error Near Unexpected Token

Apr 30, 2014

I wrote a sequential matrix multiplication program in c.

After execution i get error like
./mul.c: line 11: syntax error near unexpected token `('
./mul.c: line 11: `int main(){'

#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define wA (30 * 16)
#define wB (50 * 16)
#define hA (80 * 16)
#define hB wA
#define wC wB

[Code] ....

View 4 Replies View Related

C++ :: SSE Matrix Multiplication Error

Apr 25, 2014

I have been using SSE/ SIMD Matrix multiplication approaches and I persistently get this error:

void mmul_sse_nsize(const float * a, const float * b, float * r, int size) {
__m128 a_line, b_line, r_line;
int bound = size*size;
int rows = size;

[Code] ....

The code almost never throws the error when matrices are size NxN, N =4.

Also, I have a 4 core laptop with 2 GB RAM and I am using VS2013.

View 3 Replies View Related

C/C++ :: Round Robin Execution With Gantt Chart - Arrival Time And Burst Time

Mar 10, 2015

This is a round robin execution. with gantt chart. arrival time and burst time. I think there is an error in my formula to get the right answer,i cant resolve it but my program is running. What is the code or the right formula??

#include<stdio.h>
int main(){
int i,j=0,n,time,remain,flag=0,ts;
int sum_wait=0,sum_turnaround=0,at[10],bt[10],rt[10];
int ganttP[50],ganttStartTime[50];
printf("Enter no of Processes : ");
scanf("%d",&n);
remain=n;

[Code] ....

View 2 Replies View Related

C++ :: Accept Matrix As Argument And Display Its Multiplication Matrix

Jun 1, 2014

I just want to know the code of the program: Write code to accept matrix as aurgument and display its multiplication matrix which return its multiplication matrix.

View 1 Replies View Related

C :: Execution Stopped Every Time Try To Add Data From Scanf

Nov 12, 2013

this is a syntax i've been trying to run. apparently it stopped as i entered the first value. this is the value i am trying to key in

Initial House Cost 67,000 62,000 75,000
Annual Fuel Cost 2,300 2,500 1,850
Tax Rate 0.025 0.025 0.020

my syntax are as below

Code:

#include <stdio.h>
#include <conio.h>
int main(void) {
float houseInt1 , houseInt2 , houseInt3 ;
float fuelAnnual1 , fuelAnnual2 , fuelAnnual3;
float taxRate1 , taxRate2 ,taxRate3;
float total1 , total2 , total3;

[code]....

View 9 Replies View Related

C++ :: Execution Of Certain Commands - Setting Device Time

Sep 10, 2013

I got a assignment in which i have to write codes for execution of certain commands.

One of the command is set_time. if user enters set_time 12:12:12

The time should get reset to 12:12:12 no matter what it is now.

View 7 Replies View Related

C Sharp :: Counting Execution Time Of A Task?

Nov 9, 2013

I am checking out this simple piece of code:

private void button1_Click(object sender, EventArgs e)  {
            Stopwatch sw = Stopwatch.StartNew();  
            Task Task1 = Task.Factory.StartNew(() =>  {
                    Console.WriteLine("Task1 started in : "+ " "+sw.ElapsedMilliseconds);
                    Thread.Sleep(4000);
                    Console.WriteLine("Task1 finished in : " + " " + sw.ElapsedMilliseconds);
                }
                );
        }

and the results are :

Task1 started in : 2 in milliseconds
Task1 finished in : 4015 in milliseconds.

The problem is, that if i count the time with an external device, just like the timer of my watch or my cellphone s,the total time is 4,8 or 4,9 seconds, which i wouldn t expect that to happen.

The first thing i ve thought, is that it takes the ThreadPool about 800msec or 1 sec to create the thread so as to execute this task, but even if it is so, shouldn t the stopwatch count the time precisely?So , why is there a deviation between an external timer and the stopwatch ?

View 1 Replies View Related

C++ :: Matrix Multiplication Using Pointers

Feb 15, 2014

Code:
#include<stdio.h>
#include<conio.h>
void main()

[Code] .....

This program on running returns an error of "ILLEGAL USE OF POINTER".

View 4 Replies View Related

C :: Matrix Multiplication Using Pointers

Feb 17, 2014

Code:
#include<stdio.h> Code: #include<conio.h>
void main() {
int *a[2][2],*b[2][2],*c[2][2],i,j,k;
Printf("
ENTER a MATRIX ELEMENTS

[Code] .....

View 4 Replies View Related

C/C++ :: Matrix Multiplication Using Files

Dec 12, 2014

I am trying to read two matrices from individual .txt file, and later trying to multiply them. But I am unable to succeed.

Here is the code.

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
// Here starts the main
int main()
{ // The two input values
FILE *inputFile1;
FILE *inputFile2;

[Code] .....

I am able to get only the first values as the output. The first matrix is 5x3, and the second one is a 3x3 matrix.

Matrix 1
1 2 3
4 5 6
7 8 9
10 11 12

Matrix 2
1 2 3
4 5 6
7 8 9

The output which I am getting is

Enter File name of matrix #1 - with extention - : matrix1.txt
Enter File name of matrix #2 - with extention - : matrix2.txt
Rows1 = 1 Cols1 = 2
Rows2 = 1
Cols2 = 2Cant multiply those two matrices

View 11 Replies View Related

C++ :: Matrix Vector Multiplication

Jan 30, 2015

I have Problem with matrix vector multiplication in program..

void matrixVector ( const int n, const double* A, const double* x, double* y ){
//for(int i = 0; i < n; i++){
// y[i*n] = 0.0;
// }
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
y[i*n] += A[i*n+j]*x[j*n];

[Code] ....

View 3 Replies View Related

C/C++ :: Matrix Multiplication (Vectors)

Oct 31, 2014

I am writing a brute force implementation of matrix multiplication:

Header file:

vector<vector<int> > matrix_multiplication(vector <vector<int> >& a, vector <vector<int> >& B)/>/>/>;

Source file:

vector<vector<int> > matrix_multiplication(vector <vector<int> >& a, vector <vector<int> >& B)/>/>/>{
int n = a.size();
vector< vector <int> > c (n , vector<int> (n));
for (int i =0 ; i<n ; i++){
for (int j =0 ; j < n ; j++){
for (int k ; k < n ; k++){
c[i][j] = a[i][k] + b[k][j];

[Code] ....

I keep on getting occasional seg faults />/>. I can't see why.

View 10 Replies View Related

C/C++ :: Matrix Multiplication Without Using Arrays

Aug 31, 2014

How to write matrix multiplication (without using arrays) in C ....

View 1 Replies View Related

C++ :: Matrix Multiplication 3x3 For Loops?

Apr 12, 2013

So basically I have to tell the user to input data and i use a for loop:

for (i=0; i< 3; i++)
cin >> p[i][0],p[i][1], p[i][2];

Now for the confusing part is, what do i put in the nested for loops to multiply them and output them so it looks something like

matrix p,r1: # # #
" ",r2: " "
" " " "

View 1 Replies View Related

C++ :: Measuring Execution Time Of Static And Dynamic Binding

Jan 11, 2013

consider the code bellow

#include<iostream>
#include<ctime>
#include<boost/progress.hpp>
using namespace std;
class parent {
public:
virtual void dynamic_display(){

[Code] ....

I am getting the following as output

Calculating....Static Function is called1times
The number of processor clicks is0time is0
Calculating....Dynamic function is called1times
The number of processor clicks is0time is0
Static Function is called2times
Dynamic function is called2times
Static Function is called3times
Dynamic function is called3times

I am actually trying to calculate the time to execute a statically binding method and a dynamically binded one.consider only the first four lines in my output. Why am i not getting the actual result.

View 3 Replies View Related

C :: Multiplication Of Matrix Called Betrix?

Nov 11, 2013

I would like to know how could I make multiplication of matrix called betrix in this code:

Code:
printf("transposed matrix:
");
int trantrix[size][size]; //transposed matrix
for(i=0;i<size;i++) {
for(j=0;j<size;j++) {
trantrix[i][j] = matrix[j][i];
printf("%d ",trantrix[i][j]);

[Code] ......

View 3 Replies View Related

C++ :: Forming A Matrix Multiplication Program

Oct 9, 2013

I just started Linear Algebra for my programming degree and to full understand everything I want to put it into code and make my own "matrix calculator." I have all the theory but I am having issues keeping the matrix variable and moving it around the class' functions to create it and output it. Once I know I have it saved I think I can get the addition/multiplication to work. Here is the code I have so far:

#include <string>
#include <iostream>
using namespace std;
class matrix {

[Code] ....

View 5 Replies View Related

C++ :: Program Matrix Multiplication But It Work Not For Big Arrays?

Mar 9, 2014

I have a program matrix multiplication but it work not for big arrays. n should be bis 200.

#include <iostream>
#include <time.h>
#include <cstdlib>

[Code]....

View 6 Replies View Related

Visual C++ :: Obtaining Actual Effective Execution Time Per Thread With Hyperthreading

Jun 13, 2013

I'm looking for a function like GetThreadTimes, but one that gives correct results in a hyperthreading CPU.

For instance, if you start 2 threads on a CPU with 1 physical core and 2 logical cores, GetThreadTimes will say that both these threads use 100% CPU.

However, in reality they only use 50% each. Is there a function that returns correct results, or is there another workaround?

View 8 Replies View Related

C :: Developing Native Matrix Multiplication Algorithm For 53 Bits

Mar 24, 2014

I am actually working on IEEE Arithmetic especially the IEEE 754 specification where the IEEE double only have 53 bits of precision. I am working on Z/nZ matrix multiplication that works on 53 bits specs. How to write a matrix multiplication algorithm that works well on 53 bits IEEE precision standard.

View 5 Replies View Related

C++ :: Dynamic Massive - Multiplication Of Positive Matrix Elements

Oct 5, 2014

I have a problem with dynamic massive. My task was to find the multiplication of positive matrix elements with using indexes and seperated compiling.

Compiler doesn't warn me about any mistake, but result is not right, it is even not a number.

Header.h

#include <iostream>
#include <math.h>
using namespace std;
float multi(int k, int t, float **p);

[Code] ....

View 5 Replies View Related

C/C++ :: Parallelize Matrix Multiplication Function Dynamically And Statically

Oct 1, 2014

I've been trying to get my matrix multiplication program to run a few different ways. My assignments wants me to run it statically using chunks, but we're not supposed to use OpenMPs scheduler. So I'm not sure how that's possible. And secondly, we have to run it dynamically using locks/unlocks.

Static (not sure how to implement chunk)

#pragma omp section
{
printf("Thread %d doing matrix mult", threadID);
if (matrixAcols != matrixBrows) {
cout << "Error, operation not possible" << endl;

[Code]....

The code will run for a long time too. It uses as many threads as we tell it to but it never speeds up the results.

Quote
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 2 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult
Thread 4 doing matrix mult

View 2 Replies View Related

Visual C++ :: Read Table And Get All PNAME Into Combobox - Reduce Query Execution Time

Nov 14, 2014

My table:

Code:
Database name: test & Table name : Profilemaster
+-----+--------+
| PID | PNAME |
+-----+--------+
| 1 | APPLE1 |
| 2 | APPLE2 |
| 3 | APPLE3 |
| 4 | APPLE4 |
| 5 | APPLE5 |
| 6 | APPLE6 |
| 7 | APPLE7 |
| 8 | APPLE8 |
| 9 | APPLE9 |
| 10| APPLE10 |
+-----+--------+

I like to read the table and get the all PNAME into the combo box.

Using the below code i can read the table, but while loop takes 2 seconds to read 10 records in the Profilemaster table.
How can i reduce the reading time?

My Code is
void MainScreen::OnreadProfileName() {
CDatabase database;
CString SqlString;
CString sDsn;
CString pname;

sDsn.Format("Driver={MySQL ODBC 5.2 ANSI Driver};Server=localhost;Database=test;User=root;Password=client;Option=4;");

[Code] ....

Is any other way to reduce the query execution time?

View 6 Replies View Related

C# :: Fatal Error During Command Execution

Dec 31, 2014

Why i keep getting the above error. below is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;

[Code] .....

Attached image(s)

View 5 Replies View Related

C++ :: Getting Error In Karatsuba Multiplication Program

Oct 5, 2014

I have made a Biginteger class that performs multiplication operation according to Karatsuba's algorithm. But it seems that the code is not working perfectly.In the class I have made a function named karatsuba(BigInteger a1, BigInteger b1)that performs the Multilplication operation. There might be problems in this function as I have tried to store the original digits(neglecting the leading zeros) of the two big integer values into two integers or there might be problems in somewhere else. corrected version of this function? My code is given below:

#include <stdio.h>
#include <iostream>
#include <cstdio>

[Code].....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved