Changeset 1915 for inundation/wiki/least_squares_refactoring.txt
- Timestamp:
- Oct 14, 2005, 9:01:24 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/wiki/least_squares_refactoring.txt
r1899 r1915 7 7 Software, called least squares, has been developed to implement a 8 8 penalised least-squares fit and associated interpolations. It is in 9 least_squares.py. It is currently not meeting user requirements with 9 least_squares.py. Steven Roberts outlined the least squares algorithm 10 used. The code is currently not meeting user requirements with 10 11 regards to speed and memory use. Additional functionality is also needed. 11 12 12 13 SCOPE 13 This is looking at refactoring the Class Interpolation 14 This is looking at refactoring the Class Interpolation and the 15 functions fit_to_mesh_file, fit_to_mesh and the command line use of 16 least_squares.py. 14 17 15 18 LIFE-CYCLE … … 19 22 build_quadtree in quad.py can be worked on after requirements have 20 23 been determined. Also, the current least squares may be tinkered with 21 to check the feasibility of concepts. 22 23 At this stage how the design will be coded, eg built from the ground 24 up, cut and past into a new file or changing the current code, has not 25 been determined. 26 24 to check the feasibility of concepts and general maintanance. The 25 main thrust will be refactoring though. 27 26 28 27 … … 35 34 INTRODUCTION 36 35 37 This document specifies the requirements to implement when these 38 modules are refactored. 39 40 41 OVERALL DESCRIPTION 42 43 Steven Roberts outlined the least squares algorithm used. 44 36 This document specifies the requirements to implement least squares 37 is refactored. 45 38 46 39 DEFINITIONS 47 40 48 The least squares algorithm will not be changed. 49 50 41 51 42 REQUIREMENT SECTION 52 43 … … 59 50 60 51 Requirements 61 Warn the user when interpolating if points are outside the mesh. 62 Let the user set the default value that is returned for these points. 52 53 When interpolating, return information on which points were outside 54 the mesh (in such a way that it can not be interporated as real data). 55 If attribute information for points outside the mesh is returned, that can 56 only be a float, let the user set the default value that is returned 57 for points outside the mesh. 58 59 When fitting, when in verbose mode display how many triangles are in the 60 mesh and how many are out. Also display the max # of points/ triangle 61 and the minimum number of points. If this operation takes alot of 62 time, let it be optional. 63 63 64 64 Warn the user when fitting to mesh if the mesh is outside the points boundary. 65 (Note: by using alpha least squares can alway return a result in this65 (Note: by using alpha least squares can always return a result in this 66 66 situation) 67 67 68 X number of points will not cause a memory error. (Problem is setting 69 how many) 70 Reduce the memory use of least_squares. (This requirement isn't 71 really testable) 68 Fitting 2 million points to a one million triangles mesh will not cause a 69 memory error. 72 70 73 Reduce the time spent building matrix A. ( ditto)71 Reduce the time spent building matrix A. (not a testable requirement) 74 72 75 by using blocking and improving 76 the architecture. and is implementation focused.) 77 78 73 (This isn't long, are there any other requirements?) 79 74 80 75 Requirement Notes … … 83 78 Other options are, set to a given value. 84 79 Raise an error. 85 R eturn/set a flag and set to a given value/0.0. (I like this one)80 Raise/return a warning and set to a given value/0.0. (I like this one) 86 81 87 82 … … 91 86 General Error Handling Guidelines 92 87 93 Assume 4 ways of using the code 88 Assume 4 ways of using the code (for Inperpolate class) 94 89 1) command line interface 95 90 2) API function - these have parameters of input data file names, … … 98 93 4) Internal methods. 99 94 100 Way s 1 and 2 areused by general users, so they should not return95 Way 1 is used by general users, so they should not return 101 96 something that looks like a code crash from bad input. 102 Another option for way 2 is to raise an error, which the user handles. 103 Discus with Ole 97 An option for way 2 is to raise an exception, which the user 98 handles. Should the code display a warning, based on the error? 99 100 Note, if a method is used by a gui, or by scripts change the requirements 101 Discus with Error Handling Ole 104 102 105 103 … … 107 105 Least Squares System Design Specification 108 106 109 By Duncan Gray 107 By Duncan Gray - lots of good ideas by Ole 110 108 111 109 … … 114 112 This specifies design choices for the least squares code. 115 113 116 OVERALL ARCHITECTURAL CHANGES117 118 114 DESIGN IDEAS, to meet requirements 119 115 *To save memory; 120 116 When interpolating, don't build AtA, B and D. (This has been implemented) 121 When fitting, don't build A. 117 When fitting, don't build A. - Work with AtA and Atz. 122 118 123 119 … … 125 121 126 122 * To save memory 127 Use blocking when interpolating a large number of points (how large? 128 Can the program check the available memory and work out a good block 129 size?) 123 124 This is for the layer interpolation and fitting with IO: Use blocking 125 when interpolating/fitting a large number of points (how large? Can the 126 program check the available memory and work out a good block size?) 127 128 The code has to be refactored so fitting can handling blocked point 129 info. Need a building phase and a solve phase. 130 130 131 131 132 *To reduce the time spent building matrix A. … … 135 136 has to be there. 136 137 138 Another speed up option is to write the bottlenecks in C. Do it if necessary. 139 137 140 138 141 DESIGN IDEAS, refactoring … … 141 144 point co-ords to conform to the mesh co-ords early in the code. 142 145 146 Currently there is one class, called Interpolation, that holds the 147 matrix data and methods for fitting and interpolation. Break this 148 into two classes, one for fittting, the other for interpolation. Have 149 processes common to both classes in functions. 143 150 151 Have least squares as two stand alone packages. One that has the guts 152 of LS (e.g. the two new classes). One that is has the IO API's 153 (functions that load and write files). The guts package will be 154 dependent of the general mesh package. The IO API will rely on an IO 155 module. 156 157 HOW WILL IMPLEMENTATION OCCUR? 158 Code a new least squares module in a seperate directory. Heavily cut 159 and paste from the old least squares. Implement memory and time tests 160 on the old least squares (and new LS) before doing any changes.
Note: See TracChangeset
for help on using the changeset viewer.