Sponsored Content
Top Forums Shell Programming and Scripting Calculate average, azimut and distance Post 302968297 by Don Cragun on Monday 7th of March 2016 04:14:33 PM
Old 03-07-2016
With more than 250 posts we would like to think that you are learning something from all of the help we have provided you in the past. Please try to do this on your own, show us the code you have tried, and tell us what you can't get to work. We'll be happy to help you help you when you get stuck.

But, we are not here to act as your unpaid programming staff.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

calculate average of column 2

Hi I have fakebook.csv as following: F1(current date) F2(popularity) F3(name of book) F4(release date of book) 2006-06-21,6860,"Harry Potter",2006-12-31 2006-06-22,,"Harry Potter",2006-12-31 2006-06-23,7120,"Harry Potter",2006-12-31 2006-06-24,,"Harry Potter",2006-12-31... (0 Replies)
Discussion started by: onthetopo
0 Replies

2. UNIX for Dummies Questions & Answers

Use awk to calculate average of column 3

Suppose I have 500 files in a directory and I need to Use awk to calculate average of column 3 for each of the file, how would I do that? (6 Replies)
Discussion started by: grossgermany
6 Replies

3. Shell Programming and Scripting

program to calculate distance between 5 atoms

Hello, I am a beginner with perl. I have a perl program to calculate the distance between 5 atoms or more. i have an array which looks like this: 6.324 32.707 50.379 5.197 32.618 46.826 4.020 36.132 46.259 7.131 38.210 45.919 6.719 38.935 42.270 2.986 39.221 ... (1 Reply)
Discussion started by: annie_singh
1 Replies

4. Programming

calculate average

I have a file which is 2 3 4 5 6 6 so i am writing program in C to calculate mean.. #include<stdio.h> #include<string.h> #include <math.h> double CALL mean(int n , double x) main (int argc, char **argv) { char Buf,SEQ; int i; double result = 0; FILE *fp; (3 Replies)
Discussion started by: cdfd123
3 Replies

5. Programming

Converting distance list to distance matrix in R

Hi power user, I have this type of data (distance list): file1 A B 10 B C 20 C D 50I want output like this # A B C D A 0 10 30 80 B 10 0 20 70 C 30 20 0 50 D 80 70 50 0 Which is a distance matrix I have tried... (0 Replies)
Discussion started by: anjas
0 Replies

6. Shell Programming and Scripting

Calculate distance and azimuth

Hi all, I have a data file like this lat lon lat lon 12.000 25.125 14.235 25.012 14.200 81.000 25.584 25.014 45.023 25.365 25.152 35.222 I want to calculate distance and azimuth between this points eg:- 12.000,25.125 and 14.235,25.012 I want to use awk programming... (3 Replies)
Discussion started by: chamara
3 Replies

7. Shell Programming and Scripting

AWK novice - calculate the average

Hi, I have the following data in a file for example: P1 XXXXXXX.1 YYYYYYY.1 ZZZ.1 P1 XXXXXXX.2 YYYYYYY.2 ZZZ.2 P1 XXXXXXX.3 YYYYYYY.3 ZZZ.3 P1 XXXXXXX.4 YYYYYYY.4 ZZZ.4 P1 XXXXXXX.5 YYYYYYY.5 ZZZ.5 P1 XXXXXXX.6 YYYYYYY.6 ZZZ.6 P1 XXXXXXX.7 YYYYYYY.7 ZZZ.7 P1 XXXXXXX.8 YYYYYYY.8 ZZZ.8 P2... (6 Replies)
Discussion started by: alex2005
6 Replies

8. Shell Programming and Scripting

Calculate Average AWK

I want to calculate the average line by line of some files with several lines on them, the files are identical, just want to average the 3rd columns of those files.:wall: Example file: File 1 001 0.046 0.667267 001 0.047 0.672028 001 0.048 0.656025 001 0.049 ... (2 Replies)
Discussion started by: AriasFco
2 Replies

9. Shell Programming and Scripting

Calculate average for repeated ID within a data

I have an awk script that gives the following output: Average end-to-end transmission delay 2.7 to 5.7 is 0.635392 seconds Average end-to-end transmission delay 2.1 to 5.1 is 0.66272 seconds Average end-to-end transmission delay 2.1 to 5.1 is 0.691712 seconds Average end-to-end transmission... (4 Replies)
Discussion started by: ENG_MOHD
4 Replies

10. Shell Programming and Scripting

Calculate the average per block.

My old school way is a one liner. And will search for average from SAR, to get the data receive rate. But, I dont think it is practical or accurate,. Because it calculates to off peak hours. I am planning to change it. My cron runs every 30 mins. When my cron runs, and my time is 14:47pm,, it will... (1 Reply)
Discussion started by: invinzin21
1 Replies
Graph::AdjacencyMatrix(3pm)				User Contributed Perl Documentation			       Graph::AdjacencyMatrix(3pm)

NAME
Graph::AdjacencyMatrix - create and query the adjacency matrix of graph G SYNOPSIS
use Graph::AdjacencyMatrix; use Graph::Directed; # or Undirected my $g = Graph::Directed->new; $g->add_...(); # build $g my $am = Graph::AdjacencyMatrix->new($g); $am->is_adjacent($u, $v) my $am = Graph::AdjacencyMatrix->new($g, distance_matrix => 1); $am->distance($u, $v) my $am = Graph::AdjacencyMatrix->new($g, attribute_name => 'length'); $am->distance($u, $v) my $am = Graph::AdjacencyMatrix->new($g, ...); my @V = $am->vertices(); DESCRIPTION
You can use "Graph::AdjacencyMatrix" to compute the adjacency matrix and optionally also the distance matrix of a graph, and after that query the adjacencyness between vertices by using the "is_adjacent()" method, or query the distance between vertices by using the "distance()" method. By default the edge attribute used for distance is "w", but you can change that in new(), see below. If you modify the graph after creating the adjacency matrix of it, the adjacency matrix and the distance matrix may become invalid. Methods Class Methods new($g) Construct the adjacency matrix of the graph $g. new($g, options) Construct the adjacency matrix of the graph $g with options as a hash. The known options are distance_matrix => boolean By default only the adjacency matrix is computed. To compute also the distance matrix, use the attribute "distance_matrix" with a true value to the new() constructor. attribute_name => attribute_name By default the edge attribute used for distance is "w". You can change that by giving another attribute name with the "attribute_name" attribute to new() constructor. Using this attribute also implicitly causes the distance matrix to be computed. Object Methods is_adjacent($u, $v) Return true if the vertex $v is adjacent to vertex $u, or false if not. distance($u, $v) Return the distance between the vertices $u and $v, or "undef" if the vertices are not adjacent. adjacency_matrix Return the adjacency matrix itself (a list of bitvector scalars). vertices Return the list of vertices (useful for indexing the adjacency matrix). ALGORITHM
The algorithm used to create the matrix is two nested loops, which is O(V**2) in time, and the returned matrices are O(V**2) in space. SEE ALSO
Graph::TransitiveClosure, Graph::BitMatrix AUTHOR AND COPYRIGHT
Jarkko Hietaniemi jhi@iki.fi LICENSE
This module is licensed under the same terms as Perl itself. perl v5.10.0 2005-04-16 Graph::AdjacencyMatrix(3pm)
All times are GMT -4. The time now is 04:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy