1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-14 15:40:19 +02:00

* acconfig.h: add HAVE_ARRAYS.

* configure.in: add --disable-arrays option, probably temporary.

	* the following changes allow guile to be built with the array
	"module" omitted.  some of this stuff is just tc7 type support,
	which wouldn't be needed if uniform array types were converted
	to smobs.

	* tag.c (scm_utag_bvect ... scm_utag_cvect): don't define unless
	HAVE_ARRAYS.
	(scm_tag): don't check array types unless HAVE_ARRAYS.

	* sort.c (scm_restricted_vector_sort_x, scm_sorted_p):
	remove the unused array types.
	* (scm_stable_sort, scm_sort): don't support vectors if not
	HAVE_ARRAYS.  a bit excessive.

	* random.c (vector_scale, vector_sum_squares,
	scm_random_solid_sphere_x, scm_random_hollow_sphere_x,
	scm_random_normal_vector_x): don't define unless HAVE_ARRAYS.

	* gh_data.c (makvect, gh_chars2byvect, gh_shorts2svect,
	gh_longs2ivect,	gh_ulongs2uvect, gh_floats2fvect, gh_doubles2dvect,
	gh_uniform_vector_length, gh_uniform_vector_ref):
	don't define unless HAVE_ARRAYS.
	(gh_scm2chars, gh_scm2shorts, gh_scm2longs, gh_scm2floats,
	gh_scm2doubles):
	don't check vector types if not HAVE_ARRAYS.

	* eq.c (scm_equal_p), eval.c (SCM_CEVAL), print.c (scm_iprin1),
	gc.c (scm_gc_mark, scm_gc_sweep), objects.c (scm_class_of):
	don't support the array types unless HAVE_ARRAYS is defined.

	* tags.h: make nine tc7 types conditional on HAVE_ARRAYS.

	* read.c (scm_lreadr): don't check for #* unless HAVE_ARRAYS is
	defined (this should use read-hash-extend).

	* ramap.c, unif.c: don't check whether ARRAYS is defined.

	* vectors.c (scm_vector_set_length_x): moved here from unif.c.  call
	scm_uniform_element_size if HAVE_ARRAYS.
	vectors.h: prototype too.

	* unif.c (scm_uniform_element_size): new procedure.

	* init.c (scm_boot_guile_1): don't call scm_init_ramap or
	scm_init_unif unless HAVE_ARRAYS is defined.

	* __scm.h: don't define ARRAYS.

	* Makefile.am (EXTRA_libguile_la_SOURCES): unif.c and ramap.c
	moved here from	libguile_la_SOURCES.


	* Makefile.am (ice9_sources): add arrays.scm.

	* boot-9.scm: load arrays.scm if 'array is provided.

	* arrays.scm: new file with stuff from boot-9.scm.
This commit is contained in:
Gary Houston 1999-11-19 18:16:19 +00:00
parent 5c11cc9deb
commit afe5177e7f
28 changed files with 268 additions and 211 deletions

View file

@ -411,6 +411,22 @@ scm_random_uniform (SCM state)
return scm_makdbl (scm_c_uniform01 (SCM_RSTATE (state)), 0.0);
}
SCM_PROC (s_random_normal, "random:normal", 0, 1, 0, scm_random_normal);
SCM
scm_random_normal (SCM state)
{
if (SCM_UNBNDP (state))
state = SCM_CDR (scm_var_random_state);
SCM_ASSERT (SCM_NIMP (state) && SCM_RSTATEP (state),
state,
SCM_ARG1,
s_random_normal);
return scm_makdbl (scm_c_normal01 (SCM_RSTATE (state)), 0.0);
}
#ifdef HAVE_ARRAYS
static void
vector_scale (SCM v, double c)
{
@ -443,13 +459,13 @@ vector_sum_squares (SCM v)
return sum;
}
SCM_PROC (s_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0, scm_random_solid_sphere_x);
/* For the uniform distribution on the solid sphere, note that in
* this distribution the length r of the vector has cumulative
* distribution r^n; i.e., u=r^n is uniform [0,1], so r can be
* generated as r=u^(1/n).
*/
SCM_PROC (s_random_solid_sphere_x, "random:solid-sphere!", 1, 1, 0, scm_random_solid_sphere_x);
SCM
scm_random_solid_sphere_x (SCM v, SCM state)
{
@ -488,21 +504,6 @@ scm_random_hollow_sphere_x (SCM v, SCM state)
vector_scale (v, 1 / sqrt (vector_sum_squares (v)));
return SCM_UNSPECIFIED;
}
SCM_PROC (s_random_normal, "random:normal", 0, 1, 0, scm_random_normal);
SCM
scm_random_normal (SCM state)
{
if (SCM_UNBNDP (state))
state = SCM_CDR (scm_var_random_state);
SCM_ASSERT (SCM_NIMP (state) && SCM_RSTATEP (state),
state,
SCM_ARG1,
s_random_normal);
return scm_makdbl (scm_c_normal01 (SCM_RSTATE (state)), 0.0);
}
SCM_PROC (s_random_normal_vector_x, "random:normal-vector!", 1, 1, 0, scm_random_normal_vector_x);
SCM
@ -528,6 +529,8 @@ scm_random_normal_vector_x (SCM v, SCM state)
return SCM_UNSPECIFIED;
}
#endif /* HAVE_ARRAYS */
SCM_PROC (s_random_exp, "random:exp", 0, 1, 0, scm_random_exp);
SCM